export type DeleteApiV2SendersPhoneNumbersPhoneNumberArgs = {phone_number: string, child_account_id?: string | undefined}; export type DeleteApiV2SendersPhoneNumbersPhoneNumberOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a sender by phone number * * DELETE /v2/senders/phone-numbers/{phone_number} */ export const deleteApiV2SendersPhoneNumbersPhoneNumber = async (args: DeleteApiV2SendersPhoneNumbersPhoneNumberArgs, options?: DeleteApiV2SendersPhoneNumbersPhoneNumberOptions) => { const {baseUrl = "https://api.transmitmessage.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.child_account_id != null) query.append("child_account_id", String(args.child_account_id)) if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v2/senders/phone-numbers/${encodeURIComponent(String(args.phone_number))}${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 };