TypeScript typings for Service Usage API v1
Enables services that service consumers want to use on Google Cloud Platform, lists the available or enabled services, or disables services that service consumers no longer use.
For detailed description please check documentation.
Installing
Install typings for Service Usage API:
npm install @types/gapi.client.serviceusage-v1 --save-dev
Usage
You need to initialize Google API client in your code:
gapi.load('client', () => {
});
Then load api client wrapper:
gapi.client.load(
'https://serviceusage.googleapis.com/$discovery/rest?version=v1',
() => {
},
);
gapi.client.load('serviceusage', 'v1', () => {
});
Don't forget to authenticate your client before sending any request to resources:
var client_id = '',
scope = [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/service.management',
],
immediate = true;
gapi.auth.authorize(
{client_id: client_id, scope: scope, immediate: immediate},
authResult => {
if (authResult && !authResult.error) {
} else {
}
},
);
After that you can use Service Usage API resources:
await gapi.client.serviceusage.operations.cancel({name: 'name'});
await gapi.client.serviceusage.operations.delete({name: 'name'});
await gapi.client.serviceusage.operations.get({name: 'name'});
await gapi.client.serviceusage.operations.list({});
await gapi.client.serviceusage.services.batchEnable({parent: 'parent'});
await gapi.client.serviceusage.services.batchGet({parent: 'parent'});
await gapi.client.serviceusage.services.disable({name: 'name'});
await gapi.client.serviceusage.services.enable({name: 'name'});
await gapi.client.serviceusage.services.get({name: 'name'});
await gapi.client.serviceusage.services.list({parent: 'parent'});
For provenance information see Provenance section on NPM