TypeScript typings for Google Vault API v1
Retention and eDiscovery for Google Workspace. To work with Vault resources, the account must have the required Vault privileges and access to the matter. To access a matter, the account must have created the matter, have the matter shared with them, or have the View All Matters privilege. For example, to download an export, an account needs the Manage Exports privilege and the matter shared with them.
For detailed description please check documentation.
Installing
Install typings for Google Vault API:
npm install @types/gapi.client.vault-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://vault.googleapis.com/$discovery/rest?version=v1', () => {
});
gapi.client.load('vault', 'v1', () => {
});
Don't forget to authenticate your client before sending any request to resources:
var client_id = '',
scope = [
'https://www.googleapis.com/auth/ediscovery',
'https://www.googleapis.com/auth/ediscovery.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 Google Vault API resources:
await gapi.client.vault.matters.addPermissions({ matterId: "matterId", });
await gapi.client.vault.matters.close({ matterId: "matterId", });
await gapi.client.vault.matters.count({ matterId: "matterId", });
await gapi.client.vault.matters.create({ });
await gapi.client.vault.matters.delete({ matterId: "matterId", });
await gapi.client.vault.matters.get({ matterId: "matterId", });
await gapi.client.vault.matters.list({ });
await gapi.client.vault.matters.removePermissions({ matterId: "matterId", });
await gapi.client.vault.matters.reopen({ matterId: "matterId", });
await gapi.client.vault.matters.undelete({ matterId: "matterId", });
await gapi.client.vault.matters.update({ matterId: "matterId", });
await gapi.client.vault.operations.cancel({ name: "name", });
await gapi.client.vault.operations.delete({ name: "name", });
await gapi.client.vault.operations.get({ name: "name", });
operations`. To override the binding, API services can add a binding such as `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
*/
await gapi.client.vault.operations.list({ name: "name", });