# @maxim_mazurok/gapi.client.forms

> TypeScript typings for Google Forms API v1

Latest version **1.0.20220808** (published 2022-08-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @maxim_mazurok/gapi.client.forms
pnpm add @maxim_mazurok/gapi.client.forms
yarn add @maxim_mazurok/gapi.client.forms
bun add @maxim_mazurok/gapi.client.forms
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.20220808 |
| Published | 2022-08-11 |
| First published | 2022-05-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 110.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 59 |
| Author | Maxim Mazurok |
| Maintainers | maxim_mazurok |

## Links

- npm: https://www.npmjs.com/package/@maxim_mazurok/gapi.client.forms
- Repository: https://github.com/Maxim-Mazurok/google-api-typings-generator
- Homepage: https://github.com/Maxim-Mazurok/google-api-typings-generator#readme
- Issues: https://github.com/Maxim-Mazurok/google-api-typings-generator/issues
- npm.io page: https://npm.io/package/@maxim_mazurok/gapi.client.forms

## Dependencies (1)

- [@types/gapi.client](https://npm.io/package/@types/gapi.client.md) *

## Recent versions

- 1.0.20220808 (latest) — 2022-08-11
- 1.0.20220804 — 2022-08-08
- 1.0.20220802 — 2022-08-04
- 1.0.20220728 — 2022-08-01
- 1.0.20220726 — 2022-07-28
- 1.0.20220714 — 2022-07-18
- 1.0.20220712 — 2022-07-14
- 1.0.20220703 — 2022-07-07
- 1.0.20220623 — 2022-06-27
- 1.0.20220621 — 2022-06-23
- 1.0.20220613 — 2022-06-16
- 1.0.20220609 — 2022-06-13
- 1.0.20220607 — 2022-06-09
- 1.0.20220602 — 2022-06-06
- 1.0.20220531 — 2022-06-02
- … 2 more at https://npm.io/package/@maxim_mazurok/gapi.client.forms/versions

## README

# TypeScript typings for Google Forms API v1

Reads and writes Google Forms and responses.
For detailed description please check [documentation](https://developers.google.com/forms/api).

## Installing

Install typings for Google Forms API:

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

## Usage

You need to initialize Google API client in your code:

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

Then load api client wrapper:

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

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

```typescript
// 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 Forms forms
      'https://www.googleapis.com/auth/forms.body',

      // See all your Google Forms forms
      'https://www.googleapis.com/auth/forms.body.readonly',

      // See all responses to your Google Forms forms
      'https://www.googleapis.com/auth/forms.responses.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 Forms API resources:

```typescript

/*
Change the form with a batch of updates.
*/
await gapi.client.forms.forms.batchUpdate({ formId: "formId",  });

/*
Create a new form using the title given in the provided form message in the request. *Important:* Only the form.info.title and form.info.document_title fields are copied to the new form. All other fields including the form description, items and settings are disallowed. To create a new form and add items, you must first call forms.create to create an empty form with a title and (optional) document title, and then call forms.update to add the items.
*/
await gapi.client.forms.forms.create({  });

/*
Get a form.
*/
await gapi.client.forms.forms.get({ formId: "formId",  });
```

---
_Source: https://npm.io/package/@maxim_mazurok/gapi.client.forms · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
