new Contacts(agent, characterId, token)
Create a new Contacts function using the given agent
, for the
character described by characterId
with SSO access from token
.
Parameters:
Name | Type | Description |
---|---|---|
agent |
ESIAgent | The ESI agent |
characterId |
Number | The character id whose contacts are accessed |
token |
String | The SSO access token for the character |
Methods
-
add(ids, standing, label)
-
Bulk add contacts with same settings.
This makes an HTTP POST request to
/characters/{character_id}/contacts/
. The route version isv1
.This function invokes the route with
watched
set tofalse
. The array length ofids
must be between1
and100
.standing
must be between-10
and10
.On success, this resolves to the array of ids of the created entity.
This function must be used with an SSO token that has the following scopes:
esi-characters.write_contacts.v1
Parameters:
Name Type Description ids
Array.<Number> A list of contacts to add.
standing
Number Standing for the new contact.
label
Number Add a custom label to the new contact.
Returns:
A Promise that resolves to an array of ids.
- Type
- Promise.<Array.<Number>>
-
addWatched(ids, standing, label)
-
Bulk add contacts with same settings.
This makes an HTTP POST request to
/characters/{character_id}/contacts/
. The route version isv1
.This function invokes the route with
watched
set totrue
. The array length ofids
must be between1
and100
.standing
must be between-10
and10
.On success, this resolves to the array of ids of the created entity.
This function must be used with an SSO token that has the following scopes:
esi-characters.write_contacts.v1
Parameters:
Name Type Description ids
Array.<Number> A list of contacts to add.
standing
Number Standing for the new contact.
label
Number Add a custom label to the new contact.
Returns:
A Promise that resolves to an array of ids.
- Type
- Promise.<Array.<Number>>
-
all(page)
-
Return contacts of a character. This route is cached for up to 300 seconds.
This makes an HTTP GET request to
/characters/{character_id}/contacts/
. The route version isv1
.page
must be at least1
.On success, this resolves to a list of contacts. An example result is:
[ { "contact_id": 123, "contact_type": "character", "is_blocked": false, "is_watched": true, "label_id": 0, "standing": 10 } ]
This function must be used with an SSO token that has the following scopes:
esi-characters.read_contacts.v1
Parameters:
Name Type Default Description page
Number 0 Optional; page integer. If
0
, all pages are returned, concatenated into a single array.Returns:
A Promise that resolves to the parsed JSON of the response.
- Type
- Promise.<Array.<Object>>
-
get(id)
-
Create a new Contact end point targeting the particular contact by
id
.Parameters:
Name Type Description id
Number The contact id
Returns:
- Type
- Contact
-
labels()
-
Return custom labels for contacts the character defined. This route is cached for up to 300 seconds.
This makes an HTTP GET request to
/characters/{character_id}/contacts/labels/
. The route version isv1
.On success, this resolves to a list of contact labels. An example result is:
[ { "label_id": 123, "label_name": "Friends" } ]
This function must be used with an SSO token that has the following scopes:
esi-characters.read_contacts.v1
Returns:
A Promise that resolves to the parsed JSON of the response.
- Type
- Promise.<Array.<Object>>