export type GetApiAccountsCustomersArgs = {customerIds?: string | undefined, externalCustomerId?: string | undefined, email?: string | undefined, phone?: string | undefined, status?: ('ACTIVE' | 'INACTIVE') | undefined, type?: ('INDIVIDUAL' | 'BUSINESS') | undefined, before?: string | undefined, after?: string | undefined, limit?: string | undefined}; export type GetApiAccountsCustomersOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search customers * * GET /accounts/customers */ export const getApiAccountsCustomers = async (args: GetApiAccountsCustomersArgs, options?: GetApiAccountsCustomersOptions) => { const {baseUrl = "https://api-sb.meld.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.customerIds != null) query.append("customerIds", String(args.customerIds)) if (args.externalCustomerId != null) query.append("externalCustomerId", String(args.externalCustomerId)) if (args.email != null) query.append("email", String(args.email)) if (args.phone != null) query.append("phone", String(args.phone)) if (args.status != null) query.append("status", String(args.status)) if (args.type != null) query.append("type", String(args.type)) if (args.before != null) query.append("before", String(args.before)) if (args.after != null) query.append("after", String(args.after)) if (args.limit != null) query.append("limit", String(args.limit)) if (ApiKeyAuth !== undefined) headers.set("Authorization", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/accounts/customers${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() };