@openworkspace/slides
v0.1.1
Published
Google Slides API client for presentations
Downloads
185
Maintainers
Readme
@openworkspace/slides
Google Slides API client for OpenWorkspace -- presentations, slides, speaker notes, export.
Part of the OpenWorkspace monorepo.
Install
npm install @openworkspace/slides @openworkspace/coreUsage
import { createHttpClient } from '@openworkspace/core';
import { getPresentation, createPresentation, addSlide, replaceAllText, exportPresentation } from '@openworkspace/slides';
const http = createHttpClient({ auth: { accessToken: 'token' } });
// Get a presentation
const result = await getPresentation(http, 'presentationId');
if (result.ok) {
console.log(result.value.title, `(${result.value.slides?.length} slides)`);
}
// Create a presentation
const pres = await createPresentation(http, 'Q1 Review');
// Add a slide
await addSlide(http, 'presentationId');
// Find and replace text across all slides
await replaceAllText(http, 'presentationId', { find: '{{date}}', replaceWith: '2025-01-15' });
// Export as PDF
const pdf = await exportPresentation(http, 'presentationId', 'application/pdf');API
All functions take an HttpClient as the first parameter and return Result<T, E>.
getPresentation(http, id)-- Get presentation metadata and slidescreatePresentation(http, title)-- Create a new presentationgetSlide(http, presentationId, slideId)-- Get a single slidebatchUpdate(http, id, requests)-- Send batch update requestsaddSlide(http, id)-- Add a new slidedeleteSlide(http, id, slideId)-- Delete a slidereplaceAllText(http, id, params)-- Find and replace textupdateSpeakerNotes(http, id, slideId, notes)-- Update speaker notesexportPresentation(http, id, format)-- Export as PDF, PPTX, etc.
