export type CreateApiV2CymbusAccountGroupPrevalidateArgs = {groupName?: string | undefined}; export type CreateApiV2CymbusAccountGroupPrevalidateOptions = {baseUrl?: string | undefined, XAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Prevalidate Cymbus account name * * POST /v2/cymbus/account-group/prevalidate */ export const createApiV2CymbusAccountGroupPrevalidate = async (args: CreateApiV2CymbusAccountGroupPrevalidateArgs, options?: CreateApiV2CymbusAccountGroupPrevalidateOptions) => { const {baseUrl = "https://api.alianza.com", fetch: fetchFn = fetch, XAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.groupName != null) query.append("groupName", String(args.groupName)) if (XAuthToken !== undefined) headers.set("X-AUTH-TOKEN", XAuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/v2/cymbus/account-group/prevalidate${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };