UNPKG

@basetime/a2w-api-ts

Version:

Client library that communicates with the addtowallet API.

46 lines (45 loc) 1.41 kB
import { Webhook, WebhookInput } from '../../types/Webhook'; import { WebhookLog } from '../../types/WebhookLog'; import Endpoint from '../Endpoint'; /** * Communicate with the `/organization/webhooks*` sub-endpoints. * * Accessed via `client.organizations.webhooks`. Provides CRUD over an organization's * webhooks and access to the per-organization delivery log. */ export default class OrganizationWebhooksEndpoint extends Endpoint { /** * Constructor. * * @param parent The parent `OrganizationsEndpoint` whose `req`, `do`, and `qb` are * reused. */ constructor(parent: Endpoint); /** * Returns all webhooks for the authenticated organization. */ getAll: () => Promise<Webhook[]>; /** * Creates a new webhook. * * @param body The webhook to create. */ create: (body: WebhookInput) => Promise<Webhook>; /** * Updates an existing webhook. * * @param id The ID of the webhook to update. * @param body The new webhook values. */ update: (id: string, body: WebhookInput) => Promise<Webhook>; /** * Deletes a webhook. * * @param id The ID of the webhook to delete. */ delete: (id: string) => Promise<string>; /** * Returns the delivery logs for all webhooks owned by the authenticated organization. */ getLogs: () => Promise<WebhookLog[]>; }