import { WorkspaceScopedResource, extractData } from './base.js';
export class WebhookDestinationsResource extends WorkspaceScopedResource {
    async list(params) {
        return extractData(await this.client.GET('/v1/{workspace_id}/webhook-destinations', {
            params: { path: { workspace_id: this.workspaceId }, query: params },
        }));
    }
    listAutoPaging(params) {
        return this.iteratePaginatedList((pageParams) => this.list(pageParams), params);
    }
    async create(body) {
        return extractData(await this.client.POST('/v1/{workspace_id}/webhook-destinations', {
            params: { path: { workspace_id: this.workspaceId } },
            body,
        }));
    }
    async get(destinationId) {
        return extractData(await this.client.GET('/v1/{workspace_id}/webhook-destinations/{destination_id}', {
            params: { path: { workspace_id: this.workspaceId, destination_id: destinationId } },
        }));
    }
    async update(destinationId, body) {
        return extractData(await this.client.PUT('/v1/{workspace_id}/webhook-destinations/{destination_id}', {
            params: { path: { workspace_id: this.workspaceId, destination_id: destinationId } },
            body,
        }));
    }
    async delete(destinationId) {
        await this.client.DELETE('/v1/{workspace_id}/webhook-destinations/{destination_id}', {
            params: { path: { workspace_id: this.workspaceId, destination_id: destinationId } },
        });
    }
    async listDeliveries(destinationId, params) {
        return extractData(await this.client.GET('/v1/{workspace_id}/webhook-destinations/{destination_id}/deliveries', {
            params: {
                path: { workspace_id: this.workspaceId, destination_id: destinationId },
                query: params,
            },
        }));
    }
    listDeliveriesAutoPaging(destinationId, params) {
        return this.iteratePaginatedList((pageParams) => this.listDeliveries(destinationId, pageParams), params);
    }
    async rotateSecret(destinationId) {
        return extractData(await this.client.POST('/v1/{workspace_id}/webhook-destinations/{destination_id}/rotate-secret', {
            params: { path: { workspace_id: this.workspaceId, destination_id: destinationId } },
        }));
    }
}
//# sourceMappingURL=webhook-destinations.js.map