export type AppendGoogleSheetDto = {title?: string | undefined, rows: Array}; export type CreateApiV1TasksTaskIdAutomationsAutomationIdGoogleSheetsSpreadsheetIdAppendArgs = {taskId: string, automationId: string, spreadsheetId: string, body: AppendGoogleSheetDto}; export type CreateApiV1TasksTaskIdAutomationsAutomationIdGoogleSheetsSpreadsheetIdAppendOptions = {baseUrl?: string | undefined, apikey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Append evidence rows to an existing Google Spreadsheet * * POST /v1/tasks/{taskId}/automations/{automationId}/google-sheets/{spreadsheetId}/append */ export const createApiV1TasksTaskIdAutomationsAutomationIdGoogleSheetsSpreadsheetIdAppend = async (args: CreateApiV1TasksTaskIdAutomationsAutomationIdGoogleSheetsSpreadsheetIdAppendArgs, options?: CreateApiV1TasksTaskIdAutomationsAutomationIdGoogleSheetsSpreadsheetIdAppendOptions) => { const {baseUrl = "https://api.betayum.com", fetch: fetchFn = fetch, apikey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") 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))}/append${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };