export type LodgifyApiWebhooksModelsV1UnsubscribeBindingModel = {id?: (string | null) | undefined}; export type DeleteApiWebhooksV1UnsubscribeArgs = {body: LodgifyApiWebhooksModelsV1UnsubscribeBindingModel}; export type DeleteApiWebhooksV1UnsubscribeOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Unsubscribes from a webhook * * DELETE /webhooks/v1/unsubscribe */ export const deleteApiWebhooksV1Unsubscribe = async (args: DeleteApiWebhooksV1UnsubscribeArgs, options?: DeleteApiWebhooksV1UnsubscribeOptions) => { const {baseUrl = "https://api.lodgify.com", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKey !== undefined) headers.set("X-ApiKey", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/webhooks/v1/unsubscribe${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };