nylas
Version:
A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.
85 lines (84 loc) • 2.86 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Folders = void 0;
const resource_js_1 = require("./resource.js");
const utils_js_1 = require("../utils.js");
/**
* Nylas Folder API
*
* Email providers use folders to store and organize email messages. Examples of common system folders include Inbox, Sent, Drafts, etc.
*
* If your team is migrating from Nylas APIv2, there were previously two separate endpoints for interacting with Folders (Microsoft) and Labels (Google).
* In Nylas API v3, these endpoints are consolidated under Folders.
*
* To simplify the developer experience, Nylas uses the same folders commands to manage both folders and labels, using the folder_id key to refer to the folder's ID on the provider.
* The API also exposes provider-specific fields such as background_color (Google only).
*
* Depending on the provider (Google, some IMAP providers, etc.), a message can be contained in more than one folder.
*/
class Folders extends resource_js_1.Resource {
/**
* Return all Folders
* @return A list of folders
*/
list({ identifier, queryParams, overrides, }) {
return super._list({
overrides,
queryParams,
path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/folders', { identifier }),
});
}
/**
* Return a Folder
* @return The folder
*/
find({ identifier, folderId, queryParams, overrides, }) {
return super._find({
path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/folders/{folderId}', {
identifier,
folderId,
}),
queryParams,
overrides,
});
}
/**
* Create a Folder
* @return The created folder
*/
create({ identifier, requestBody, overrides, }) {
return super._create({
path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/folders', { identifier }),
requestBody,
overrides,
});
}
/**
* Update a Folder
* @return The updated Folder
*/
update({ identifier, folderId, requestBody, overrides, }) {
return super._update({
path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/folders/{folderId}', {
identifier,
folderId,
}),
requestBody,
overrides,
});
}
/**
* Delete a Folder
* @return The deleted Folder
*/
destroy({ identifier, folderId, overrides, }) {
return super._destroy({
path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/folders/{folderId}', {
identifier,
folderId,
}),
overrides,
});
}
}
exports.Folders = Folders;