export type DeleteApiV1ServicesChatServiceSidConversationsConversationSidWebhooksSidArgs = {ChatServiceSid: string, ConversationSid: string, Sid: string}; export type DeleteApiV1ServicesChatServiceSidConversationsConversationSidWebhooksSidOptions = {baseUrl?: string | undefined, accountSidAuthToken?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Remove an existing webhook scoped to the conversation * * DELETE /v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks/{Sid} */ export const deleteApiV1ServicesChatServiceSidConversationsConversationSidWebhooksSid = async (args: DeleteApiV1ServicesChatServiceSidConversationsConversationSidWebhooksSidArgs, options?: DeleteApiV1ServicesChatServiceSidConversationsConversationSidWebhooksSidOptions) => { const {baseUrl = "https://conversations.twilio.com", fetch: fetchFn = fetch, accountSidAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (accountSidAuthToken !== undefined) headers.set('authorization', `Basic ${btoa(`${accountSidAuthToken.username}:${accountSidAuthToken.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/Services/${encodeURIComponent(String(args.ChatServiceSid))}/Conversations/${encodeURIComponent(String(args.ConversationSid))}/Webhooks/${encodeURIComponent(String(args.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 };