npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@maxim_mazurok/gapi.client.storage-v1

v0.0.20241117

Published

TypeScript typings for Cloud Storage JSON API v1

Downloads

23,756

Readme

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', () => {
  // 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'});

/*
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'});