export type GetApiV1MachinesIdExecInteractiveArgs = {id: string, cmd?: string | undefined, cols?: number | undefined, rows?: number | undefined, access_token?: string | undefined, smol_tenant?: string | undefined}; export type GetApiV1MachinesIdExecInteractiveOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Open an interactive terminal. * * GET /v1/machines/{id}/exec/interactive */ export const getApiV1MachinesIdExecInteractive = async (args: GetApiV1MachinesIdExecInteractiveArgs, options?: GetApiV1MachinesIdExecInteractiveOptions) => { const {baseUrl = "https://api.smolmachines.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.cmd != null) query.append("cmd", String(args.cmd)) if (args.cols != null) query.append("cols", String(args.cols)) if (args.rows != null) query.append("rows", String(args.rows)) if (args.access_token != null) query.append("access_token", String(args.access_token)) if (args.smol_tenant != null) query.append("smol_tenant", String(args.smol_tenant)) if (ApiKeyAuth !== undefined) headers.set('authorization', `Bearer ${ApiKeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/machines/${encodeURIComponent(String(args.id))}/exec/interactive${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 };