UNPKG

nylas

Version:

A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.

95 lines (94 loc) 3.72 kB
import { Overrides } from '../config.js'; import { Folder, CreateFolderRequest, UpdateFolderRequest, ListFolderQueryParams, FindFolderQueryParams } from '../models/folders.js'; import { NylasBaseResponse, NylasResponse, NylasListResponse } from '../models/response.js'; import { Resource, AsyncListResponse } from './resource.js'; /** * The parameters for the {@link Folders.list} method * @property identifier The identifier of the grant to act upon * @property queryParams The query parameters to include in the request */ interface ListFoldersParams { identifier: string; queryParams?: ListFolderQueryParams; } /** * The parameters for the {@link Folders.find} method * @property identifier The identifier of the grant to act upon * @property folderId The id of the Folder to retrieve * @property queryParams The query parameters to include in the request */ interface FindFolderParams { identifier: string; folderId: string; queryParams?: FindFolderQueryParams; } /** * The parameters for the {@link Folders.create} method * @property identifier The identifier of the grant to act upon * @property requestBody The request body to create a folder */ interface CreateFolderParams { identifier: string; requestBody: CreateFolderRequest; } /** * The parameters for the {@link Folders.update} method * @property identifier The identifier of the grant to act upon * @property folderId The id of the Folder to update * @property requestBody The request body to update a folder */ interface UpdateFolderParams { identifier: string; folderId: string; requestBody: UpdateFolderRequest; } /** * The parameters for the {@link Folders.destroy} method * @property identifier The identifier of the grant to act upon * @property folderId The id of the Folder to delete */ interface DestroyFolderParams { identifier: string; folderId: string; } /** * 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. */ export declare class Folders extends Resource { /** * Return all Folders * @return A list of folders */ list({ identifier, queryParams, overrides, }: ListFoldersParams & Overrides): AsyncListResponse<NylasListResponse<Folder>>; /** * Return a Folder * @return The folder */ find({ identifier, folderId, queryParams, overrides, }: FindFolderParams & Overrides): Promise<NylasResponse<Folder>>; /** * Create a Folder * @return The created folder */ create({ identifier, requestBody, overrides, }: CreateFolderParams & Overrides): Promise<NylasResponse<Folder>>; /** * Update a Folder * @return The updated Folder */ update({ identifier, folderId, requestBody, overrides, }: UpdateFolderParams & Overrides): Promise<NylasResponse<Folder>>; /** * Delete a Folder * @return The deleted Folder */ destroy({ identifier, folderId, overrides, }: DestroyFolderParams & Overrides): Promise<NylasBaseResponse>; } export {};