nylas
Version:
A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.
73 lines (72 loc) • 1.89 kB
JavaScript
import { Resource } from './resource.js';
/**
* Nylas Contacts API
*
* The Nylas Contacts API allows you to create, update, and delete contacts.
*/
export class Contacts extends Resource {
/**
* Return all Contacts
* @return The list of Contacts
*/
list({ identifier, queryParams, overrides, }) {
return super._list({
queryParams,
path: `/v3/grants/${identifier}/contacts`,
overrides,
});
}
/**
* Return a Contact
* @return The Contact
*/
find({ identifier, contactId, queryParams, overrides, }) {
return super._find({
path: `/v3/grants/${identifier}/contacts/${contactId}`,
queryParams,
overrides,
});
}
/**
* Create a Contact
* @return The created Contact
*/
create({ identifier, requestBody, overrides, }) {
return super._create({
path: `/v3/grants/${identifier}/contacts`,
requestBody,
overrides,
});
}
/**
* Update a Contact
* @return The updated Contact
*/
update({ identifier, contactId, requestBody, overrides, }) {
return super._update({
path: `/v3/grants/${identifier}/contacts/${contactId}`,
requestBody,
overrides,
});
}
/**
* Delete a Contact
* @return The deletion response
*/
destroy({ identifier, contactId, overrides, }) {
return super._destroy({
path: `/v3/grants/${identifier}/contacts/${contactId}`,
overrides,
});
}
/**
* Return a Contact Group
* @return The list of Contact Groups
*/
groups({ identifier, overrides, }) {
return super._list({
path: `/v3/grants/${identifier}/contacts/groups`,
overrides,
});
}
}