# @maxim_mazurok/gapi.client.licensing

> TypeScript typings for Enterprise License Manager API v1

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

## Install

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

## 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-10 |
| First published | 2020-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 32.4 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.licensing
- 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.licensing

## Dependencies (1)

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

## Recent versions

- 1.0.20220808 (latest) — 2022-08-10
- 1.0.20220806 — 2022-08-08
- 1.0.20220729 — 2022-07-31
- 1.0.20220722 — 2022-07-24
- 1.0.20220718 — 2022-07-20
- 1.0.20220716 — 2022-07-17
- 1.0.20220711 — 2022-07-13
- 1.0.20220709 — 2022-07-11
- 1.0.20220704 — 2022-07-06
- 1.0.20220702 — 2022-07-04
- 1.0.20220627 — 2022-06-29
- 1.0.20220624 — 2022-06-26
- 1.0.20220620 — 2022-06-22
- 1.0.20220618 — 2022-06-20
- 1.0.20220613 — 2022-06-15
- … 134 more at https://npm.io/package/@maxim_mazurok/gapi.client.licensing/versions

## README

# TypeScript typings for Enterprise License Manager API v1

The Google Enterprise License Manager API lets you manage Google Workspace and related licenses for all users of a customer that you manage.
For detailed description please check [documentation](https://developers.google.com/admin-sdk/licensing/).

## Installing

Install typings for Enterprise License Manager API:

```
npm install @types/gapi.client.licensing@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('licensing', 'v1', () => {
  // now we can use gapi.client.licensing
  // ...
});
```

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 = [ 
      // View and manage G Suite licenses for your domain
      'https://www.googleapis.com/auth/apps.licensing',
    ],
    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 Enterprise License Manager API resources:

```typescript

/*
Revoke a license.
*/
await gapi.client.licensing.licenseAssignments.delete({ productId: "productId", skuId: "skuId", userId: "userId",  });

/*
Get a specific user's license by product SKU.
*/
await gapi.client.licensing.licenseAssignments.get({ productId: "productId", skuId: "skuId", userId: "userId",  });

/*
Assign a license.
*/
await gapi.client.licensing.licenseAssignments.insert({ productId: "productId", skuId: "skuId",  });

/*
List all users assigned licenses for a specific product SKU.
*/
await gapi.client.licensing.licenseAssignments.listForProduct({ customerId: "customerId", productId: "productId",  });

/*
List all users assigned licenses for a specific product SKU.
*/
await gapi.client.licensing.licenseAssignments.listForProductAndSku({ customerId: "customerId", productId: "productId", skuId: "skuId",  });

/*
Reassign a user's product SKU with a different SKU in the same product. This method supports patch semantics.
*/
await gapi.client.licensing.licenseAssignments.patch({ productId: "productId", skuId: "skuId", userId: "userId",  });

/*
Reassign a user's product SKU with a different SKU in the same product.
*/
await gapi.client.licensing.licenseAssignments.update({ productId: "productId", skuId: "skuId", userId: "userId",  });
```

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