Class: exports

exports(jmap, blobId, optsopt)

new exports(jmap, blobId, optsopt)

This class represents a JMAP Attachment.
An Attachment object holds all information of a given attachment of a Message.

Parameters:
Name Type Attributes Description
jmap Client

The Client instance that created the parent Message.

blobId String

The id of the binary data.

opts Object <optional>

The optional properties of this Attachment.

Properties
Name Type Attributes Default Description
url String <optional>
null

The URL to download the attachment. If not passed as a parameter, this will be deduced from the configured downloadUrl of the Client instance used to fetch the Message containing this Attachment. If the library does not find a reliable way of knowing the URL for this attachment, for any reason, the url property of this Attachment instance will be set to null.

type String <optional>
''

The content-type of the attachment.

name String <optional>
''

The full file name.

size Number <optional>
null

The size, in bytes, of the attachment when fully decoded.

cid String <optional>
null

The id used within the message body to reference this attachment.

isInline String <optional>
false

true if the attachment is referenced by a cid: link from within the HTML body of the message.

width String <optional>
null

The width (in px) of the image, if the attachment is an image.

height String <optional>
null

TThe height (in px) of the image, if the attachment is an image.

Source:
See:
  • Model

Extends

  • Model

exports(payload, methodopt)

new exports(payload, methodopt)

A JmapError is a custom Error thrown when a request is rejected by the JMAP backend.
The type property holds the type of error that happened. Refer to the JMAP spec for details on the available errors.
Other properties may be present with further information; these are detailed in the method descriptions where appropriate.

Parameters:
Name Type Attributes Default Description
payload Object

The error payload, from which detailed information about the error can be retrieved.

Properties
Name Type Attributes Default Description
type String <optional>

The type of this JmapError.

description String <optional>
null

The description, if any, of this JmapError.

method String <optional>
null

The JMAP method that triggered this JmapError.

Source:
See:
  • Error

exports(optsopt)

new exports(optsopt)

This class represents a JMAP MailCapabilities.
An MailCapabilities object describes mail-related capabilities of a JMAP server.

Parameters:
Name Type Attributes Description
opts Object <optional>

The optional properties of this MailCapabilities.

Properties
Name Type Attributes Default Description
maxMailboxesPerMessage Number <optional>
null

The maximum number of mailboxes that can be can assigned to a single message.

maxSizeMessageAttachments Number <optional>
0

The maximum total size of attachments, in bytes, allowed for messages.

maxDelayedSend Number <optional>
0

The number in seconds of the maximum delay the server supports in sending. 0 if delayed send is not supported.

messageListSortOptions Array.<String> <optional>
[]

A list of all the message properties the server supports for sorting by.

submissionExtensions=

{String[String[]]} Known safe-to-expose EHLO capabilities of the submission server.

Source:
See:
  • Capabilities

Extends

  • Capabilities

exports(jmap, id, name, optsopt)

new exports(jmap, id, name, optsopt)

This class represents a JMAP Mailbox.

Parameters:
Name Type Attributes Description
jmap Client

The Client instance that created this Mailbox.

id String

The unique identifier of this Mailbox.

name String

The user-visible name (i.e.: display name) of this Mailbox.

opts Object <optional>

The optional properties of this Mailbox.

Properties
Name Type Attributes Default Description
namespace= <optional>

{Object} The namespace give information about mailbox type and owner.

parentId String <optional>
null

The Mailbox id for the parent of this mailbox, or null if this mailbox is at the top level.

role String <optional>
null

The role of this mailbox, if it is a system mailbox. See the specification for the possible values.

sharedWith= <optional>

{Object} The sharedWith give information about mailbox shared and rights.

sortOrder String <optional>
0

Defines the sort order of mailboxes when presented in the UI.

mustBeOnlyMailbox Boolean <optional>
false

If true, messages in this mailbox may not also be in any other mailbox.

mayReadItems Boolean <optional>
false

If true, may use this mailbox as part of a filter in a Client#getMessageList call.

mayAddItems Boolean <optional>
false

If true, the user may add messages to this mailbox.

mayRemoveItems Boolean <optional>
false

If true, the user may remove messages from this mailbox.

mayCreateChild Boolean <optional>
false

If true, the user may create a Mailbox with this Mailbox as its parent.

mayRename Boolean <optional>
false

If true, the user may rename this mailbox or make it a child of another mailbox.

mayDelete Boolean <optional>
false

If true, the user may delete this mailbox.

totalMessages Number <optional>
0

The number of messages in this mailbox.

unreadMessages Number <optional>
0

The number of messages in this mailbox with isUnread=true and isDraft=false.

totalThreads Number <optional>
0

The number of threads where at least one message in the thread is in this mailbox.

unreadThreads Number <optional>
0

The number of threads where at least one message in the thread is in this mailbox with isUnread=true and isDraft=false.

quotas= <optional>

{Object} List of enforced quotas. 'STORAGE' for size quota and 'MESSAGE' for messages count. Each one provide used and max properties. used (Number) number of messages, or size in bytes for storage max (Number|null) maximum number of messages, or maximum size in bytes for storage. Null means unlimited

Source:
See:
  • Model

Extends

  • Model

exports(promiseProvideropt)

(abstract) exports(jmap)

(abstract) new exports(jmap)

The base class for all JMAP entities.
When implementing new entities you should always try to inherit from this.

You shouldn't use this constructor directly, but rather create instances of concrete implementations.

Parameters:
Name Type Description
jmap Client

The Client instance that created this Model. This will be exposed as the _jmap property.

Source:

exports(jmap, payload)

new exports(jmap, payload)

This class represents a JMAP Auth Access Response.

Parameters:
Name Type Description
jmap Client

The Client instance that created this AuthAccess.

payload Object

The server response of an auth access request.

Source:

exports(promiseProvideropt)

exports(transport, promiseProvideropt)

new exports(transport, promiseProvideropt)

The Client class is the main entry point for sending JMAP requests to a remote server.
It uses a fluent API so that it's easy to chain calls. JMAP requests are sent using one of the getXXX methods that map to their equivalent in the JMAP specification. For instance, if you want to do a getAccounts request, you'll use the Client#getAccounts method.

Parameters:
Name Type Attributes Default Description
transport Transport

The Transport instance used to send HTTP requests.

promiseProvider PromiseProvider <optional>
ES6PromiseProvider

The PromiseProvider implementation to use.

Source:

exports(payload)

exports(jmap, id, blobId, threadId, mailboxIds, optsopt)

new exports(jmap, id, blobId, threadId, mailboxIds, optsopt)

This class represents a JMAP Message.
When creating a new Message instance, the following requirements must be met:

  • The threadId must be defined (in JMAP, a Message is always in a Thread)
  • The mailboxIds must contain at least one element.
Parameters:
Name Type Attributes Description
jmap Client

The Client instance that created this Message.

id String

The unique identifier of this Message.

blobId String

The identifier representing the raw [@!RFC5322] message.

threadId String

The unique identifier of the Thread this Message is in.

mailboxIds Array.<String>

The array of Mailbox identifiers this Message is present into.

opts Object <optional>

The optional properties of this Message.

Properties
Name Type Attributes Default Description
inReplyToMessageId String <optional>
null

The id of the Message this Message is a reply to.

isUnread Boolean <optional>
false

Has the message not yet been read? This maps to the opposite of the \Seen flag in IMAP.

isFlagged Boolean <optional>
false

Is the message flagged? This maps to the \Flagged flag in IMAP.

isAnswered Boolean <optional>
false

Has the message been replied to? This maps to the \Answered flag in IMAP.

isForwarded Boolean <optional>
false

Has the message been forwarded ?.

isDraft Boolean <optional>
false

Is the message a draft? This maps to the \Draft flag in IMAP.

hasAttachment Boolean <optional>
false

Does the message have any attachments?

headers Object <optional>

A hash of header name to header value for all headers in the message. For headers that occur multiple times, the values are concatenated with a single new line (\n) character in between each one.

from EMailer <optional>
null

The EMailer object representing the first identified sender of this Message.

to Array.<EMailer> <optional>
[EMailer.unknown]

The array of EMailer objects representing the To: of this Message.

cc Array.<EMailer> <optional>
[EMailer.unknown]

The array of EMailer objects representing the CC: of this Message.

bcc Array.<EMailer> <optional>
[EMailer.unknown]

The array of EMailer objects representing the BCC: of this Message.

replyTo Array.<EMailer> <optional>
EMailer.unknown

The array of EMailer objects representing the Reply-To: of this Message.

subject String <optional>
null

The subject of this Message.

date Date <optional>
null

The date the Message was sent (or saved, if the message is a draft).

size String <optional>
0

The size in bytes of the whole message as counted by the server.

preview String <optional>
null

Up to 256 characters of the beginning of a plain text version of the Message body.

textBody String <optional>
null

The plain text body part for the Message.

htmlBody String <optional>
null

The HTML body part for the Message, if present.

attachments Array.<Attachment> <optional>
[]

An array of Attachment objects detailing all the attachments to the message.

Source:
See:
  • Model
  • EMailer

Extends

  • Model

exports(causeopt, statusCodeopt, responseTextopt)

new exports(causeopt, statusCodeopt, responseTextopt)

A TransportError is a custom Error thrown when a request to a remote server fails.

Parameters:
Name Type Attributes Default Description
cause * <optional>
null

The underlying cause of this TransportError. Though this is usually an Error, this might actually be anything and depends on the chosen Transport implementation.

statusCode Number <optional>
0

The HTTP status code sent by the server, if the request reached the server.

responseText String <optional>
null

The HTTP response sent by the server, if any.

Source:
See:

exports(jmap, id, optsopt)

new exports(jmap, id, optsopt)

This class represents a JMAP Thread.

Parameters:
Name Type Attributes Description
jmap Client

The Client instance that created this Thread.

id String

The unique identifier of this Thread.

opts Object <optional>

The optional properties of this Thread.

Properties
Name Type Attributes Default Description
messageIds Array.<String> <optional>
[]

An array of message identifiers contained in this Thread.

Source:
See:
  • Model

Extends

  • Model

exports(jmap, id, optsopt)

new exports(jmap, id, optsopt)

This class represents a JMAP Account.

Parameters:
Name Type Attributes Description
jmap Client

The Client instance that created this Account.

id String

The unique identifier of this Account.

opts Object <optional>

The optional properties of this Account.

Properties
Name Type Attributes Default Description
name String <optional>
''

The name of this Account.

isPrimary Boolean <optional>
false

Whether this Account is the primary email account.

isReadOnly Boolean <optional>
false

Whether the entire Account is read-only

hasDataFor Array.<String> <optional>
[]

A list of the data profiles available in this account server.

Source:
See:
  • Model

Extends

  • Model

exports(jmap, optsopt)

new exports(jmap, optsopt)

This class represents a JMAP [xxxSet] http://jmap.io/spec.html#setfoos.

Parameters:
Name Type Attributes Description
jmap Client

The Client instance that created this SetResponse.

opts Object <optional>

The optional properties of this SetResponse.

Properties
Name Type Attributes Default Description
accountId String <optional>
''

The id of the Account used in the request that originated this SetResponse.

oldState String <optional>
''

The state string that would have been returned by getXXX before making the requested changes, or null if the server doesn’t know what the previous state string was.

newState Array.<String> <optional>
''

The state string that will now be returned by getXXX.

created Array.<String> <optional>
[]

A map of the creation id to an object containing any server-assigned properties of the XXX object (including the id) for all successfully created records.

updated Array.<String> <optional>
[]

A list of XXX ids for records that were successfully updated.

destroyed Array.<String> <optional>
[]

A list of XXX ids for records that were successfully destroyed.

MDNSent Array.<String> | null <optional>
[]

A list of receipt request ids for receipt that were successfully sent.

notCreated Array.<String> <optional>
[]

A map of creation id to a SetError object for each XXX that failed to be created.

notUpdated Array.<String> <optional>
[]

A map of XXX id to a SetError object for each XXX that failed to be updated.

notDestroyed Array.<String> <optional>
[]

A map of XXX id to a SetError object for each XXX that failed to be destroyed.

MDNNotSent= <optional>

{String[SetError]|null} A map of MDN request id to a SetError object for each receipt that failed to be sent, or null if all successful.

Source:
See:
  • Model

Extends

  • Model

exports(optsopt)

new exports(optsopt)

This class represents a JMAP ServerCapabilities.
An ServerCapabilities object describes general capabilities of a JMAP server.

Parameters:
Name Type Attributes Description
opts Object <optional>

The optional properties of this ServerCapabilities.

Properties
Name Type Attributes Default Description
maxSizeUpload Number <optional>
0

The maximum file size, in bytes, that the server will accept for a single file upload.

maxSizeRequest Number <optional>
0

The maximum size, in bytes, that the server will accept for a single request to the API endpoint.

maxConcurrentUpload Number <optional>
1

The maximum number of concurrent requests the server will accept to the upload endpoint.

maxConcurrentRequests Number <optional>
1

The maximum number of concurrent requests the server will accept to the API endpoint.

maxCallsInRequest Number <optional>
1

The maximum number of method calls the server will accept in a single request to the API endpoint.

maxObjectsInGet Number <optional>
0

The maximum number of objects that the client may request in a single getXXX type method call.

maxObjectsInSet Number <optional>
0

The maximum number of objects the client may send to create, update or destroy in a single setXXX type method call.

Source:

exports(jmap, optsopt)

new exports(jmap, optsopt)

This class represents a JMAP Message but for client-to-server purpose.
When creating a new OutboundMessage instance, the following requirements must be met:

  • The id, blobId, threadId, size, preview, hasAttachment and attachedMessages must be not defined (it is set by the server upon creation)
Parameters:
Name Type Attributes Description
jmap Client

The Client instance that created this OutboundMessage.

opts Object <optional>

The optional properties of this OutboundMessage.

Properties
Name Type Attributes Default Description
mailboxIds Array.<String> <optional>
[]

The array of Mailbox identifiers which will contain this OutboundMessage.

inReplyToMessageId String <optional>
null

The id of the Message this OutboundMessage is a reply to.

isUnread Boolean <optional>
null

Has the message not yet been read? This maps to the opposite of the \Seen flag in IMAP.

isFlagged Boolean <optional>
null

Is the message flagged? This maps to the \Flagged flag in IMAP.

isAnswered Boolean <optional>
null

Has the message been replied to? This maps to the \Answered flag in IMAP.

isDraft Boolean <optional>
null

Is the message a draft? This maps to the \Draft flag in IMAP.

headers Object <optional>

A hash of header name to header value for all headers in the message. For headers that occur multiple times, the values are concatenated with a single new line (\n) character in between each one.

from String <optional>
null

Overrides the value used as From: in the headers.

to Array.<String> <optional>
null

Overrides the value used as To: in the headers.

cc Array.<String> <optional>
null

Overrides the value used as CC: in the headers.

bcc Array.<String> <optional>
null

Overrides the value used as BCC: in the headers.

replyTo String <optional>
null

Overrides the value used as Reply-To: in the headers.

subject String <optional>
null

The subject of this OutboundMessage.

textBody String <optional>
null

The plain text body part.

htmlBody String <optional>
null

The HTML body part.

attachments Array.<Attachment> <optional>
[]

An array of Attachment objects detailing all the attachments to the message. Attachments must first be uploaded using the standard upload mechanism.

Source:
See:
  • Model

Extends

  • Model

exports(payload)

new exports(payload)

This class represents a JMAP AuthMethod.

Parameters:
Name Type Description
payload Object

The server response of POST request to the authentication URL.

Source:

exports(namespace, optsopt)

exports(jmap, optsopt)

new exports(jmap, optsopt)

This class represents a JMAP MessageList.

Parameters:
Name Type Attributes Description
jmap Client

The Client instance that created this Mailbox.

opts Object <optional>

The optional properties of this Mailbox.

Properties
Name Type Attributes Default Description
accountId String <optional>
''

The id of the Account used in the request that originated this MessageList.

filter Object <optional>
null

The filter used in the request that originated this MessageList.

sort Object <optional>
null

The sort properties used in the request that originated this MessageList.

collapseThreads Boolean <optional>
false

The collapseThreads value used in the request that originated this MessageList.

position Number <optional>
0

The 0-based index of the first result in the threadIds array within the complete list.

total Number <optional>
0

The total number of messages in the message list (given the filter and collapseThreads arguments).

threadIds Array.<String> <optional>
[]

The list of Thread identifiers for each message in the list after filtering, sorting and collapsing threads.

messageIds Array.<String> <optional>
[]

The list of Message identifiers for each message in the list after filtering, sorting and collapsing threads.

Source:
See:
  • Model
  • Thread
  • Message

Extends

  • Model

exports(jmap, response)

new exports(jmap, response)

This class should be used to wrap a create response item from a setMessages request.

Parameters:
Name Type Description
jmap Client

The Client instance that created this OutboundMessage.

response Object

The raw created response object.

Properties
Name Type Attributes Default Description
blobId String

The server side generated blobId of the created message.

size Number

The server side size of the created message.

id String <optional>
null

The server side generated message id of the created message.

threadId String <optional>
null

The server side assigned threadId of the created message.

Source:
See:
  • Model

Extends

  • Model

exports(optsopt)

new exports(optsopt)

This class represents a JMAP EMailer.
An EMailer object holds the name and email address of either a sender or a recipient of a Message.

Parameters:
Name Type Attributes Description
opts Object <optional>

The optional properties of this EMailer.

Properties
Name Type Attributes Default Description
name String <optional>
''

The name of the emailer.

email String <optional>
'@'

The email address of the emailer.

Source:

exports()

new exports()

This class contains some useful utility methods.
The Utils class cannot be instantiated (its constructor will throw if called), all its methods are static.

Source:

exports()

new exports()

This class helps to create JSON representation from a model. Usage:

  return new JSONBuilder()
    .appendIfDefined('inReplyToMessageId', this.inReplyToMessageId)
    .appendIfDefined('isUnread', this.isUnread)
    .appendIfDefined('isFlagged', this.isFlagged)
    .build();
Source: