UNPKG

@idfy/sdk

Version:
77 lines (76 loc) 2.74 kB
import IdfyBaseService from '../IdfyBaseService'; import { Event, EventTypeInfo, MockEventRequest, Webhook, WebhookDelivery, WebhookUpdateOptions, WebhookCreateOptions } from './'; export declare class NotificationService extends IdfyBaseService { /** * Retrieves up to 100 unhandled events for your account. After you retrieve this list the events will be "locked" for 10 minutes * to give you time to handle them. * Please handle the events using one of the endpoints in this API to avoid retrieving the same events multiple times. * @param eventType * @param tags */ listUnhandledEvents(eventType?: string, tags?: string): Promise<Event[]>; /** * Marks the status of an event as handled. * @param eventId */ handleEvent(eventId: string): Promise<void>; /** * Marks the status of a batch of events as handled. * @param eventIds */ handleMultipleEvents(eventIds: string[]): Promise<void>; /** * Peeks the top 100 unhandled events regardless if they are locked or not. Don't use this endpoint to handle events. * @param eventType * @param tags */ peekEvents(eventType?: string, tags?: string): Promise<Event[]>; /** * Clears all events for your account. */ clearEvents(): Promise<void>; /** * Returns a list of all available event types. */ listEventTypes(): Promise<EventTypeInfo[]>; /** * Creates a mock event with a sample payload. Can be used to test your event handling code. * @param mockEventRequest */ mockEvent(mockEventRequest: MockEventRequest): Promise<Event>; /** * Retrieves the details of a single webhook. * @param id */ getWebhook(id: number): Promise<Webhook>; /** * Deletes the specified webhook. * @param id */ deleteWebhook(id: number): Promise<void>; /** * Updates the specified webhook with the parameters passed. Any parameters not provided will be left unchanged. * @param id * @param webhookUpdateOptions */ updateWebhook(id: number, webhookUpdateOptions: WebhookUpdateOptions): Promise<Webhook>; /** * Returns a list of all your webhooks. */ listWebhooks(): Promise<Webhook[]>; /** * Creates a new webhook. * @param webhookCreateOptions */ createWebhook(webhookCreateOptions: WebhookCreateOptions): Promise<Webhook>; /** * Triggers a ping event to be sent to the webhook. * @param id */ pingWebhook(id: number): Promise<void>; /** * Returns the 10 most recent delivery attempts for a single webhook. * @param id */ listWebhookDeliveries(id: number): Promise<WebhookDelivery[]>; }