import type { RawAxiosRequestHeaders } from 'axios'; import type { CollectionProp, GetSpaceParams, GetWebhookCallDetailsUrl, GetWebhookParams, QueryParams } from '../../common-types'; import type { CreateWebhooksProps, UpsertWebhookSigningSecretPayload, WebhookCallDetailsProps, WebhookCallOverviewProps, WebhookHealthProps, WebhookProps, WebhookRetryPolicyPayload, WebhookRetryPolicyProps, WebhookSigningSecretProps } from '../../entities/webhook'; import type { OptionalDefaults } from '../wrappers/wrap'; export type WebhookPlainClientAPI = { /** * Fetches the Webhook * @param params entity IDs to identify the Webhook * @returns the Webhook * @throws if the request fails, or the Webhook is not found * @example * ```javascript * const webhook = await client.webhook.get({ * spaceId: '', * webhookDefinitionId: '', * }); * ``` */ get(params: OptionalDefaults): Promise; /** * Fetches all Webhooks for the given Space * @param params entity IDs to identify the Space * @returns an object containing an array of Webhooks * @throws if the request fails, or the Space is not found * @example * ```javascript * const results = await client.webhook.getMany({ * spaceId: '', * }); * ``` */ getMany(params: OptionalDefaults): Promise>; /** * Creates a Webhook * @param params entity IDs to identify the Space to create the Webhook in * @param rawData the Webhook * @returns the created Webhook and its metadata * @throws if the request fails, the Space is not found, or the payload is malformed * @example * ```javascript * const webhook = await client.webhook.create( * { * spaceId: '', * }, * { * name: 'My webhook', * url: 'https://www.example.com/test', * topics: ['Entry.create', 'ContentType.create', '*.publish', 'Asset.*'], * } * ); * ``` */ create(params: OptionalDefaults, rawData: CreateWebhooksProps, headers?: RawAxiosRequestHeaders): Promise; /** * Creates the Webhook * @param params entity IDs to identify the Webhook to update * @param rawData the new Webhook configuration * @returns the updated Webhook and its metadata * @throws if the request fails, the Webhook is not found, or the payload is malformed * @example * ```javascript * const webhook = await client.webhook.update( * { * spaceId: '', * webhookDefinitionId: '', * }, * { * ...currentWebhook, * name: 'New webhook name', * } * ); * ``` */ update(params: OptionalDefaults, rawData: CreateWebhooksProps): Promise; /** * Deletes the Webhook * @param params entity IDs to identify the Webhook to delete * @throws if the request fails, or the Webhook is not found * @example * ```javascript * await client.webhook.delete({ * spaceId: '', * webhookDefinitionId: '', * }); * ``` */ delete(params: OptionalDefaults): Promise; /** * Fetches an overview of recently successful webhook calls * @param params entity IDs to identify the Webhook * @returns an object containing the Webhook and the health overview of recent calls * @throws if the request fails, or the Webhook is not found * @example * ```javascript * const webhookHealth = await client.webhook.getHealthStatus({ * spaceId: '', * webhookDefinitionId: '', * }); * ``` */ getHealthStatus(params: OptionalDefaults): Promise; /** * Fetches the details a specific Webhook call * @param params entity IDs to identify the Webhook call * @returns details about the outgoing Webhook request and response * @throws if the request fails, or the Webhook call is not found * @example * ```javascript * const webhookCall = await client.webhook.getCallDetails({ * spaceId: '', * webhookDefinitionId: '', * callId: '', * }); * ``` */ getCallDetails(params: OptionalDefaults): Promise; /** * Fetches the details the most recent calls for a given Webhook * @param params entity IDs to identify the Webhook * @returns a list of the most recent webhook calls made, their status, possible errors, and the target URL * @throws if the request fails, or the Webhook is not found * @example * ```javascript * const results = await client.webhook.getManyCallDetails({ * spaceId: '', * webhookDefinitionId: '', * }); * ``` */ getManyCallDetails(params: OptionalDefaults): Promise>; /** * @deprecated The EAP for this feature has ended. This method will be removed in the next major version. */ getRetryPolicy(params: OptionalDefaults): Promise; /** * @deprecated The EAP for this feature has ended. This method will be removed in the next major version. */ upsertRetryPolicy(params: OptionalDefaults, rawData: WebhookRetryPolicyPayload): Promise; /** * @deprecated The EAP for this feature has ended. This method will be removed in the next major version. */ deleteRetryPolicy(params: OptionalDefaults): Promise; /** * Fetch the redacted webhook signing secret for a given Space * @param params entity IDs to identify the Space which the signing secret belongs to * @returns the last 4 characters of the redacted signing secret * @throws if the request fails, the Space is not found, or the signing secret does not exist * @example * ```javascript * const signingSecret = await client.webhook.getSigningSecret({ * spaceId: '', * }); */ getSigningSecret(params: OptionalDefaults): Promise; /** * Creates or updates the webhook signing secret for a given Space * @param params entity IDs to identify the Space which the signing secret belongs to * @param rawData (optional) the updated 64 character signing secret value if the secret already exists * @returns the last 4 characters of the created or updated signing secret * @throws if the request fails, the Space is not found, or the payload is malformed * @example * ```javascript * const crypto = require('crypto') * * const signingSecret = await client.webhook.upsertSigningSecret({ * spaceId: '', * }, * { * value: crypto.randomBytes(32).toString("hex"), * }); * ``` */ upsertSigningSecret(params: OptionalDefaults, rawData: UpsertWebhookSigningSecretPayload): Promise; /** * Removes the webhook signing secret for a given Space * @param params entity IDs to identify the Space which the signing secret belongs to * @throws if the request fails, the Space is not found, or the signing secret does not exist * @example * ```javascript * await client.webhook.deleteSigningSecret({ * spaceId: '', * }); * ``` */ deleteSigningSecret(params: OptionalDefaults): Promise; };