Global

Members

then

Do not override

Source:

when

Do not override

Source:

Methods

append(name, value)

Will append the value to the building object, using the name as key.

Parameters:
Name Type Description
name String

The name to use as key.

value *

The value to append.

Source:
Returns:

this builder

appendDateIfDefined(name, dateopt)

If defined, it will append date to the building object as an ISO Date String, using name as the key.

Parameters:
Name Type Attributes Description
name String

The name to use as key.

date Date <optional>

The Date to append.

Source:
See:
Returns:

This JSONBuilder instance

appendIfDefined(name, valueopt)

If defined, it will append the value to the building object, using the name as key.

Parameters:
Name Type Attributes Description
name String

The name to use as key.

value * <optional>

The value to append.

Source:
Returns:

this builder

appendIfNotEmpty(name, valueopt)

If defined and not empty, it will append the value array to the building object, using the name as key.

Parameters:
Name Type Attributes Description
name String

The name to use as key.

value Array <optional>

The value to append.

Source:
Returns:

this builder

appendObject(name, value)

Will append the value object to the building object by recursively calling toJSONObject() on each child if an object.

Parameters:
Name Type Description
name String

The name to use as key.

value Array

The Object to append

Source:

appendQueryParameter(uri, key, value) → {String}

Appends a query parameter to an existing URL, taking care of existing query parameters.
This method returns uri as-is if key or value is not defined.

Parameters:
Name Type Description
uri String

The URI to modify.

key String

The name of the parameter to append.

value String

The value of the parameter to append.

Source:
Returns:

The modified URI.

Type
String

assertRequiredParameterHasType(parameter, name, type) → {*}

Asserts that the given parameter is present and has the expected type.
This method is intended to be called when you need to validate input parameters of functions. Examples: assertRequiredParameterHasType(5, 'name', 'number') => returns 5 assertRequiredParameterHasType({}, 'name', CustomClass) => throws an Error

Parameters:
Name Type Description
parameter *

The parameter to validate.

name String

The name of the parameter, as given to the calling function. This is used to format the error message contained by the thrown Error.

type String | Type

The expected type of the parameter.

Source:
Throws:

If the parameter is not defined or is not an object.

Type
Error
Returns:

The validated parameter, as-is.

Type
*

assertRequiredParameterIsArrayWithMinimumLength(parameter, name, lengthopt) → {*}

Asserts that the given parameter is an Array with a minimum length.
This method is intended to be called when you need to validate input parameters of functions.

Parameters:
Name Type Attributes Default Description
parameter *

The parameter to validate.

name String

The name of the parameter, as given to the calling function. This is used to format the error message contained by the thrown Error.

length Number <optional>
0

The minimum required length of the array.

Source:
Throws:

If the parameter is not an array of does not have the minimum length.

Type
Error
Returns:

The validated parameter, as-is.

Type
*

assertRequiredParameterIsObject(parameter, name) → {*}

Asserts that the given parameter is present and is an object.
This method is intended to be called when you need to validate input parameters of functions.

Parameters:
Name Type Description
parameter *

The parameter to validate.

name String

The name of the parameter, as given to the calling function. This is used to format the error message contained by the thrown Error.

Source:
Throws:

If the parameter is not defined or is not an object.

Type
Error
Returns:

The validated parameter, as-is.

Type
*

assertRequiredParameterIsPresent(parameter, name, message) → {*}

Asserts that the given parameter is present (read: truthy).
This method is intended to be called when you need to validate input parameters of functions.

Parameters:
Name Type Default Description
parameter *

The parameter to validate.

name String

The name of the parameter, as given to the calling function. This is used to format the error message contained by the thrown Error.

message String null

Optionnal alternative message to display when error

Source:
Throws:

If the parameter is not defined.

Type
Error
Returns:

The validated parameter, as-is.

Type
*

assertValidJMAPResponse(request, data) → {*}

Asserts that the given data is a valid JMAP response.
This method is intended to be called by instances of Client, or by any other object making JMAP requests, when validation of the response is required.

The following checks are made by this method:

  • data is defined and is an array
  • data has one or more elements, and all elements are arrays
  • data[0][0] is either
    • the expected response string (computed with the help of the request parameter)
    • 'error'
    • an unknown response
  • data[0][1] exists
Parameters:
Name Type Description
request String

The JMAP request to check the response for. This should be a valid JMAP request name.

data *

The JMAP response to validate.

Source:
Throws:

If the received data is not a valid JMAP response.

Type
Error
Returns:

The data, as-is, if it is detected as a valid JMAP response.

Type
*

authenticate(username, deviceName, continuationCallback) → {Promise}

Implement the 2-step JMAP authentication protocol.
This method abstract the two authentication steps:

  1. query the JMAP server to get a continuation token
  2. query the JMAP server with the continuation token (and password), to get the final accessToken.
Parameters:
Name Type Description
username String

The username to authenticate with

deviceName String

A unique device name

continuationCallback function

A function that takes an AuthContinuation object as argument, and should return a promise, that will eventually resolve with an object denoting the chosen authentication method and the optional password (if method == password).

Source:
Returns:

A Promise that will eventually be resovled with a AuthAccess object

Type
Promise

authExternal(username, deviceName, continuationCallback) → {Promise}

Implement the JMAP external authentication protocol.
This method abstract the two authentication steps:

  1. query the JMAP server to get a continuation token
  2. query the JMAP server with the continuation token, to get the final accessToken.

Between those two steps, a user provided function wil be called to handle the external authentication part.
This method returns a promise that will eventually be resovled with a AuthAccess object. It's the responsability of the caller to then set the AuthToken using for example:
client.withAuthenticationToken(authAccess.accessToken);
Parameters:
Name Type Description
username String

The username of the user to authenticate.

deviceName String

A unique device name

continuationCallback function

A function that takes an AuthContinuation object as argument, and should return a promise, that will resolve once the external authentication is complete.

Source:
Returns:

A Promise that will eventually be resovled with a AuthAccess object

Type
Promise

authPassword(username, password, deviceName) → {Promise}

Implement the JMAP password authentication protocol.
This method abstract the two authentication steps:

  1. query the JMAP server to get a continuation token
  2. query the JMAP server with the continuation token and the password, to get the final accessToken.
Parameters:
Name Type Description
username String

The username of the user to authenticate

password String

The password of the user to authenticate

deviceName String

A unique device name

Source:
Returns:

A Promise that will eventually be resovled with a AuthAccess object

Type
Promise

build()

Source:
Returns:

an object with all appended values

capitalize(str) → {String}

Capitalizes the given String, that is, returns the same string with the first character in uppercase.
If undefined, null, the empty string or something else that a string is given, the argument is returned as-is.

Parameters:
Name Type Description
str String

The String to capitalize.

Source:
Returns:

The capitalized String.

Type
String

createMailbox(name, parentIdopt) → {Promise}

Creates a mailbox by sending a setMailboxes JMAP request.

Parameters:
Name Type Attributes Default Description
name String

The name of the mailbox to create.

parentId String <optional>
null

The id of the parent of the mailbox to create.

Source:
See:
Returns:

A Promise that eventually resolves to a Mailbox.

Type
Promise

destroy() → {Promise}

Destroy this Message on the server.

Source:
See:
  • Client#destroyMessage
Returns:

A Promise, as per Client.destroyMessage.

Type
Promise

destroy() → {Promise}

Destroy this Thread on the server.
This will internally destory all messages contained in this thread.

Source:
See:
  • Client#destroyMessages
Returns:

A Promise, as per Client.destroyMessages.

Type
Promise

destroy() → {Promise}

Destroy this Mailbox on the server.

Source:
See:
  • Client#destroyMailbox
Returns:

A Promise, as per Client.destroyMailbox.

Type
Promise

destroyMailbox(id) → {Promise}

Destroy the Mailbox related to the given id on the server.
This will issue a Client#destroyMailboxes request under the hoods, passing [id] option.

Parameters:
Name Type Description
id String

The id of the mailbox to destroy.

Source:
Returns:

A Promise that eventually resolves to nothing if the Mailbox was destroyed successfully.

Type
Promise

destroyMailboxes(ids) → {Promise}

Destroy multiple Mailboxes specified to the given ids on the server.
This will issue a Client#setMailboxes JMAP request under the hoods, passing the correct options.

Parameters:
Name Type Description
ids Array.<String>

An array IDs of the mailboxes to destroy. These IDs must be in the right order: Destroy X comes before destroy Y if X is a descendent of Y.

Source:
See:
Returns:

A Promise that eventually resolves to nothing if all Mailboxes were destroyed successfully. Otherwise, it rejects error message of the first notDestroyed mailbox.

Type
Promise

destroyMessage(id) → {Promise}

Destroy the Message related to the given id on the server.
This will issue a Client#setMessages JMAP request under the hoods, passing the correct options.

Parameters:
Name Type Description
id String

The id of the object to destroy.

Source:
See:
  • Client#setMessages
Returns:

A Promise that eventually resolves to nothing if the Message was destroyed successfully.

Type
Promise

destroyMessages(ids) → {Promise}

Destroy several Messages at once.
This will issue a Client#setMessages JMAP request under the hoods, passing the correct options.

Parameters:
Name Type Description
ids Array.<String>

The list of ids of the messages to destroy.

Source:
See:
  • Client#setMessages
Returns:

A Promise that resolves to a SetResponse, containing the result of the operation.

Type
Promise

fillURITemplate(uri, parameters) → {String}

Fills a URI template by substituting variables by their corresponding values.
This supports Level 1 URI templates only, as per this RFC.

Parameters:
Name Type Description
uri String

The URI template to fill.

parameters Object

A hash of name/value pairs used for variables substitution.

Source:
Returns:

The filled URI template.

Type
String

fromJSONObject(jmap, object) → {MessageList}

Creates a MessageList from its JSON representation.

Parameters:
Name Type Description
jmap Client

The Client instance passed to the MessageList constructor.

object Object

The JSON representation of the MessageList, as a Javascript object.

Source:
Returns:
Type
MessageList

fromJSONObject(jmap, object) → {Message}

Creates a Message from its JSON representation.

Parameters:
Name Type Description
jmap Client

The Client instance passed to the Message constructor.

object Object

The JSON representation of the Message, as a Javascript object.

Properties
Name Type Description
id Object

The identifier of the Message.

blobId String

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

threadId String

The identifier of the thread the Message is in.

mailboxIds Array.<String>

The array of Mailbox identifiers the Message is present into.

Source:
Returns:
Type
Message

fromJSONObject(jmap, object) → {SetResponse}

Creates a SetResponse from its JSON representation.

Parameters:
Name Type Description
jmap Client

The Client instance passed to the SetResponse constructor.

object Object

The JSON representation of the SetResponse, as a Javascript object.

Source:
Returns:
Type
SetResponse

fromJSONObject(jmap, object) → {Thread}

Creates a Thread from its JSON representation.

Parameters:
Name Type Description
jmap Client

The Client instance passed to the Thread constructor.

object Object

The JSON representation of the Thread, as a Javascript object.

Properties
Name Type Description
id String

The identifier of the Thread.

Source:
Returns:
Type
Thread

fromJSONObject(jmap, object) → {Mailbox}

Creates a Mailbox from its JSON representation.

Parameters:
Name Type Description
jmap Client

The Client instance passed to the Mailbox constructor.

object Object

The JSON representation of the Mailbox, as a Javascript object.

Properties
Name Type Description
id String

The identifier of the Mailbox.

name String

The user-visible name of the Mailbox.

Source:
Returns:
Type
Mailbox

fromJSONObject(jmap, object) → {Attachment}

Creates an Attachment from its JSON representation.

Parameters:
Name Type Description
jmap Client

The Client instance used to fetch the parent Message.

object Object

The JSON representation of the Attachment, as a Javascript object.

Properties
Name Type Description
blobId String

The id of the binary data for this Attachment.

Source:
Returns:
Type
Attachment

fromJSONObject(jmap, object) → {Account}

Creates an Account from its JSON representation.

Parameters:
Name Type Description
jmap Client

The Client instance passed to the Account constructor.

object Object

The JSON representation of the Account, as a Javascript object.

Properties
Name Type Description
id String

The identifier of the Account.

Source:
Returns:
Type
Account

fromJSONObject(jmap, object) → {EMailer}

Creates a EMailer from its JSON representation.

Parameters:
Name Type Description
jmap Client

The Client instance that originates the EMailer instance. Is actually ignored.

object Object

The JSON representation of the EMailer, as a Javascript object

Source:
Returns:
Type
EMailer

getAccounts(optionsopt) → {Promise}

Sends a getAccounts JMAP request.

Parameters:
Name Type Attributes Default Description
options Object <optional>
null

The options to the getAccounts JMAP request.

Source:
See:
Returns:

A Promise that eventually resolves to an array of Account objects.

Type
Promise

getMailboxes(optionsopt) → {Promise}

Fetches all mailboxes of this Account.
This will delegate to Client#getMailboxes, passing this Account's id as the accountId option.

Parameters:
Name Type Attributes Description
options Object <optional>

The options object passed to Client#getMailboxes. Please note that the accountId option will be overriden if defined.

Source:
See:
Returns:

A promise that eventually resolves with an array of Mailbox instances.

Type
Promise

getMailboxes(optionsopt) → {Promise}

Sends a getMailboxes JMAP request.

Parameters:
Name Type Attributes Default Description
options Object <optional>
null

The options to the getMailboxes JMAP request.

Source:
See:
Returns:

A Promise that eventually resolves to an array of Mailbox objects.

Type
Promise

getMailboxWithRole(role, optionsopt) → {Promise}

Finds a Mailbox with the given role.
This will issue a getMailboxes JMAP request and search for the mailbox in the returned list.

Parameters:
Name Type Attributes Default Description
role MailboxRole | String

The desired mailbox role.

options Object <optional>
null

The options to the implicit getMailboxes JMAP request.

Source:
See:
Returns:

A Promise that eventually resolves to the Mailbox if found.

Type
Promise

getMessageList(optionsopt) → {Promise}

Fetches a message list from this Mailbox.
This will delegate to Client#getMessageList, passing the following filter:

{
  inMailboxes: [<this Mailbox id>]
}
Parameters:
Name Type Attributes Description
options Object <optional>

The options object passed to Client#getMessageList. Please note that the filter option will be overriden if defined.

Source:
See:
Returns:

A promise that eventually resolves with a MessageList instance.

Type
Promise

getMessageList(optionsopt) → {Promise}

Sends a getMessageList JMAP request.

Parameters:
Name Type Attributes Default Description
options Object <optional>
null

The options to the getMessageList JMAP request.

Source:
See:
Returns:

A Promise that eventually resolves to a MessageList object.

Type
Promise

getMessages(optionsopt) → {Promise}

Fetches all messages contained in this MessageList.
This will delegate to Client#getMessages, passing this MessageList's messageIds as the ids option.

Parameters:
Name Type Attributes Description
options Object <optional>

The options object passed to Client#getMessages. Please note that the ids option will be overriden if defined.

Source:
See:
Returns:

A promise that eventually resolves with an array of Message instances.

Type
Promise

getMessages(optionsopt) → {Promise}

Sends a getMessages JMAP request.

Parameters:
Name Type Attributes Default Description
options Object <optional>
null

The options to the getMessages JMAP request.

Source:
See:
Returns:

A Promise that eventually resolves to an array of Message objects.

Type
Promise

getMessages(optionsopt) → {Promise}

Fetches all messages contained in this Thread.
This will delegate to Client#getMessages, passing this Thread's messageIds as the ids option.

Parameters:
Name Type Attributes Description
options Object <optional>

The options object passed to Client#getMessages. Please note that the ids option will be overriden if defined.

Source:
See:
Returns:

A promise that eventually resolves with an array of Message instances.

Type
Promise

getMethod(type) → {AuthMethod}

Getter for the AuthMethod instance matching the given authentication type

Parameters:
Name Type Description
type String

The authentication type

Source:
Returns:
Type
AuthMethod

getSignedDownloadUrl() → {Promise}

Gets a signed download URL for this Attachment. Details of this process can be found in the spec.
This mandates that url is defined on this Attachment instance, otherwise we cannot get a signed URL.

Source:
Throws:

If this Attachment instance has no URL available.

Type
Error
Returns:

A Promise eventually resolving to the signed download URL.

Type
Promise

getThreads(optionsopt) → {Promise}

Sends a getThreads JMAP request.

Parameters:
Name Type Attributes Default Description
options Object <optional>
null

The options to the getThreads JMAP request.

Source:
See:
Returns:

A Promise that eventually resolves to an array of Thread objects.

Type
Promise

getThreads(optionsopt) → {Promise}

Fetches all threads contained in this MessageList.
This will delegate to Client#getThreads, passing this MessageList's threadIds as the ids option.

Parameters:
Name Type Attributes Description
options Object <optional>

The options object passed to Client#getThreads. Please note that the ids option will be overriden if defined.

Source:
See:
Returns:

A promise that eventually resolves with an array of Thread instances.

Type
Promise

getVacationResponse(optionsopt) → {Promise}

Gets the singleton VacationResponse instance for a given account.
This will send a getVacationResponse request to the JMAP backend.

Parameters:
Name Type Attributes Description
options Object <optional>

The options to the underlying getVacationResponse JMAP request.

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

The account ID to get the vacation response for. If null, the primary account is used.

Source:
Returns:

A Promise that eventually resolves to the VacationResponse instance.

Type
Promise

hasCalendars() → {Boolean}

Returns whether this Account supports calendars or not.

Source:
Returns:

true if and only if this Account has calendars enabled, false otherwise.

Type
Boolean

hasContacts() → {Boolean}

Returns whether this Account supports contacts or not.

Source:
Returns:

true if and only if this Account has contacts enabled, false otherwise.

Type
Boolean

hasMail() → {Boolean}

Returns whether this Account supports mail or not.

Source:
Returns:

true if and only if this Account has mail enabled, false otherwise.

Type
Boolean

isDefined(parameter) → {Boolean}

Check is the parameter is not undefined and not null.

Parameters:
Name Type Description
parameter *

The parameter to check.

Source:
Returns:

True if parameter is not undefined and not null.

Type
Boolean

move(mailboxIds) → {Promise}

Moves this Thread to a different set of mailboxes.

Parameters:
Name Type Description
mailboxIds Array.<String>

The identifiers of the target mailboxes for the thread.

Source:
See:
  • Client#setMessages
Returns:

A Promise, as per Client.setMessages.

Type
Promise

move(mailboxIds) → {Promise}

Moves this Message to a different set of mailboxes.

Parameters:
Name Type Description
mailboxIds Array.<String>

The identifiers of the target mailboxes for the message.

Source:
See:
  • Client#moveMessage
Returns:

A Promise, as per Client.moveMessage.

Type
Promise

moveMessage(id, mailboxIds) → {Promise}

Moves a Message to a different set of mailboxes.
This will issue a Client#setMessages JMAP request under the hoods, passing the correct options.

Parameters:
Name Type Description
id String

The id of the Message to move.

mailboxIds Array.<String>

The identifiers of the target mailboxes for the message.

Source:
See:
  • Client#setMessages
Returns:

A Promise that eventually resolves to nothing if the message was moved successfully.

Type
Promise

moveToMailboxWithRole(role) → {Promise}

Moves this Message to the mailbox holding the given role.
This will first do a JMAP request to find the mailbox with the given role, then a Message#move to move the message.

Parameters:
Name Type Description
role MailboxRole | String

The desired mailbox role.

Source:
See:
Returns:

A Promise, as per Message#move.

Type
Promise

moveToMailboxWithRole(role) → {Promise}

Moves this Thread to the mailbox holding the given role.
This will first do a JMAP request to find the mailbox with the given role, then a Thread#move to move the message.

Parameters:
Name Type Description
role MailboxRole | String

The desired mailbox role.

Source:
See:
Returns:

A Promise, as per Thread#move.

Type
Promise

(abstract) newPromise(resolver) → {Promise}

This method must be implemented by concrete PromiseProvider implementations in such a way that:

  • A Promise is created from the resolver argument and is returned.
  • The Promise will be fulfilled when the resolve function of the resolver is called.
  • The Promise will be rejected when the reject function of the resolver is called.
Parameters:
Name Type Description
resolver function

A Function with two arguments resolve and reject, both functions. The first argument fulfills the promise, the second argument rejects it.

Source:
Returns:
Type
Promise

nthElementOrDefault(array, index, defaultValue) → {*}

Returns the value at index in the given Array, or the default value if the array is undefined, null, if index is negative or there is not enough elements in the array.

Parameters:
Name Type Description
array

The Array to get the value from.

index

The index of the desired value.

defaultValue

The default value to return if the element cannot be found in the array.

Source:
Returns:

The found value or the given default.

Type
*

objectValues(object)

Can't make babel pollyfills to work with Karma. This is a hackity hack. Object.values is part of ES7 standard.

Parameters:
Name Type Description
object
Source:

(abstract) post(url, headers, data, raw) → {Promise}

This method must be implemented by concrete Transport implementations in such a way that:

  • A HTTP POST request is made on url with the given headers and data (i.e.: payload)
  • A Promise is returned (this.promiseProvider will be available to create Promise instances)
  • The Promise is fulfilled when the HTTP request returns 200 (http://jmap.io/spec.html#jmap-over-https)
  • The Promise is rejected if the HTTP request fails, or if the return status code is not 200
  • When the Promise is fulfilled, the raw JMAP response is returned
Parameters:
Name Type Description
url String

The URL to POST to

headers Object

A hash of header names to header values that must be transmitted as part of the request

data *

The request payload, as a Javascript object. It's the responsibility of the Transport implementation to serialize the data as a JSON String whenever required.

raw Boolean

Whether the requests sends and expects raw (plain text) data instead of the default JSON.

Source:
Returns:
Type
Promise

saveAsDraft(message) → {Promise}

Save a message as draft by sending a setMessages JMAP request.
The mailboxIds and isDraft properties of the given message will be overridden by this method.

Parameters:
Name Type Description
message OutboundMessage

The message to save.

Source:
See:
Returns:

A Promise that eventually resolves to a CreateMessageAck.

Type
Promise

send(message, outbox) → {Promise}

Sends a message by issuing a setMessages JMAP request.
The mailboxIds and isDraft properties of the given message will be overridden by this method.

Parameters:
Name Type Description
message OutboundMessage

The message to send.

outbox Mailbox

The Mailbox with role='outbox', if already available

Source:
See:
Returns:

A Promise that eventually resolves to a CreateMessageAck.

Type
Promise

setFilter(filterRules, optionsopt) → {Promise}

Sets the singleton FilterRule instance for a given account.
This will send a setFilter request to the JMAP backend.

Parameters:
Name Type Attributes Description
filterRules Array.<FilterRule> | Array.<Object>

The list of filter rules to set

options Object <optional>

The options to the underlying setFilter JMAP request.

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

The account ID to set the filtering rules for. If null, the primary account is used.

Source:
Returns:

A Promise that eventually resolves to nothing upon success.

Type
Promise

setIsAnswered(isAnswered) → {Promise}

Updates the isAnswered field of this Message.

Parameters:
Name Type Description
isAnswered Boolean

The isAnswered field of the message.

Source:
See:
  • Client#updateMessage
Returns:

A Promise, as per Client.updateMessage.

Type
Promise

setIsFlagged(isFlagged) → {Promise}

Updates the isFlagged field of this Message.

Parameters:
Name Type Description
isFlagged Boolean

The isFlagged field of the message.

Source:
See:
  • Client#updateMessage
Returns:

A Promise, as per Client.updateMessage.

Type
Promise

setIsFlagged(isFlagged) → {Promise}

Updates the isFlagged field of all Messages of this Thread.

Parameters:
Name Type Description
isFlagged Boolean

The isFlagged field of the thread.

Source:
See:
  • Client#setMessages
Returns:

A Promise, as per Client.setMessages.

Type
Promise

setIsUnread(isUnread) → {Promise}

Updates the isUnread field of this Message.

Parameters:
Name Type Description
isUnread Boolean

The isUnread field of the thread.

Source:
See:
  • Client#setMessages
Returns:

A Promise, as per Client.setMessages.

Type
Promise

setIsUnread(isUnread) → {Promise}

Updates the isUnread field of this Message.

Parameters:
Name Type Description
isUnread Boolean

The isUnread field of the message.

Source:
See:
  • Client#updateMessage
Returns:

A Promise, as per Client.updateMessage.

Type
Promise

setMailboxes(optionsopt) → {Promise}

Sends a setMailboxes JMAP request.

Parameters:
Name Type Attributes Default Description
options Object <optional>
null

The options to the setMailboxes JMAP request.

Source:
See:
Returns:

A Promise that eventually resolves to a Mailbox object.

Type
Promise

setMessages(optionsopt) → {Promise}

Sends a setMessages JMAP request.

Parameters:
Name Type Attributes Default Description
options Object <optional>
null

The options to the setMessages JMAP request.

Source:
See:
Returns:

A Promise that eventually resolves to a SetResponse object.

Type
Promise

setVacationResponse(vacationResponse, optionsopt) → {Promise}

Sets the singleton VacationResponse instance for a given account.
This will send a setVacationResponse request to the JMAP backend.

Parameters:
Name Type Attributes Description
vacationResponse VacationResponse

The VacationResponse instance to set

options Object <optional>

The options to the underlying setVacationResponse JMAP request.

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

The account ID to set the vacation response for. If null, the primary account is used.

Source:
Returns:

A Promise that eventually resolves to nothing upon success.

Type
Promise

supports(type) → {Boolean}

Checks if the given authentication type is supported by one of the registred auth methods

Parameters:
Name Type Description
type String

The authentication type to check

Source:
Returns:

True if supported, False otherwise

Type
Boolean

toJSONObject()

Creates a JSON representation from this model.

Source:
Returns:

JSON object with only owned properties and non default values.

toJSONObject()

Creates a JSON representation from this Account.

Source:
Returns:

JSON object with only owned properties and non-null default values.

toJSONObject() → {*|JSON|Object}

Do not override

Source:
Returns:
Type
* | JSON | Object

toJSONObject()

Creates a JSON representation from this model.

Source:
Returns:

JSON object with only owned properties and non default values.

toJSONObject()

Creates a JSON representation from this AuthAccess.

Source:
Returns:

JSON object with only owned properties and non-null default values.

toString() → {String}

Returns a String representation of this JmapError.

Source:
Returns:

The human-readable representation of this JmapError.

Type
String

unknown() → {EMailer}

This method returns the unknown EMailer, that is, an EMailer instance with all fields set to defaults.

Source:
Returns:

The unknown EMailer.

Type
EMailer

update(options) → {Promise}

Update this Mailbox.

Parameters:
Name Type Description
options Object

The attribute to be updated in this Mailbox.

Properties
Name Type Attributes Default Description
name String

The user-visible name of the Mailbox.

parentId String <optional>
null

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

Source:
See:
  • Client#updateMailbox
Returns:

A Promise, as per Client.updateMailbox.

Type
Promise

update(options) → {Promise}

Updates this Message.

Parameters:
Name Type Description
options Object

The options to be updated in this Message as per Client.updateMessage.

Source:
See:
  • Client#updateMessage
Returns:

A Promise, as per Client.updateMessage.

Type
Promise

updateMailbox(id, options) → {Promise}

Updates properties of a Mailbox.
This will issue a Client#setMailboxes JMAP request under the hoods, passing the correct options.

Parameters:
Name Type Description
id String

The id of the Mailbox to update.

options Object

The options of the target mailbox to be updated.

Source:
See:
Returns:

A Promise that eventually resolves to nothing if the mailbox was updated successfully.

Type
Promise

updateMessage(id, options) → {Promise}

Updates properties of a Message.
This will issue a Client#setMessages JMAP request under the hoods, passing the correct options.

Parameters:
Name Type Description
id String

The id of the Message to update.

options Object

The options of the target message to be updated.

Properties
Name Type Description
mailboxIds Array.<String>

The identifiers of the new mailboxes for the message.

isFlagged Boolean

This corresponds whether the message is flagged or not

isUnread Boolean

This corresponds whether the message has been yet read or not

isAnswered Boolean

This corresponds whether the message has been yet replied or not

Source:
See:
Returns:

A Promise that eventually resolves to nothing if the message was updated successfully.

Type
Promise

withAPIUrl(url) → {Client}

Sets the API URL of the target JMAP server. All JMAP requests will be sent to this URL.

The URL will be exposed as the apiUrl property afterwards.

Parameters:
Name Type Description
url String

The API URL of the JMAP server.

Source:
Returns:

This Client instance.

Type
Client

withAuthAccess(access) → {Client}

Initializes the client with an AuthAccess model from an authentication response.

The individual properties of the AuthAccess object will be copied into client properties.

Parameters:
Name Type Description
access AuthAccess | Object

The response object from an authenticate process.

Source:
Returns:

This Client instance.

Type
Client

withAuthenticationToken(token, schemeopt) → {Client}

Registers an authentication token, obtained by an external mechanism from the target JMAP server.
This token will then be used as the Authorization header, as per http://jmap.io/spec.html#authenticating-http-requests.

The token will be exposed as the authToken property afterwards.

Parameters:
Name Type Attributes Description
token String

The authentication token to use in JMAP requests.

scheme String <optional>

The authentication scheme according to RFC 7235

Source:
Returns:

This Client instance.

Type
Client

withAuthenticationUrl(url) → {Client}

Registers an authentication URL, that will be used as the endpoint to send authentication requests to the server.

The URL will be exposed as the authenticationUrl property afterwards.

Parameters:
Name Type Description
url String

The authentication url to use in JMAP requests.

Source:
Returns:

This Client instance.

Type
Client

withCustomMailboxRoles(roles) → {Client}

Initializes the client with a list of custom mailbox roles.
Mailboxes having these custom roles will preserve their roles.

Parameters:
Name Type Description
roles Array.<String>

The custom roles to be added

Source:
Returns:

This Client instance.

Type
Client

withDownloadUrl(url) → {Client}

Sets the download URL, i.e.: the URL used to download attachments to Messages.

The URL will be exposed as the downloadUrl property afterwards.

Parameters:
Name Type Description
url String

The download URL of the JMAP server.

Source:
Returns:

This Client instance.

Type
Client