export type CreateApiV1ClientUserSignUpArgs = {'api-key': string, 'auth-key': string, body: {name?: string | undefined, email: string, password: string, phone?: string | undefined, country?: string | undefined}}; export type CreateApiV1ClientUserSignUpOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Account (Sign-up) * * POST /v1/client/user/sign-up */ export const createApiV1ClientUserSignUp = async (args: CreateApiV1ClientUserSignUpArgs, options?: CreateApiV1ClientUserSignUpOptions) => { const {baseUrl = "https://uatclientapi-v2.stockal.com/client/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['api-key'] != null) headers.set("api-key", String(args['api-key'])) if (args['auth-key'] != null) headers.set("auth-key", String(args['auth-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/client/user/sign-up${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) 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 };