export type GetApiRepAuthServiceV10RequestArgs = {'Client-Key': string}; export type GetApiRepAuthServiceV10RequestOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Request a session token * * GET /rep-auth/service/v1.0/request */ export const getApiRepAuthServiceV10Request = async (args: GetApiRepAuthServiceV10RequestArgs, options?: GetApiRepAuthServiceV10RequestOptions) => { const {baseUrl = "https://rep.checkpoint.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Client-Key'] != null) headers.set("Client-Key", String(args['Client-Key'])) const url = `${baseUrl.replace(/\/+$/, '')}/rep-auth/service/v1.0/request${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 };