UNPKG

@jokoor/sdk

Version:
121 lines 3.6 kB
/** * Webhooks resource - User-friendly wrapper for webhooks API */ import { BaseResource } from './base'; import type { WebhookCreateEndpointParams, WebhookUpdateEndpointParams, WebhookWebhookEndpoint, WebhookEvent } from '../generated/api'; export declare class Webhooks extends BaseResource { private api; constructor(configuration: any); /** * Create a new webhook endpoint * @param params Webhook creation parameters * @returns Created webhook endpoint */ create(params: WebhookCreateEndpointParams): Promise<WebhookWebhookEndpoint>; /** * Get a webhook endpoint by ID * @param id Webhook endpoint ID * @returns Webhook endpoint details */ get(id: string): Promise<WebhookWebhookEndpoint>; /** * Update a webhook endpoint * @param id Webhook endpoint ID * @param params Update parameters * @returns Updated webhook endpoint */ update(id: string, params: WebhookUpdateEndpointParams): Promise<WebhookWebhookEndpoint>; /** * Delete a webhook endpoint * @param id Webhook endpoint ID * @returns Deletion confirmation */ delete(id: string): Promise<{ message: string; }>; /** * List webhook endpoints * @param options List options * @returns List of webhook endpoints with cursor pagination */ list(options?: { limit?: number; startingAfter?: string; endingBefore?: string; }): Promise<{ data: WebhookWebhookEndpoint[]; has_more: boolean; }>; /** * Test a webhook endpoint * @param id Webhook endpoint ID * @returns Test result */ test(id: string): Promise<{ success: boolean; message: string; }>; /** * Get webhook endpoint metrics * @param id Webhook endpoint ID * @returns Webhook metrics */ getMetrics(id: string): Promise<any>; /** * List webhook events * @param options List options * @returns List of webhook events */ listEvents(options?: { type?: string; limit?: number; startingAfter?: string; endingBefore?: string; }): Promise<{ data: WebhookEvent[]; has_more: boolean; }>; /** * Get a webhook event by ID * @param id Event ID * @returns Event details */ getEvent(id: string): Promise<WebhookEvent>; /** * Retry a webhook event * @param id Event ID * @returns Retry result */ retryEvent(id: string): Promise<{ success: boolean; }>; /** * Get webhook system health * @returns Health status */ getHealth(): Promise<any>; /** * Get webhook system metrics * @param since Start date for metrics * @returns System metrics */ getSystemMetrics(since?: string): Promise<any>; /** * Verify webhook signature * @param payload Webhook payload * @param signature Webhook signature from headers * @param secret Webhook secret * @returns Whether signature is valid */ verifySignature(payload: string, signature: string, secret: string): boolean; /** * Parse and verify webhook event * @param payload Webhook payload * @param signature Webhook signature from headers * @param secret Webhook secret * @returns Parsed webhook event * @throws Error if signature is invalid or payload cannot be parsed */ parseWebhookEvent<T = any>(payload: string, signature: string, secret: string): T; } //# sourceMappingURL=webhooks.d.ts.map