export type CreateApiAdminTokensLoginAsArgs = {userId: string}; export type CreateApiAdminTokensLoginAsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /admin/tokens/login-as */ export const createApiAdminTokensLoginAs = async (args: CreateApiAdminTokensLoginAsArgs, options?: CreateApiAdminTokensLoginAsOptions) => { const {baseUrl = "https://api.octoperf.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.userId != null) query.append("userId", String(args.userId)) const url = `${baseUrl.replace(/\/+$/, '')}/admin/tokens/login-as${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 res.blob() };