export type GetApiAppArgs = {status_code?: number | undefined}; export type GetApiAppOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get app * * GET /app */ export const getApiApp = async (args: GetApiAppArgs, options?: GetApiAppOptions) => { const {baseUrl = "https://api.lolz.team", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.status_code != null) query.append("status_code", String(args.status_code)) const url = `${baseUrl.replace(/\/+$/, '')}/app${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 };