export type TelephoneNumberSearchEventType = Array<'ACTIVATION' | 'BYOTN_REQUEST' | 'CSR_CHANGE_REQUEST' | 'DISCONNECT' | 'DYNAMIC_RESERVATION' | 'NINE_ONE_ONE_ADDRESS' | 'PORT_REQUEST' | 'SERVICE_PROVIDER_TN'>; export type TelephoneNumberSearchStatusType = Array<'PENDING' | 'IN_PROGRESS' | 'REJECTED' | 'FOC_RECEIVED' | 'FOC_REMOVED' | 'CANCELLED' | 'CANCEL_PENDING' | 'CARRIER_CANCELLED' | 'DELETE_PENDING' | 'DELETE_SCHEDULED' | 'COMPLETED' | 'CORRECTED_COMPLETED' | 'COOLDOWN' | 'HOT_CUT_PORT' | 'ON_HOLD' | 'RESELLER_PENDING'>; export type GetApiV2PartitionPartitionIdTelephonenumberExportstatussearchArgs = {accountId?: string | undefined, dateType?: ('FOCDate' | 'UpdatedDate' | 'CreatedDate') | undefined, endDate?: string | undefined, eventType?: TelephoneNumberSearchEventType | undefined, includeSubTns?: boolean | undefined, partitionId: string, startDate?: string | undefined, statusType?: TelephoneNumberSearchStatusType | undefined, telephoneNumber?: string | undefined}; export type GetApiV2PartitionPartitionIdTelephonenumberExportstatussearchOptions = {baseUrl?: string | undefined, XAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export as CSV telephone number status search * * GET /v2/partition/{partitionId}/telephonenumber/exportstatussearch */ export const getApiV2PartitionPartitionIdTelephonenumberExportstatussearch = async (args: GetApiV2PartitionPartitionIdTelephonenumberExportstatussearchArgs, options?: GetApiV2PartitionPartitionIdTelephonenumberExportstatussearchOptions) => { 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 (args.accountId != null) query.append("accountId", String(args.accountId)) if (args.dateType != null) query.append("dateType", String(args.dateType)) if (args.endDate != null) query.append("endDate", String(args.endDate)) for (const item of args.eventType ?? []) query.append("eventType", String(item)) if (args.includeSubTns != null) query.append("includeSubTns", String(args.includeSubTns)) if (args.startDate != null) query.append("startDate", String(args.startDate)) for (const item of args.statusType ?? []) query.append("statusType", String(item)) if (args.telephoneNumber != null) query.append("telephoneNumber", String(args.telephoneNumber)) if (XAuthToken !== undefined) headers.set("X-AUTH-TOKEN", XAuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/v2/partition/${encodeURIComponent(String(args.partitionId))}/telephonenumber/exportstatussearch${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() };