TypeScript typings for Admin SDK API reports_v1
Admin SDK lets administrators of enterprise domains to view and manage resources like user, groups etc. It also provides audit and usage reports of domain.
For detailed description please check documentation.
Installing
Install typings for Admin SDK API:
npm install @types/gapi.client.admin-reports_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://admin.googleapis.com/$discovery/rest?version=reports_v1',
() => {
},
);
gapi.client.load('admin', 'reports_v1', () => {
});
Don't forget to authenticate your client before sending any request to resources:
var client_id = '',
scope = [
'https://www.googleapis.com/auth/admin.reports.audit.readonly',
'https://www.googleapis.com/auth/admin.reports.usage.readonly',
],
immediate = true;
gapi.auth.authorize(
{client_id: client_id, scope: scope, immediate: immediate},
authResult => {
if (authResult && !authResult.error) {
} else {
}
},
);
After that you can use Admin SDK API resources:
await gapi.client.reports.activities.list({
applicationName: 'applicationName',
userKey: 'userKey',
});
await gapi.client.reports.activities.watch({
applicationName: 'applicationName',
userKey: 'userKey',
});
await gapi.client.admin.channels.stop({});
await gapi.client.reports.customerUsageReports.get({date: 'date'});
await gapi.client.reports.entityUsageReports.get({
date: 'date',
entityKey: 'entityKey',
entityType: 'entityType',
});
await gapi.client.reports.userUsageReport.get({
date: 'date',
userKey: 'userKey',
});
For provenance information see Provenance section on NPM