nylas
Version:
A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.
85 lines (84 loc) • 2.31 kB
JavaScript
import { Resource } from './resource.js';
import { makePathParams } from '../utils.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: makePathParams('/v3/grants/{identifier}/contacts', { identifier }),
overrides,
});
}
/**
* Return a Contact
* @return The Contact
*/
find({ identifier, contactId, queryParams, overrides, }) {
return super._find({
path: makePathParams('/v3/grants/{identifier}/contacts/{contactId}', {
identifier,
contactId,
}),
queryParams,
overrides,
});
}
/**
* Create a Contact
* @return The created Contact
*/
create({ identifier, requestBody, overrides, }) {
return super._create({
path: makePathParams('/v3/grants/{identifier}/contacts', { identifier }),
requestBody,
overrides,
});
}
/**
* Update a Contact
* @return The updated Contact
*/
update({ identifier, contactId, requestBody, overrides, }) {
return super._update({
path: makePathParams('/v3/grants/{identifier}/contacts/{contactId}', {
identifier,
contactId,
}),
requestBody,
overrides,
});
}
/**
* Delete a Contact
* @return The deletion response
*/
destroy({ identifier, contactId, overrides, }) {
return super._destroy({
path: makePathParams('/v3/grants/{identifier}/contacts/{contactId}', {
identifier,
contactId,
}),
overrides,
});
}
/**
* Return a Contact Group
* @return The list of Contact Groups
*/
groups({ identifier, overrides, }) {
return super._list({
path: makePathParams('/v3/grants/{identifier}/contacts/groups', {
identifier,
}),
overrides,
});
}
}