SpamTrainingSample
SpamTrainingSample
Section titled “SpamTrainingSample”Stores an email sample used for spam classifier training.
This object can be configured from the WebUI under Account › Spam Samples
Fields
Section titled “Fields”Type:
EmailAddress· read-only · server-setEmail address of the sender of the message associated with this training sample
subject
Section titled “subject”Type:
String· server-setSubject of the message associated with this training sample
blobId
Section titled “blobId”Type:
BlobId· read-onlyReference to the stored message content
isSpam
Section titled “isSpam”Type:
Boolean· read-only · default:falseIndicates whether the sample is spam (true) or ham (false)
accountId
Section titled “accountId”Type:
Id<Account>?· read-onlyIdentifier of the account associated with this training sample
expiresAt
Section titled “expiresAt”Type:
UTCDateTime· server-setTimestamp when the training sample is scheduled to expire
deleteAfterUse
Section titled “deleteAfterUse”Type:
Boolean· read-only · default:falseIndicates whether the training sample should be deleted after being used for training
JMAP API
Section titled “JMAP API”The SpamTrainingSample object is available via the urn:stalwart:jmap capability.
x:SpamTrainingSample/get
Section titled “x:SpamTrainingSample/get”This is a standard Foo/get method as defined in RFC 8620, Section 5.1.
This method requires the sysSpamTrainingSampleGet permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:SpamTrainingSample/get", { "ids": [ "id1" ] }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'x:SpamTrainingSample/set
Section titled “x:SpamTrainingSample/set”This is a standard Foo/set method as defined in RFC 8620, Section 5.3.
Supports create, update, and destroy operations in a single call.
Create
Section titled “Create”This operation requires the sysSpamTrainingSampleCreate permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:SpamTrainingSample/set", { "create": { "new1": {} } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'Update
Section titled “Update”This operation requires the sysSpamTrainingSampleUpdate permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:SpamTrainingSample/set", { "update": { "id1": { "description": "updated value" } } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'Destroy
Section titled “Destroy”This operation requires the sysSpamTrainingSampleDestroy permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:SpamTrainingSample/set", { "destroy": [ "id1" ] }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'x:SpamTrainingSample/query
Section titled “x:SpamTrainingSample/query”This is a standard Foo/query method as defined in RFC 8620, Section 5.5.
This method requires the sysSpamTrainingSampleQuery permission.
curl -X POST https://mail.example.com/api \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:SpamTrainingSample/query", { "filter": { "accountId": "id1" } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'The x:SpamTrainingSample/query filter argument accepts the following conditions (combinable with AnyOf / AllOf / Not per RFC 8620):
| Condition | Kind |
|---|---|
accountId | id of Account |
stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.
stalwart-cli get SpamTrainingSample id1Create
Section titled “Create”stalwart-cli create SpamTrainingSamplestalwart-cli query SpamTrainingSamplestalwart-cli query SpamTrainingSample --where accountId=id1Update
Section titled “Update”stalwart-cli update SpamTrainingSample id1 --field description='updated value'Delete
Section titled “Delete”stalwart-cli delete SpamTrainingSample --ids id1