export type ChannelEnumWebhookEnabledType = 'true' | 'false'; export type DeleteApiV2ServicesServiceSidChannelsSidArgs = {ServiceSid: string, Sid: string, 'X-Twilio-Webhook-Enabled'?: ChannelEnumWebhookEnabledType | undefined}; export type DeleteApiV2ServicesServiceSidChannelsSidOptions = {baseUrl?: string | undefined, accountSidAuthToken?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * DELETE /v2/Services/{ServiceSid}/Channels/{Sid} */ export const deleteApiV2ServicesServiceSidChannelsSid = async (args: DeleteApiV2ServicesServiceSidChannelsSidArgs, options?: DeleteApiV2ServicesServiceSidChannelsSidOptions) => { const {baseUrl = "https://ip-messaging.twilio.com", fetch: fetchFn = fetch, accountSidAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-Twilio-Webhook-Enabled'] != null) headers.set("X-Twilio-Webhook-Enabled", String(args['X-Twilio-Webhook-Enabled'])) if (accountSidAuthToken !== undefined) headers.set('authorization', `Basic ${btoa(`${accountSidAuthToken.username}:${accountSidAuthToken.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/Services/${encodeURIComponent(String(args.ServiceSid))}/Channels/${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 };