export type DeleteApiV1WebhooksWebhookSidArgs = {webhook_sid: string}; export type DeleteApiV1WebhooksWebhookSidOptions = {baseUrl?: string | undefined, apiKey?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete Webhook * * DELETE /v1/webhooks/{webhook_sid} * * Also accepts auth: bearer-auth */ export const deleteApiV1WebhooksWebhookSid = async (args: DeleteApiV1WebhooksWebhookSidArgs, options?: DeleteApiV1WebhooksWebhookSidOptions) => { const {baseUrl = "https://api.prod-us.streem.cloud", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set('authorization', `Basic ${btoa(`${apiKey.username}:${apiKey.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/webhooks/${encodeURIComponent(String(args.webhook_sid))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };