UNPKG

pancake-client-sdk

Version:
86 lines (85 loc) 2.27 kB
import { Webhook, CreateWebhookRequest, UpdateWebhookRequest, WebhookDelivery, WebhookDeliveryListParams, RetryWebhookResult, WebhookStats } from '../types/webhook'; import { BaseResource } from './base'; export declare class WebhookResource extends BaseResource { /** * Get list of webhooks */ list(): Promise<{ data: Webhook[]; }>; /** * Get webhook by ID */ getById(webhookId: string): Promise<Webhook>; /** * Create new webhook */ create(data: CreateWebhookRequest): Promise<Webhook>; /** * Update webhook */ update(webhookId: string, data: UpdateWebhookRequest): Promise<Webhook>; /** * Delete webhook */ delete(webhookId: string): Promise<void>; /** * Get webhook deliveries */ listDeliveries(params?: WebhookDeliveryListParams): Promise<{ data: WebhookDelivery[]; }>; /** * Get webhook delivery by ID */ getDeliveryById(deliveryId: string): Promise<WebhookDelivery>; /** * Retry webhook delivery */ retryDelivery(deliveryId: string): Promise<RetryWebhookResult>; /** * Get webhook statistics */ getStats(webhookId: string, params: { from_date: string; to_date: string; }): Promise<WebhookStats>; /** * Test webhook */ test(webhookId: string, event: string, payload?: Record<string, any>): Promise<{ delivery_id: string; status: 'success' | 'failed'; response?: { status_code: number; body?: string; }; failure_reason?: string; }>; /** * Rotate webhook secret */ rotateSecret(webhookId: string): Promise<{ secret_key: string; }>; /** * Enable/disable webhook */ setActive(webhookId: string, isActive: boolean): Promise<Webhook>; /** * Get pending deliveries */ getPendingDeliveries(): Promise<{ total_count: number; deliveries: WebhookDelivery[]; }>; /** * Clear webhook delivery history */ clearDeliveryHistory(webhookId: string, params?: { before_date?: string; status?: 'success' | 'failed'; }): Promise<{ deleted_count: number; }>; }