export type GetApiMeSshArgs = {script_type?: ('sh' | 'bat') | undefined}; export type GetApiMeSshOptions = {baseUrl: string, backendAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get the ssh config * * GET /me/ssh */ export const getApiMeSsh = async (args: GetApiMeSshArgs, options: GetApiMeSshOptions) => { const {baseUrl, fetch: fetchFn = fetch, backendAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.script_type != null) query.append("script_type", String(args.script_type)) if (backendAuth !== undefined) cookies.push("mtls-prd=" + encodeURIComponent(backendAuth)) const url = `${baseUrl.replace(/\/+$/, '')}/me/ssh${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 };