Socket
Socket
Sign inDemoInstall

@maxim_mazurok/gapi.client.slides-v1

Package Overview
Dependencies
3
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @maxim_mazurok/gapi.client.slides-v1

TypeScript typings for Google Slides API v1


Version published
Weekly downloads
1.5K
decreased by-8.8%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

TypeScript typings for Google Slides API v1

Reads and writes Google Slides presentations. For detailed description please check documentation.

Installing

Install typings for Google Slides API:

npm install @types/gapi.client.slides-v1 --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});

Then load api client wrapper:

gapi.client.load(
  'https://slides.googleapis.com/$discovery/rest?version=v1',
  () => {
    // now we can use:
    // gapi.client.slides
  }
);
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
gapi.client.load('slides', 'v1', () => {
  // now we can use:
  // gapi.client.slides
});

Don't forget to authenticate your client before sending any request to resources:

// declare client_id registered in Google Developers Console
var client_id = '',
  scope = [
    // See, edit, create, and delete all of your Google Drive files
    'https://www.googleapis.com/auth/drive',

    // See, edit, create, and delete only the specific Google Drive files you use with this app
    'https://www.googleapis.com/auth/drive.file',

    // See and download all your Google Drive files
    'https://www.googleapis.com/auth/drive.readonly',

    // See, edit, create, and delete all your Google Slides presentations
    'https://www.googleapis.com/auth/presentations',

    // See all your Google Slides presentations
    'https://www.googleapis.com/auth/presentations.readonly',

    // See, edit, create, and delete all your Google Sheets spreadsheets
    'https://www.googleapis.com/auth/spreadsheets',

    // See all your Google Sheets spreadsheets
    'https://www.googleapis.com/auth/spreadsheets.readonly',
  ],
  immediate = true;
// ...

gapi.auth.authorize(
  {client_id: client_id, scope: scope, immediate: immediate},
  authResult => {
    if (authResult && !authResult.error) {
      /* handle successful authorization */
    } else {
      /* handle authorization error */
    }
  }
);

After that you can use Google Slides API resources:

/*
Applies one or more updates to the presentation. Each request is validated before being applied. If any request is not valid, then the entire request will fail and nothing will be applied. Some requests have replies to give you some information about how they are applied. Other requests do not need to return information; these each return an empty reply. The order of replies matches that of the requests. For example, suppose you call batchUpdate with four updates, and only the third one returns information. The response would have two empty replies: the reply to the third request, and another empty reply, in that order. Because other users may be editing the presentation, the presentation might not exactly reflect your changes: your changes may be altered with respect to collaborator changes. If there are no collaborators, the presentation should reflect your changes. In any case, the updates in your request are guaranteed to be applied together atomically.
*/
await gapi.client.slides.presentations.batchUpdate({
  presentationId: 'presentationId',
});

/*
Creates a blank presentation using the title given in the request. If a `presentationId` is provided, it is used as the ID of the new presentation. Otherwise, a new ID is generated. Other fields in the request, including any provided content, are ignored. Returns the created presentation.
*/
await gapi.client.slides.presentations.create({});

/*
Gets the latest version of the specified presentation.
*/
await gapi.client.slides.presentations.get({presentationId: 'presentationId'});

FAQs

Last updated on 06 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc