0.0.20240508 • Published 12 days ago

@maxim_mazurok/gapi.client.drivelabels-v2beta v0.0.20240508

Weekly downloads
-
License
MIT
Repository
github
Last release
12 days ago

TypeScript typings for Drive Labels API v2beta

An API for managing Drive Labels For detailed description please check documentation.

Installing

Install typings for Drive Labels API:

npm install @types/gapi.client.drivelabels-v2beta --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://drivelabels.googleapis.com/$discovery/rest?version=v2beta',
  () => {
    // now we can use:
    // gapi.client.drivelabels
  }
);
// 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('drivelabels', 'v2beta', () => {
  // now we can use:
  // gapi.client.drivelabels
});

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 Google Drive labels in your organization, and see your organization's label-related admin policies
    'https://www.googleapis.com/auth/drive.admin.labels',

    // See all Google Drive labels and label-related admin policies in your organization
    'https://www.googleapis.com/auth/drive.admin.labels.readonly',

    // See, edit, create, and delete your Google Drive labels
    'https://www.googleapis.com/auth/drive.labels',

    // See your Google Drive labels
    'https://www.googleapis.com/auth/drive.labels.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 Drive Labels API resources:

/*
Creates a new Label.
*/
await gapi.client.drivelabels.labels.create({});

/*
Permanently deletes a Label and related metadata on Drive Items. Once deleted, the Label and related Drive item metadata will be deleted. Only draft Labels, and disabled Labels may be deleted.
*/
await gapi.client.drivelabels.labels.delete({name: 'name'});

/*
Updates a single Label by applying a set of update requests resulting in a new draft revision. The batch update is all-or-nothing: If any of the update requests are invalid, no changes are applied. The resulting draft revision must be published before the changes may be used with Drive Items.
*/
await gapi.client.drivelabels.labels.delta({name: 'name'});

/*
Disable a published Label. Disabling a Label will result in a new disabled published revision based on the current published revision. If there is a draft revision, a new disabled draft revision will be created based on the latest draft revision. Older draft revisions will be deleted. Once disabled, a label may be deleted with `DeleteLabel`.
*/
await gapi.client.drivelabels.labels.disable({name: 'name'});

/*
Enable a disabled Label and restore it to its published state. This will result in a new published revision based on the current disabled published revision. If there is an existing disabled draft revision, a new revision will be created based on that draft and will be enabled.
*/
await gapi.client.drivelabels.labels.enable({name: 'name'});

/*
Get a label by its resource name. Resource name may be any of: * `labels/{id}` - See `labels/{id}@latest` * `labels/{id}@latest` - Gets the latest revision of the label. * `labels/{id}@published` - Gets the current published revision of the label. * `labels/{id}@{revision_id}` - Gets the label at the specified revision ID.
*/
await gapi.client.drivelabels.labels.get({name: 'name'});

/*
List labels.
*/
await gapi.client.drivelabels.labels.list({});

/*
Publish all draft changes to the Label. Once published, the Label may not return to its draft state. See `google.apps.drive.labels.v2.Lifecycle` for more information. Publishing a Label will result in a new published revision. All previous draft revisions will be deleted. Previous published revisions will be kept but are subject to automated deletion as needed. Once published, some changes are no longer permitted. Generally, any change that would invalidate or cause new restrictions on existing metadata related to the Label will be rejected. For example, the following changes to a Label will be rejected after the Label is published: * The label cannot be directly deleted. It must be disabled first, then deleted. * Field.FieldType cannot be changed. * Changes to Field validation options cannot reject something that was previously accepted. * Reducing the max entries.
*/
await gapi.client.drivelabels.labels.publish({name: 'name'});

/*
Updates a Label's `CopyMode`. Changes to this policy are not revisioned, do not require publishing, and take effect immediately.
*/
await gapi.client.drivelabels.labels.updateLabelCopyMode({name: 'name'});

/*
Updates a Label's permissions. If a permission for the indicated principal doesn't exist, a new Label Permission is created, otherwise the existing permission is updated. Permissions affect the Label resource as a whole, are not revisioned, and do not require publishing.
*/
await gapi.client.drivelabels.labels.updatePermissions({parent: 'parent'});

/*
Get the constraints on the structure of a Label; such as, the maximum number of Fields allowed and maximum length of the label title.
*/
await gapi.client.drivelabels.limits.getLabel({});

/*
Gets the user capabilities.
*/
await gapi.client.drivelabels.users.getCapabilities({name: 'name'});
0.0.20240508

12 days ago

0.0.20240501

18 days ago

0.0.20240429

20 days ago

0.0.20240424

25 days ago

0.0.20240422

27 days ago

0.0.20240415

1 month ago

0.0.20240403

2 months ago

0.0.20240401

2 months ago

0.0.20240327

2 months ago

0.0.20240325

2 months ago

0.0.20240319

2 months ago

0.0.20240318

2 months ago

0.0.20240313

2 months ago

0.0.20240307

2 months ago

0.0.20240306

2 months ago

0.0.20240304

3 months ago

0.0.20240228

3 months ago

0.0.20240226

3 months ago

0.0.20240220

3 months ago

0.0.20240214

3 months ago

0.0.20240202

3 months ago

0.0.20240117

4 months ago

0.0.20231218

5 months ago

0.0.20231213

5 months ago

0.0.20231204

6 months ago

0.0.20231106

7 months ago

0.0.20231108

6 months ago

0.0.20230731

10 months ago

0.0.20231113

6 months ago

0.0.20231030

7 months ago

0.0.20230807

10 months ago

0.0.20230927

8 months ago

0.0.20230809

10 months ago

0.0.20231018

7 months ago

0.0.20230920

8 months ago

0.0.20230726

10 months ago

0.0.20230724

10 months ago

0.0.20231023

7 months ago

0.0.20231025

7 months ago

0.0.20231101

7 months ago

0.0.20230918

8 months ago

0.0.20230717

10 months ago

0.0.20231127

6 months ago

0.0.20230712

10 months ago

0.0.20231009

7 months ago

0.0.20230710

11 months ago

0.0.20230911

8 months ago

0.0.20231011

7 months ago

0.0.20230904

9 months ago

0.0.20230905

9 months ago

0.0.20230705

11 months ago

0.0.20230823

9 months ago

0.0.20231120

6 months ago

0.0.20231004

8 months ago

0.0.20230619

11 months ago

0.0.20230612

11 months ago

0.0.20230614

11 months ago

0.0.20230607

12 months ago

0.0.20230524

12 months ago

0.0.20230522

12 months ago

0.0.20230605

12 months ago

0.0.20230529

12 months ago

0.0.20230531

12 months ago

0.0.20230517

1 year ago

0.0.20230515

1 year ago

0.0.20230621

11 months ago

0.0.20230428

1 year ago

0.0.20230315

1 year ago

0.0.20230412

1 year ago

0.0.20230419

1 year ago

0.0.20230320

1 year ago

0.0.20230403

1 year ago

0.0.20230426

1 year ago

0.0.20230327

1 year ago

0.0.20230228

1 year ago

0.0.20230424

1 year ago

0.0.20230308

1 year ago

0.0.20230405

1 year ago

0.0.20230306

1 year ago

0.0.20230329

1 year ago

0.0.20230410

1 year ago

0.0.20230215

1 year ago

0.0.20230220

1 year ago

0.0.20230201

1 year ago

0.0.20230222

1 year ago

0.0.20230129

1 year ago

0.0.20230213

1 year ago

0.0.20221130

1 year ago

0.0.20230118

1 year ago

0.0.20221214

1 year ago

0.0.20230104

1 year ago

0.0.20221221

1 year ago

0.0.20221121

1 year ago

0.0.20221109

2 years ago

0.0.20230125

1 year ago

0.0.20221207

1 year ago

0.0.20230111

1 year ago

0.0.20221107

2 years ago

0.0.20230123

1 year ago

0.0.20221128

1 year ago

0.0.20221102

2 years ago

0.0.20221031

2 years ago

0.0.20221026

2 years ago

0.0.20221024

2 years ago

0.0.20221010

2 years ago

0.0.20221003

2 years ago

0.0.20220928

2 years ago

0.0.20220920

2 years ago