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 argumentname
maps to thename
property of thelabel
route parameter. The string length ofname
must be between1
and40
. The function argumentcolor
maps to thecolor
property of thelabel
route parameter.color
must 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 name
String Name string.
color
String 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
labels
property.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 id
The label id
Returns:
- Type
- Label