akua-sdk
Version:
TypeScript SDK for Akua Acquiring Processor
47 lines (46 loc) • 2.04 kB
TypeScript
import { HttpClient } from '../http/client';
import { WebhookSecretDTO } from '../types/dtos';
import { AkuaTypes } from '../';
/**
* Service responsible for managing webhook configurations in the Akua API.
* @class WebhookService
*/
export declare class WebhookService {
private readonly httpClient;
/**
* Creates an instance of WebhookService.
* @param {HttpClient} httpClient - The HTTP client instance used for making API requests.
*/
constructor(httpClient: HttpClient);
/**
* Creates a new webhook configuration.
* @param createWebhookRequest - The request object containing the webhook configuration details.
* @returns {Promise<ApiResponse<WebhookDTO>>} A promise that resolves to the created webhook configuration.
* @example
* // Create a new webhook configuration
* await webhookService.create({
* url: 'https://example.com/webhook',
* events: [AkuaTypes.Enums.EventType.PAYMENT_AUTHORIZATION_PROCESSED],
* description: 'Webhook for payment events',
* rate_limit: 1,
* });
*/
create(createWebhookRequest: AkuaTypes.RequestTypes.CreateWebhookRequest): Promise<AkuaTypes.ApiResponse<AkuaTypes.ResponseTypes.WebhookDTO>>;
/**
* Retrieves all webhook configurations.
* @returns {Promise<ApiResponse<WebhookDTO[]>>} A promise that resolves to an array of webhook configurations.
* @example
* // Get all webhook configurations
* await webhookService.get();
*/
get(): Promise<AkuaTypes.ApiResponse<AkuaTypes.ResponseTypes.WebhookDTO[]>>;
/**
* Retrieves a webhook configuration by its ID.
* @param webhookId - The ID of the webhook configuration to retrieve.
* @returns {Promise<ApiResponse<WebhookSecretDTO>>} A promise that resolves to the webhook configuration.
* @example
* // Get a webhook configuration by ID
* await webhookService.getSecret('webhook_123');
*/
getSecret(webhookId: string): Promise<AkuaTypes.ApiResponse<WebhookSecretDTO>>;
}