UNPKG

nylas

Version:

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

79 lines (78 loc) 2.99 kB
import { AsyncListResponse, Resource } from './resource.js'; import { Overrides } from '../config.js'; import { NylasResponse, NylasListResponse } from '../models/response.js'; import { CreateWebhookRequest, UpdateWebhookRequest, Webhook, WebhookDeleteResponse, WebhookIpAddressesResponse, WebhookWithSecret } from '../models/webhooks.js'; /** * @property webhookId The ID of the webhook destination to update */ export interface FindWebhookParams { webhookId: string; } /** * @property requestBody The webhook destination details */ export interface CreateWebhookParams { requestBody: CreateWebhookRequest; } /** * @property webhookId The ID of the webhook destination to update * @property requestBody The updated webview destination details */ export interface UpdateWebhookParams { webhookId: string; requestBody: UpdateWebhookRequest; } /** * @property webhookId The ID of the webhook destination to delete */ export interface DestroyWebhookParams { webhookId: string; } /** * Nylas Webhooks API * * The Nylas Webhooks API allows your application to receive notifications in real-time when certain events occur. */ export declare class Webhooks extends Resource { /** * List all webhook destinations for the application * @returns The list of webhook destinations */ list({ overrides }?: Overrides): AsyncListResponse<NylasListResponse<Webhook>>; /** * Return a webhook destination * @return The webhook destination */ find({ webhookId, overrides, }: FindWebhookParams & Overrides): Promise<NylasResponse<Webhook>>; /** * Create a webhook destination * @returns The created webhook destination */ create({ requestBody, overrides, }: CreateWebhookParams & Overrides): Promise<NylasResponse<WebhookWithSecret>>; /** * Update a webhook destination * @returns The updated webhook destination */ update({ webhookId, requestBody, overrides, }: UpdateWebhookParams & Overrides): Promise<NylasResponse<Webhook>>; /** * Delete a webhook destination * @returns The deletion response */ destroy({ webhookId, overrides, }: DestroyWebhookParams & Overrides): Promise<WebhookDeleteResponse>; /** * Update the webhook secret value for a destination * @returns The updated webhook destination with the webhook secret */ rotateSecret({ webhookId, overrides, }: DestroyWebhookParams & Overrides): Promise<NylasResponse<WebhookWithSecret>>; /** * Get the current list of IP addresses that Nylas sends webhooks from * @returns The list of IP addresses that Nylas sends webhooks from */ ipAddresses({ overrides }?: Overrides): Promise<NylasResponse<WebhookIpAddressesResponse>>; /** * Extract the challenge parameter from a URL * @param url The URL sent by Nylas containing the challenge parameter * @returns The challenge parameter */ extractChallengeParameter(url: string): string; }