Class: Mailbox

Mailbox

new Mailbox(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.

Source:
See:

Extends

Methods

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

destroy() → {Promise}

Destroy this Mailbox on the server.

Source:
See:
Returns:

A Promise, as per Client.destroyMailbox.

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

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

A Promise, as per Client.updateMailbox.

Type
Promise