/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { webhooksCreate } from "../funcs/webhooks-create.js"; import { webhooksDelete } from "../funcs/webhooks-delete.js"; import { webhooksList } from "../funcs/webhooks-list.js"; import { webhooksRetrieve } from "../funcs/webhooks-retrieve.js"; import { webhooksUpdate } from "../funcs/webhooks-update.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { PageIterator, unwrapResultIterator } from "../types/operations.js"; export class Webhooks extends ClientSDK { /** * List webhooks * * @remarks * List the webhooks of the project. The list is paginated. */ async list( page?: number | undefined, pageSize?: number | undefined, projectId?: string | undefined, options?: RequestOptions, ): Promise> { return unwrapResultIterator(webhooksList( this, page, pageSize, projectId, options, )); } /** * Create a webhook * * @remarks * Create a webhook subscribed to one or more event types. Deliveries use the v2 envelope and are signed with the project signing secret (see the signing secret endpoint). */ async create( body: operations.CreateWebhookRequestBody, projectId?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksCreate( this, body, projectId, options, )); } /** * Get a webhook * * @remarks * Get a webhook by ID. */ async retrieve( id: string, projectId?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksRetrieve( this, id, projectId, options, )); } /** * Update a webhook * * @remarks * Update a webhook. Legacy v1 webhooks are read-only: delete them and create a new webhook instead. */ async update( id: string, body: operations.UpdateWebhookRequestBody, projectId?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksUpdate( this, id, body, projectId, options, )); } /** * Delete a webhook * * @remarks * Delete a webhook. */ async delete( id: string, projectId?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksDelete( this, id, projectId, options, )); } }