export type GetApiGetgenderArgs = {name: string}; export type GetApiGetgenderOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gender from a name: determines the likely gender for a first or full name, including international names. For marketing personalization, demographic analysis, and salutation selection. * * GET /getgender */ export const getApiGetgender = async (args: GetApiGetgenderArgs, options?: GetApiGetgenderOptions) => { const {baseUrl = "https://api.interzoid.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.name != null) query.append("name", String(args.name)) if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/getgender${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 (await res.json()) as unknown };