export type ApiJson = {[key: string]: unknown}; export type CreateApiV1ProfileAddressSettingsArgs = {address: string, 'x-verify': string, body: ApiJson}; export type CreateApiV1ProfileAddressSettingsOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update account settings * * POST /v1/profile/{address}/settings */ export const createApiV1ProfileAddressSettings = async (args: CreateApiV1ProfileAddressSettingsArgs, options?: CreateApiV1ProfileAddressSettingsOptions) => { const {baseUrl = "https://backend.swap.coffee", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-verify'] != null) headers.set("x-verify", String(args['x-verify'])) if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/profile/${encodeURIComponent(String(args.address))}/settings${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 undefined };