import Base, { MaybeRaw } from "../../../../Base"; import { PaginatedResponse, SearchParams } from "../../../../interfaces/global"; import { KeyValuePair, Webhook, WebhookCreate, WebhookUpdate } from "../../../../interfaces/high5/space/webhook"; import { High5WebhookLog } from "./log"; export declare class High5Webhook extends Base { get log(): High5WebhookLog; private _log?; /** * Retrieves all Webhooks of the specified space that match the provided search filter(s). Will return all Webhooks if no search filter is provided. * @param orgName Name of the organization * @param spaceName Name of the space * @param filters (optional) Array of search filters * @param sorting (optional) Sorting object * @param limit (optional) Max number of results (1-100; defaults to 25) * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0) * @returns Object containing an array of Webhooks and the total number of results found in the database (independent of limit and page) */ searchWebhooks({ orgName, spaceName, filters, sorting, limit, page }: SearchParams & { orgName: string; spaceName: string; }, raw?: { raw: R; }): Promise>>; /** * Requests a Webhhok by its ID. * @param orgName Name of the Organization * @param spaceName Name of the Space * @param webhookId ID of the Webhook * @returns The requested Webhook */ getWebhook(orgName: string, spaceName: string, webhookId: string, raw?: { raw: R; }): Promise>; /** * Generates a new URL for the specified Webhook. This is suggested if a leak of the current URL is likely. * @param orgName Name of the Organization * @param spaceName Name of the Space * @param webhookId ID of the Webhook * @returns The updated Webhook */ regenerateWebhookUrl(orgName: string, spaceName: string, webhookId: string, raw?: { raw: R; }): Promise>; /** * Creates a new Webhook in the specified High5 space. * @param orgName Name of the Organization * @param spaceName Name of the Space * @param WebhookCreate Object/JSON containing the name, token, eventId, spaceId, target and (optionally) security headers for the new webhook * @returns The created Webhook */ createWebhook(orgName: string, spaceName: string, WebhookCreate: WebhookCreate, raw?: { raw: R; }): Promise>; /** * Updates an existing Webhook. * @param orgName Name of the Organization * @param spaceName Name of the Space * @param webhookId ID of the Webhook to be updated * @param WebhookCreate Object/JSON containing the name, token, eventId, spaceId, target and (optionally) security headers for the updated webhook * @returns the updated Webhook */ updateWebhook(orgName: string, spaceName: string, webhookId: string, webhookUpdate: WebhookUpdate, raw?: { raw: R; }): Promise>; /** * Deletes a Webhook by its ID. * @param orgName Name of the Organization * @param spaceName Name of the Space * @param webhookId ID of the webhook to be deleted */ deleteWebhook(orgName: string, spaceName: string, webhookId: string, raw?: { raw: R; }): Promise>; /** * Executes all Events and Streams connected to the specified Webhook. * @param webhookUrl URL of the webhook to be triggered / executed */ triggerWebhook(webhookUrl: string, raw?: { raw: R; }): Promise>; /** * Executes a webhook by its URL. * @param webhookUrl Webhook URL to be triggered / executed (your hcloud domain + webhook.relativeUrl) * @param payload Payload to be used in the event execution that will be triggered by the webhook, as JSON. * @param headers (optional) Security headers. */ executeWebhookByUrl(webhookUrl: string, payload: unknown, headers?: KeyValuePair, raw?: { raw: R; }): Promise>; /** * Respond to a webhook via callback. * @param callbackURL Full or partial URL callback URL. This URL is unique per webhook execution * @param status HTTP status code to send in the response * @param headers (optional) HTTP headers to send in the response * @param body (optional) Body to send in the HTTP response */ respondToWebhook(callbackURL: string, status: number, headers?: Record, body?: string, raw?: { raw: R; }): Promise>; /** * Validates the provided webhook URL by sending a challenge query parameter. * @param url Webhook URL to be validated (your hcloud domain + webhook.relativeUrl) * @param challenge String to be returned * @returns The provided challenge string as plaint text */ validateWebhookUrl(webhookUrl: string, challenge: string, raw?: { raw: R; }): Promise>; protected getEndpoint(endpoint: string): string; }