@openworkspace/appscript
v0.1.1
Published
Google Apps Script API client for project management and execution
Downloads
179
Maintainers
Readme
@openworkspace/appscript
Google Apps Script API client for OpenWorkspace -- run scripts, manage projects.
Part of the OpenWorkspace monorepo.
Install
npm install @openworkspace/appscript @openworkspace/coreUsage
import { createHttpClient } from '@openworkspace/core';
import { getProject, runFunction, listProcesses } from '@openworkspace/appscript';
const http = createHttpClient({ auth: { accessToken: 'token' } });
// Get a project
const result = await getProject(http, 'scriptId');
if (result.ok) {
console.log(result.value.title);
}
// Run a function
const output = await runFunction(http, 'scriptId', {
function: 'myFunction',
parameters: ['arg1', 42],
});
if (output.ok) {
console.log('Result:', output.value.response?.result);
}
// List recent executions
const procs = await listProcesses(http, { scriptId: 'scriptId' });API
All functions take an HttpClient as the first parameter and return Result<T, E>.
Projects
getProject(http, scriptId)-- Get project metadatacreateProject(http, options)-- Create a new projectgetContent(http, scriptId)-- Get project source filesupdateContent(http, scriptId, content)-- Update project source
Execution
runFunction(http, scriptId, request)-- Run a script functionlistProcesses(http, options)-- List execution processes
