export type GetApiApiV1KeyValidateArgs = {apiKeyId?: string | undefined}; export type GetApiApiV1KeyValidateOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/v1/key/validate */ export const getApiApiV1KeyValidate = async (args: GetApiApiV1KeyValidateArgs, options?: GetApiApiV1KeyValidateOptions) => { const {baseUrl = "https://api.taostats.io", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.apiKeyId != null) query.append("apiKeyId", String(args.apiKeyId)) if (sec0 !== undefined) headers.set("Authorization", sec0) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/key/validate${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 };