Class: Thread

Thread

new Thread(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:

Extends

Methods

(static) 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

destroy() → {Promise}

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

Source:
See:
Returns:

A Promise, as per Client.destroyMessages.

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

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:
Returns:

A Promise, as per Client.setMessages.

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

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:
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:
Returns:

A Promise, as per Client.setMessages.

Type
Promise