export type GetApiV2PartitionPartitionIdTelephonenumberExportArgs = {partitionId: string}; export type GetApiV2PartitionPartitionIdTelephonenumberExportOptions = {baseUrl?: string | undefined, XAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export the partition's telephone number inventory as csv, synchronously * * GET /v2/partition/{partitionId}/telephonenumber/export */ export const getApiV2PartitionPartitionIdTelephonenumberExport = async (args: GetApiV2PartitionPartitionIdTelephonenumberExportArgs, options?: GetApiV2PartitionPartitionIdTelephonenumberExportOptions) => { const {baseUrl = "https://api.alianza.com", fetch: fetchFn = fetch, XAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/csv") if (XAuthToken !== undefined) headers.set("X-AUTH-TOKEN", XAuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/v2/partition/${encodeURIComponent(String(args.partitionId))}/telephonenumber/export${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.text() };