nylas
Version:
A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.
89 lines (88 loc) • 2.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Contacts = void 0;
const resource_js_1 = require("./resource.js");
const utils_js_1 = require("../utils.js");
/**
* Nylas Contacts API
*
* The Nylas Contacts API allows you to create, update, and delete contacts.
*/
class Contacts extends resource_js_1.Resource {
/**
* Return all Contacts
* @return The list of Contacts
*/
list({ identifier, queryParams, overrides, }) {
return super._list({
queryParams,
path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/contacts', { identifier }),
overrides,
});
}
/**
* Return a Contact
* @return The Contact
*/
find({ identifier, contactId, queryParams, overrides, }) {
return super._find({
path: (0, utils_js_1.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: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/contacts', { identifier }),
requestBody,
overrides,
});
}
/**
* Update a Contact
* @return The updated Contact
*/
update({ identifier, contactId, requestBody, overrides, }) {
return super._update({
path: (0, utils_js_1.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: (0, utils_js_1.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: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/contacts/groups', {
identifier,
}),
overrides,
});
}
}
exports.Contacts = Contacts;