new Labels(mail)
Create a new Labels function owned by the given mail.
Parameters:
| Name | Type | Description |
|---|---|---|
mail |
The owning mail |
Methods
-
add(name, color)
-
Create a mail label.
This makes an HTTP POST request to
/characters/{character_id}/mail/labels/. The route version isv2.The route parameter,
label, is built implicitly by the function. The function argumentnamemaps to thenameproperty of thelabelroute parameter. The string length ofnamemust be between1and40. The function argumentcolormaps to thecolorproperty of thelabelroute parameter.colormust be one of the following specific values or the request will fail:#ffffff#ffff01#ff6600#fe0000#9a0000#660066#0000fe#0099ff#01ffff#00ff33#349800#006634#666666#999999#e6e6e6#ffffcd#99ffff#ccff9a
On success, this resolves to the id of the created entity.
This function must be used with an SSO token that has the following scopes:
esi-mail.organize_mail.v1
Parameters:
Name Type Description nameString Name string.
colorString Hexadecimal string representing label color, in RGB format. Defaults to white.
Returns:
A Promise that resolves to an id.
- Type
- Promise.<Number>
-
all()
-
Return a list of the users mail labels, unread counts for each label and a total unread count. This route is cached for up to 30 seconds.
This makes an HTTP GET request to
/characters/{character_id}/mail/labels/. The route version isv3.On success, this resolves to a list of mail labels and unread counts. An example result is:
[ { "color": "color string", "label_id": 0, "name": "name string", "unread_count": 0 } ]Note that the type schema of the response is modified from what is defined in ESI. Specifically, it returns only the
labelsproperty.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 labels array.
- Type
- Promise.<Array.<Object>>
-
get(id)
-
Get a Label instance corresponding to the given label
id.Parameters:
Name Type Description idThe label id
Returns:
- Type
- Label