export type GetApiV2DistributorsAccountsArgs = {pageSize?: number | undefined, page?: number | undefined}; export type GetApiV2DistributorsAccountsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * getUsersByDistributors * * GET /v2/distributors/accounts */ export const getApiV2DistributorsAccounts = async (args: GetApiV2DistributorsAccountsArgs, options?: GetApiV2DistributorsAccountsOptions) => { const {baseUrl = "https://api.cloudally.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.pageSize != null) query.append("pageSize", String(args.pageSize)) if (args.page != null) query.append("page", String(args.page)) const url = `${baseUrl.replace(/\/+$/, '')}/v2/distributors/accounts${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.blob() };