Class: Message

Message

An api adapter over the end points handling a specific message in a character's inbox via functions in the mail ESI endpoints. You should not usually instantiate this directly as its constructor requires an internal api instance.


new Message(mail, messageId)

Create a new Message adaptor owned by the given mail corresponding to the given messageId.

Parameters:
Name Type Description
mail Mail

The owning fleet

messageId Number

The message id of this instance

Methods


del()

Delete a mail.

This makes an HTTP DELETE request to /characters/{character_id}/mail/{mail_id}/. The route version is v1.

On success, this resolves to an empty object.

This function must be used with an SSO token that has the following scopes:

  • esi-mail.organize_mail.v1
Returns:

A Promise that resolves to an empty object.

Type
Promise.<Object>

info()

Return the contents of an EVE mail. This route is cached for up to 30 seconds.

This makes an HTTP GET request to /characters/{character_id}/mail/{mail_id}/. The route version is v1.

On success, this resolves to contents of a mail. An example result is:

{
  "body": "blah blah blah",
  "from": 90000001,
  "labels": [
    2
  ],
  "read": false,
  "recipients": [
    {
      "recipient_id": 0,
      "recipient_type": "recipient_type string"
    }
  ],
  "subject": "test",
  "timestamp": "2015-09-30T16:07:00Z"
}

This function must be used with an SSO token that has the following scopes:

  • esi-mail.read_mail.v1
Returns:

A Promise that resolves to the parsed JSON of the response.

Type
Promise.<Object>

update(labels, read)

Update metadata about a mail.

This makes an HTTP PUT request to /characters/{character_id}/mail/{mail_id}/. The route version is v1.

The route parameter, contents, is built implicitly by the function. The function argument labels maps to the labels property of the contents route parameter. The array length of labels can be at most 25. The function argument read maps to the read property of the contents route parameter.

On success, this resolves to an empty object.

This function must be used with an SSO token that has the following scopes:

  • esi-mail.organize_mail.v1
Parameters:
Name Type Description
labels Array.<Number>

Labels to assign to the mail. Pre-existing labels are unassigned. Array of label ids to attach to the message

read Boolean

Whether the mail is flagged as read. True or false if the message is marked as read

Returns:

A Promise that resolves to an empty object.

Type
Promise.<Object>