export type GetApiV3ClientBookClientMatchArgs = {email?: string | undefined, phone?: string | undefined, except?: number | undefined}; export type GetApiV3ClientBookClientMatchOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Find possible duplicates * * GET /v3/client-book/client/match */ export const getApiV3ClientBookClientMatch = async (args: GetApiV3ClientBookClientMatchArgs, options?: GetApiV3ClientBookClientMatchOptions) => { const {baseUrl = "https://api.rhinoartisan.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.email != null) query.append("email", String(args.email)) if (args.phone != null) query.append("phone", String(args.phone)) if (args.except != null) query.append("except", String(args.except)) if (ApiKeyAuth !== undefined) headers.set("apikey", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v3/client-book/client/match${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 undefined };