export type HeadApiAccountsAidCustomersUsersArgs = {aid: unknown, email?: string | undefined, phone_number?: string | undefined}; export type HeadApiAccountsAidCustomersUsersOptions = {baseUrl?: string | undefined, JWT?: string | undefined, fetch?: typeof fetch | undefined}; /** * aid_customers_head * * HEAD /accounts/{aid}/customers/users */ export const headApiAccountsAidCustomersUsers = async (args: HeadApiAccountsAidCustomersUsersArgs, options?: HeadApiAccountsAidCustomersUsersOptions) => { const {baseUrl = "https://api.dintero.com/v1", fetch: fetchFn = fetch, JWT} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.email != null) query.append("email", String(args.email)) if (args.phone_number != null) query.append("phone_number", String(args.phone_number)) if (JWT !== undefined) headers.set('authorization', `Bearer ${JWT}`) const url = `${baseUrl.replace(/\/+$/, '')}/accounts/${encodeURIComponent(String(args.aid))}/customers/users${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "HEAD", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };