TypeScript typings for Cloud Storage JSON API v1
Stores and retrieves potentially large, immutable data objects.
For detailed description please check documentation.
Installing
Install typings for Cloud Storage JSON API:
npm install @types/gapi.client.storage-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://storage.googleapis.com/$discovery/rest?version=v1', () => {
});
gapi.client.load('storage', '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/devstorage.full_control',
'https://www.googleapis.com/auth/devstorage.read_only',
'https://www.googleapis.com/auth/devstorage.read_write',
],
immediate = true;
gapi.auth.authorize(
{ client_id: client_id, scope: scope, immediate: immediate },
authResult => {
if (authResult && !authResult.error) {
} else {
}
});
After that you can use Cloud Storage JSON API resources:
await gapi.client.storage.bucketAccessControls.delete({ bucket: "bucket", entity: "entity", });
await gapi.client.storage.bucketAccessControls.get({ bucket: "bucket", entity: "entity", });
await gapi.client.storage.bucketAccessControls.insert({ bucket: "bucket", });
await gapi.client.storage.bucketAccessControls.list({ bucket: "bucket", });
await gapi.client.storage.bucketAccessControls.patch({ bucket: "bucket", entity: "entity", });
await gapi.client.storage.bucketAccessControls.update({ bucket: "bucket", entity: "entity", });
await gapi.client.storage.buckets.delete({ bucket: "bucket", });
await gapi.client.storage.buckets.get({ bucket: "bucket", });
await gapi.client.storage.buckets.getIamPolicy({ bucket: "bucket", });
await gapi.client.storage.buckets.insert({ project: "project", });
await gapi.client.storage.buckets.list({ project: "project", });
await gapi.client.storage.buckets.lockRetentionPolicy({ bucket: "bucket", ifMetagenerationMatch: "ifMetagenerationMatch", });
await gapi.client.storage.buckets.patch({ bucket: "bucket", });
await gapi.client.storage.buckets.setIamPolicy({ bucket: "bucket", });
await gapi.client.storage.buckets.testIamPermissions({ bucket: "bucket", permissions: "permissions", });
await gapi.client.storage.buckets.update({ bucket: "bucket", });
await gapi.client.storage.channels.stop({ });
await gapi.client.storage.defaultObjectAccessControls.delete({ bucket: "bucket", entity: "entity", });
await gapi.client.storage.defaultObjectAccessControls.get({ bucket: "bucket", entity: "entity", });
await gapi.client.storage.defaultObjectAccessControls.insert({ bucket: "bucket", });
await gapi.client.storage.defaultObjectAccessControls.list({ bucket: "bucket", });
await gapi.client.storage.defaultObjectAccessControls.patch({ bucket: "bucket", entity: "entity", });
await gapi.client.storage.defaultObjectAccessControls.update({ bucket: "bucket", entity: "entity", });
await gapi.client.storage.notifications.delete({ bucket: "bucket", notification: "notification", });
await gapi.client.storage.notifications.get({ bucket: "bucket", notification: "notification", });
await gapi.client.storage.notifications.insert({ bucket: "bucket", });
await gapi.client.storage.notifications.list({ bucket: "bucket", });
await gapi.client.storage.objectAccessControls.delete({ bucket: "bucket", entity: "entity", object: "object", });
await gapi.client.storage.objectAccessControls.get({ bucket: "bucket", entity: "entity", object: "object", });
await gapi.client.storage.objectAccessControls.insert({ bucket: "bucket", object: "object", });
await gapi.client.storage.objectAccessControls.list({ bucket: "bucket", object: "object", });
await gapi.client.storage.objectAccessControls.patch({ bucket: "bucket", entity: "entity", object: "object", });
await gapi.client.storage.objectAccessControls.update({ bucket: "bucket", entity: "entity", object: "object", });
await gapi.client.storage.objects.bulkRestore({ bucket: "bucket", });
await gapi.client.storage.objects.compose({ destinationBucket: "destinationBucket", destinationObject: "destinationObject", });
await gapi.client.storage.objects.copy({ destinationBucket: "destinationBucket", destinationObject: "destinationObject", sourceBucket: "sourceBucket", sourceObject: "sourceObject", });
await gapi.client.storage.objects.delete({ bucket: "bucket", object: "object", });
await gapi.client.storage.objects.get({ bucket: "bucket", object: "object", });
await gapi.client.storage.objects.getIamPolicy({ bucket: "bucket", object: "object", });
await gapi.client.storage.objects.insert({ bucket: "bucket", });
await gapi.client.storage.objects.list({ bucket: "bucket", });
await gapi.client.storage.objects.patch({ bucket: "bucket", object: "object", });
await gapi.client.storage.objects.restore({ bucket: "bucket", generation: "generation", object: "object", });
await gapi.client.storage.objects.rewrite({ destinationBucket: "destinationBucket", destinationObject: "destinationObject", sourceBucket: "sourceBucket", sourceObject: "sourceObject", });
await gapi.client.storage.objects.setIamPolicy({ bucket: "bucket", object: "object", });
await gapi.client.storage.objects.testIamPermissions({ bucket: "bucket", object: "object", permissions: "permissions", });
await gapi.client.storage.objects.update({ bucket: "bucket", object: "object", });
await gapi.client.storage.objects.watchAll({ bucket: "bucket", });
await gapi.client.storage.buckets.operations.cancel({ bucket: "bucket", operationId: "operationId", });
await gapi.client.storage.buckets.operations.get({ bucket: "bucket", operationId: "operationId", });
await gapi.client.storage.buckets.operations.list({ bucket: "bucket", });