export type GetApiV2PartitionPartitionIdReportAccounthistoryEnduserchangesArgs = {endDate: string, partitionId: string, startDate: string}; export type GetApiV2PartitionPartitionIdReportAccounthistoryEnduserchangesOptions = {baseUrl?: string | undefined, XAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get end user account history * * GET /v2/partition/{partitionId}/report/accounthistory/enduserchanges */ export const getApiV2PartitionPartitionIdReportAccounthistoryEnduserchanges = async (args: GetApiV2PartitionPartitionIdReportAccounthistoryEnduserchangesArgs, options?: GetApiV2PartitionPartitionIdReportAccounthistoryEnduserchangesOptions) => { 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.endDate != null) query.append("endDate", String(args.endDate)) if (args.startDate != null) query.append("startDate", String(args.startDate)) if (XAuthToken !== undefined) headers.set("X-AUTH-TOKEN", XAuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/v2/partition/${encodeURIComponent(String(args.partitionId))}/report/accounthistory/enduserchanges${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() };