export type GetApiV1TasksTaskIdAutomationsAutomationIdGoogleSheetsSpreadsheetIdArgs = {taskId: string, spreadsheetId: string, range: string, automationId: unknown}; export type GetApiV1TasksTaskIdAutomationsAutomationIdGoogleSheetsSpreadsheetIdOptions = {baseUrl?: string | undefined, apikey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Read values from a Google Spreadsheet * * GET /v1/tasks/{taskId}/automations/{automationId}/google-sheets/{spreadsheetId} */ export const getApiV1TasksTaskIdAutomationsAutomationIdGoogleSheetsSpreadsheetId = async (args: GetApiV1TasksTaskIdAutomationsAutomationIdGoogleSheetsSpreadsheetIdArgs, options?: GetApiV1TasksTaskIdAutomationsAutomationIdGoogleSheetsSpreadsheetIdOptions) => { const {baseUrl = "https://api.betayum.com", fetch: fetchFn = fetch, apikey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.range != null) query.append("range", String(args.range)) if (apikey !== undefined) headers.set("X-API-Key", apikey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/tasks/${encodeURIComponent(String(args.taskId))}/automations/${encodeURIComponent(String(args.automationId))}/google-sheets/${encodeURIComponent(String(args.spreadsheetId))}${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 };