Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@maxim_mazurok/gapi.client.storage-v1
Advanced tools
TypeScript typings for Cloud Storage JSON API v1
Stores and retrieves potentially large, immutable data objects. For detailed description please check documentation.
Install typings for Cloud Storage JSON API:
npm install @types/gapi.client.storage-v1 --save-dev
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://storage.googleapis.com/$discovery/rest?version=v1',
() => {
// now we can use:
// gapi.client.storage
}
);
// 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('storage', 'v1', () => {
// now we can use:
// gapi.client.storage
});
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 = [
// View and manage your data across Google Cloud Platform services
'https://www.googleapis.com/auth/cloud-platform',
// View your data across Google Cloud Platform services
'https://www.googleapis.com/auth/cloud-platform.read-only',
// Manage your data and permissions in Google Cloud Storage
'https://www.googleapis.com/auth/devstorage.full_control',
// View your data in Google Cloud Storage
'https://www.googleapis.com/auth/devstorage.read_only',
// Manage your data in Google Cloud Storage
'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) {
/* handle successful authorization */
} else {
/* handle authorization error */
}
}
);
After that you can use Cloud Storage JSON API resources:
/*
Disables an Anywhere Cache instance.
*/
await gapi.client.storage.anywhereCaches.disable({
anywhereCacheId: 'anywhereCacheId',
bucket: 'bucket',
});
/*
Returns the metadata of an Anywhere Cache instance.
*/
await gapi.client.storage.anywhereCaches.get({
anywhereCacheId: 'anywhereCacheId',
bucket: 'bucket',
});
/*
Creates an Anywhere Cache instance.
*/
await gapi.client.storage.anywhereCaches.insert({bucket: 'bucket'});
/*
Returns a list of Anywhere Cache instances of the bucket matching the criteria.
*/
await gapi.client.storage.anywhereCaches.list({bucket: 'bucket'});
/*
Pauses an Anywhere Cache instance.
*/
await gapi.client.storage.anywhereCaches.pause({
anywhereCacheId: 'anywhereCacheId',
bucket: 'bucket',
});
/*
Resumes a paused or disabled Anywhere Cache instance.
*/
await gapi.client.storage.anywhereCaches.resume({
anywhereCacheId: 'anywhereCacheId',
bucket: 'bucket',
});
/*
Updates the config(ttl and admissionPolicy) of an Anywhere Cache instance.
*/
await gapi.client.storage.anywhereCaches.update({
anywhereCacheId: 'anywhereCacheId',
bucket: 'bucket',
});
/*
Permanently deletes the ACL entry for the specified entity on the specified bucket.
*/
await gapi.client.storage.bucketAccessControls.delete({
bucket: 'bucket',
entity: 'entity',
});
/*
Returns the ACL entry for the specified entity on the specified bucket.
*/
await gapi.client.storage.bucketAccessControls.get({
bucket: 'bucket',
entity: 'entity',
});
/*
Creates a new ACL entry on the specified bucket.
*/
await gapi.client.storage.bucketAccessControls.insert({bucket: 'bucket'});
/*
Retrieves ACL entries on the specified bucket.
*/
await gapi.client.storage.bucketAccessControls.list({bucket: 'bucket'});
/*
Patches an ACL entry on the specified bucket.
*/
await gapi.client.storage.bucketAccessControls.patch({
bucket: 'bucket',
entity: 'entity',
});
/*
Updates an ACL entry on the specified bucket.
*/
await gapi.client.storage.bucketAccessControls.update({
bucket: 'bucket',
entity: 'entity',
});
/*
Deletes an empty bucket. Deletions are permanent unless soft delete is enabled on the bucket.
*/
await gapi.client.storage.buckets.delete({bucket: 'bucket'});
/*
Returns metadata for the specified bucket.
*/
await gapi.client.storage.buckets.get({bucket: 'bucket'});
/*
Returns an IAM policy for the specified bucket.
*/
await gapi.client.storage.buckets.getIamPolicy({bucket: 'bucket'});
/*
Returns the storage layout configuration for the specified bucket. Note that this operation requires storage.objects.list permission.
*/
await gapi.client.storage.buckets.getStorageLayout({bucket: 'bucket'});
/*
Creates a new bucket.
*/
await gapi.client.storage.buckets.insert({project: 'project'});
/*
Retrieves a list of buckets for a given project.
*/
await gapi.client.storage.buckets.list({project: 'project'});
/*
Locks retention policy on a bucket.
*/
await gapi.client.storage.buckets.lockRetentionPolicy({
bucket: 'bucket',
ifMetagenerationMatch: 'ifMetagenerationMatch',
});
/*
Patches a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.
*/
await gapi.client.storage.buckets.patch({bucket: 'bucket'});
/*
Initiates a long-running Relocate Bucket operation on the specified bucket.
*/
await gapi.client.storage.buckets.relocate({bucket: 'bucket'});
/*
Restores a soft-deleted bucket.
*/
await gapi.client.storage.buckets.restore({
bucket: 'bucket',
generation: 'generation',
});
/*
Updates an IAM policy for the specified bucket.
*/
await gapi.client.storage.buckets.setIamPolicy({bucket: 'bucket'});
/*
Tests a set of permissions on the given bucket to see which, if any, are held by the caller.
*/
await gapi.client.storage.buckets.testIamPermissions({
bucket: 'bucket',
permissions: 'permissions',
});
/*
Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.
*/
await gapi.client.storage.buckets.update({bucket: 'bucket'});
/*
Stop watching resources through this channel
*/
await gapi.client.storage.channels.stop({});
/*
Permanently deletes the default object ACL entry for the specified entity on the specified bucket.
*/
await gapi.client.storage.defaultObjectAccessControls.delete({
bucket: 'bucket',
entity: 'entity',
});
/*
Returns the default object ACL entry for the specified entity on the specified bucket.
*/
await gapi.client.storage.defaultObjectAccessControls.get({
bucket: 'bucket',
entity: 'entity',
});
/*
Creates a new default object ACL entry on the specified bucket.
*/
await gapi.client.storage.defaultObjectAccessControls.insert({
bucket: 'bucket',
});
/*
Retrieves default object ACL entries on the specified bucket.
*/
await gapi.client.storage.defaultObjectAccessControls.list({bucket: 'bucket'});
/*
Patches a default object ACL entry on the specified bucket.
*/
await gapi.client.storage.defaultObjectAccessControls.patch({
bucket: 'bucket',
entity: 'entity',
});
/*
Updates a default object ACL entry on the specified bucket.
*/
await gapi.client.storage.defaultObjectAccessControls.update({
bucket: 'bucket',
entity: 'entity',
});
/*
Permanently deletes a folder. Only applicable to buckets with hierarchical namespace enabled.
*/
await gapi.client.storage.folders.delete({bucket: 'bucket', folder: 'folder'});
/*
Returns metadata for the specified folder. Only applicable to buckets with hierarchical namespace enabled.
*/
await gapi.client.storage.folders.get({bucket: 'bucket', folder: 'folder'});
/*
Creates a new folder. Only applicable to buckets with hierarchical namespace enabled.
*/
await gapi.client.storage.folders.insert({bucket: 'bucket'});
/*
Retrieves a list of folders matching the criteria. Only applicable to buckets with hierarchical namespace enabled.
*/
await gapi.client.storage.folders.list({bucket: 'bucket'});
/*
Renames a source folder to a destination folder. Only applicable to buckets with hierarchical namespace enabled.
*/
await gapi.client.storage.folders.rename({
bucket: 'bucket',
destinationFolder: 'destinationFolder',
sourceFolder: 'sourceFolder',
});
/*
Permanently deletes a managed folder.
*/
await gapi.client.storage.managedFolders.delete({
bucket: 'bucket',
managedFolder: 'managedFolder',
});
/*
Returns metadata of the specified managed folder.
*/
await gapi.client.storage.managedFolders.get({
bucket: 'bucket',
managedFolder: 'managedFolder',
});
/*
Returns an IAM policy for the specified managed folder.
*/
await gapi.client.storage.managedFolders.getIamPolicy({
bucket: 'bucket',
managedFolder: 'managedFolder',
});
/*
Creates a new managed folder.
*/
await gapi.client.storage.managedFolders.insert({bucket: 'bucket'});
/*
Lists managed folders in the given bucket.
*/
await gapi.client.storage.managedFolders.list({bucket: 'bucket'});
/*
Updates an IAM policy for the specified managed folder.
*/
await gapi.client.storage.managedFolders.setIamPolicy({
bucket: 'bucket',
managedFolder: 'managedFolder',
});
/*
Tests a set of permissions on the given managed folder to see which, if any, are held by the caller.
*/
await gapi.client.storage.managedFolders.testIamPermissions({
bucket: 'bucket',
managedFolder: 'managedFolder',
permissions: 'permissions',
});
/*
Permanently deletes a notification subscription.
*/
await gapi.client.storage.notifications.delete({
bucket: 'bucket',
notification: 'notification',
});
/*
View a notification configuration.
*/
await gapi.client.storage.notifications.get({
bucket: 'bucket',
notification: 'notification',
});
/*
Creates a notification subscription for a given bucket.
*/
await gapi.client.storage.notifications.insert({bucket: 'bucket'});
/*
Retrieves a list of notification subscriptions for a given bucket.
*/
await gapi.client.storage.notifications.list({bucket: 'bucket'});
/*
Permanently deletes the ACL entry for the specified entity on the specified object.
*/
await gapi.client.storage.objectAccessControls.delete({
bucket: 'bucket',
entity: 'entity',
object: 'object',
});
/*
Returns the ACL entry for the specified entity on the specified object.
*/
await gapi.client.storage.objectAccessControls.get({
bucket: 'bucket',
entity: 'entity',
object: 'object',
});
/*
Creates a new ACL entry on the specified object.
*/
await gapi.client.storage.objectAccessControls.insert({
bucket: 'bucket',
object: 'object',
});
/*
Retrieves ACL entries on the specified object.
*/
await gapi.client.storage.objectAccessControls.list({
bucket: 'bucket',
object: 'object',
});
/*
Patches an ACL entry on the specified object.
*/
await gapi.client.storage.objectAccessControls.patch({
bucket: 'bucket',
entity: 'entity',
object: 'object',
});
/*
Updates an ACL entry on the specified object.
*/
await gapi.client.storage.objectAccessControls.update({
bucket: 'bucket',
entity: 'entity',
object: 'object',
});
/*
Initiates a long-running bulk restore operation on the specified bucket.
*/
await gapi.client.storage.objects.bulkRestore({bucket: 'bucket'});
/*
Concatenates a list of existing objects into a new object in the same bucket.
*/
await gapi.client.storage.objects.compose({
destinationBucket: 'destinationBucket',
destinationObject: 'destinationObject',
});
/*
Copies a source object to a destination object. Optionally overrides metadata.
*/
await gapi.client.storage.objects.copy({
destinationBucket: 'destinationBucket',
destinationObject: 'destinationObject',
sourceBucket: 'sourceBucket',
sourceObject: 'sourceObject',
});
/*
Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used.
*/
await gapi.client.storage.objects.delete({bucket: 'bucket', object: 'object'});
/*
Retrieves an object or its metadata.
*/
await gapi.client.storage.objects.get({bucket: 'bucket', object: 'object'});
/*
Returns an IAM policy for the specified object.
*/
await gapi.client.storage.objects.getIamPolicy({
bucket: 'bucket',
object: 'object',
});
/*
Stores a new object and metadata.
*/
await gapi.client.storage.objects.insert({bucket: 'bucket'});
/*
Retrieves a list of objects matching the criteria.
*/
await gapi.client.storage.objects.list({bucket: 'bucket'});
/*
Moves the source object to the destination object in the same bucket.
*/
await gapi.client.storage.objects.move({
bucket: 'bucket',
destinationObject: 'destinationObject',
sourceObject: 'sourceObject',
});
/*
Patches an object's metadata.
*/
await gapi.client.storage.objects.patch({bucket: 'bucket', object: 'object'});
/*
Restores a soft-deleted object.
*/
await gapi.client.storage.objects.restore({
bucket: 'bucket',
generation: 'generation',
object: 'object',
});
/*
Rewrites a source object to a destination object. Optionally overrides metadata.
*/
await gapi.client.storage.objects.rewrite({
destinationBucket: 'destinationBucket',
destinationObject: 'destinationObject',
sourceBucket: 'sourceBucket',
sourceObject: 'sourceObject',
});
/*
Updates an IAM policy for the specified object.
*/
await gapi.client.storage.objects.setIamPolicy({
bucket: 'bucket',
object: 'object',
});
/*
Tests a set of permissions on the given object to see which, if any, are held by the caller.
*/
await gapi.client.storage.objects.testIamPermissions({
bucket: 'bucket',
object: 'object',
permissions: 'permissions',
});
/*
Updates an object's metadata.
*/
await gapi.client.storage.objects.update({bucket: 'bucket', object: 'object'});
/*
Watch for changes on all objects in a bucket.
*/
await gapi.client.storage.objects.watchAll({bucket: 'bucket'});
/*
Starts asynchronous advancement of the relocate bucket operation in the case of required write downtime, to allow it to lock the bucket at the source location, and proceed with the bucket location swap. The server makes a best effort to advance the relocate bucket operation, but success is not guaranteed.
*/
await gapi.client.storage.buckets.operations.advanceRelocateBucket({
bucket: 'bucket',
operationId: 'operationId',
});
/*
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed.
*/
await gapi.client.storage.buckets.operations.cancel({
bucket: 'bucket',
operationId: 'operationId',
});
/*
Gets the latest state of a long-running operation.
*/
await gapi.client.storage.buckets.operations.get({
bucket: 'bucket',
operationId: 'operationId',
});
/*
Lists operations that match the specified filter in the request.
*/
await gapi.client.storage.buckets.operations.list({bucket: 'bucket'});
FAQs
TypeScript typings for Cloud Storage JSON API v1
We found that @maxim_mazurok/gapi.client.storage-v1 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.