nylas
Version:
A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.
89 lines (88 loc) • 3.07 kB
TypeScript
import { Overrides } from '../config.js';
import { AsyncListResponse, Resource } from './resource.js';
import { CreateDraftRequest, Draft, ListDraftsQueryParams, UpdateDraftRequest } from '../models/drafts.js';
import { Message } from '../models/messages.js';
import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
/**
* The parameters for the {@link Drafts.list} method
* @property identifier The identifier of the grant to act upon
* @property queryParams The query parameters to include in the request
*/
export interface ListDraftsParams {
identifier: string;
queryParams?: ListDraftsQueryParams;
}
/**
* The parameters for the {@link Drafts.find} method
* @property identifier The identifier of the grant to act upon
* @property draftId The id of the draft to retrieve.
*/
export interface FindDraftParams {
identifier: string;
draftId: string;
}
/**
* The parameters for the {@link Drafts.create} method
* @property identifier The identifier of the grant to act upon
* @property requestBody The values to create the message with
*/
export interface CreateDraftParams {
identifier: string;
requestBody: CreateDraftRequest;
}
/**
* The parameters for the {@link Drafts.update} method
* @property identifier The identifier of the grant to act upon
* @property draftId The id of the draft to update.
* @property requestBody The values to update the draft with
*/
export interface UpdateDraftParams {
identifier: string;
draftId: string;
requestBody: UpdateDraftRequest;
}
/**
* The parameters for the {@link Drafts.destroy} method
*/
export type DestroyDraftParams = FindDraftParams;
/**
* The parameters for the {@link Drafts.send} method
*/
export type SendDraftParams = FindDraftParams;
/**
* Nylas Drafts API
*
* The Nylas Drafts API allows you to list, find, update, delete, and send drafts on user accounts.
*/
export declare class Drafts extends Resource {
/**
* Return all Drafts
* @return A list of drafts
*/
list({ identifier, queryParams, overrides, }: ListDraftsParams & Overrides): AsyncListResponse<NylasListResponse<Draft>>;
/**
* Return a Draft
* @return The draft
*/
find({ identifier, draftId, overrides, }: FindDraftParams & Overrides): Promise<NylasResponse<Draft>>;
/**
* Return a Draft
* @return The draft
*/
create({ identifier, requestBody, overrides, }: CreateDraftParams & Overrides): Promise<NylasResponse<Draft>>;
/**
* Update a Draft
* @return The updated draft
*/
update({ identifier, draftId, requestBody, overrides, }: UpdateDraftParams & Overrides): Promise<NylasResponse<Draft>>;
/**
* Delete a Draft
* @return The deleted draft
*/
destroy({ identifier, draftId, overrides, }: DestroyDraftParams & Overrides): Promise<NylasBaseResponse>;
/**
* Send a Draft
* @return The sent message
*/
send({ identifier, draftId, overrides, }: SendDraftParams & Overrides): Promise<NylasResponse<Message>>;
}