0.0.20241018 • Published 10 months ago

@maxim_mazurok/gapi.client.cloudbilling-v1beta v0.0.20241018

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

TypeScript typings for Cloud Billing API v1beta

Allows developers to manage billing for their Google Cloud Platform projects programmatically. For detailed description please check documentation.

Installing

Install typings for Cloud Billing API:

npm install @types/gapi.client.cloudbilling-v1beta --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://cloudbilling.googleapis.com/$discovery/rest?version=v1beta',
  () => {
    // now we can use:
    // gapi.client.cloudbilling
  }
);
// 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('cloudbilling', 'v1beta', () => {
  // now we can use:
  // gapi.client.cloudbilling
});

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 Google Cloud Platform billing accounts
    'https://www.googleapis.com/auth/cloud-billing',

    // View your Google Cloud Platform billing accounts
    'https://www.googleapis.com/auth/cloud-billing.readonly',

    // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
    'https://www.googleapis.com/auth/cloud-platform',
  ],
  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 Billing API resources:

/*
Use custom pricing in the estimate, using a `CostScenario` with a defined `billingAccount`.
*/
await gapi.client.cloudbilling.billingAccounts.estimateCostScenario({
  billingAccount: 'billingAccount',
});

/*
Gets a publicly listed SKU group.
*/
await gapi.client.cloudbilling.skuGroups.get({name: 'name'});

/*
Lists all publicly listed SKU groups.
*/
await gapi.client.cloudbilling.skuGroups.list({});

/*
Estimate list prices using a `CostScenario` without a defined `billingAccount`.
*/
await gapi.client.cloudbilling.estimateCostScenario({});
0.0.20241018

10 months ago

0.0.20241014

10 months ago

0.0.20241004

10 months ago

0.0.20241011

10 months ago

0.0.20241007

10 months ago

0.0.20240919

11 months ago

0.0.20240916

11 months ago

0.0.20240906

11 months ago

0.0.20240531

1 year ago

0.0.20240809

12 months ago

0.0.20240607

1 year ago

0.0.20240802

1 year ago

0.0.20240816

12 months ago

0.0.20240614

1 year ago

0.0.20240705

1 year ago

0.0.20240719

1 year ago

0.0.20240710

1 year ago

0.0.20240517

1 year ago

0.0.20240510

1 year ago

0.0.20240507

1 year ago

0.0.20240503

1 year ago

0.0.20240419

1 year ago

0.0.20240412

1 year ago

0.0.20240315

1 year ago

0.0.20240311

1 year ago

0.0.20240301

1 year ago

0.0.20240214

1 year ago

0.0.20240209

1 year ago

0.0.20240206

2 years ago

0.0.20240126

2 years ago

0.0.20240119

2 years ago

0.0.20240112

2 years ago

0.0.20240102

2 years ago

0.0.20231215

2 years ago

0.0.20231208

2 years ago

0.0.20231201

2 years ago

0.0.20230818

2 years ago

0.0.20230915

2 years ago

0.0.20230717

2 years ago

0.0.20231006

2 years ago

0.0.20230710

2 years ago

0.0.20231109

2 years ago

0.0.20230813

2 years ago

0.0.20231115

2 years ago

0.0.20230929

2 years ago

0.0.20230728

2 years ago

0.0.20230629

2 years ago

0.0.20230908

2 years ago

0.0.20230825

2 years ago

0.0.20230803

2 years ago

0.0.20230804

2 years ago

0.0.20230922

2 years ago

0.0.20230724

2 years ago

0.0.20230901

2 years ago

0.0.20231120

2 years ago

0.0.20231020

2 years ago

0.0.20231124

2 years ago

0.0.20231025

2 years ago

0.0.20231103

2 years ago

0.0.20230612

2 years ago

0.0.20230616

2 years ago

0.0.20230614

2 years ago

0.0.20230515

2 years ago

0.0.20230521

2 years ago

0.0.20230509

2 years ago

0.0.20230502

2 years ago

0.0.20230501

2 years ago

0.0.20230605

2 years ago

0.0.20230507

2 years ago

0.0.20230409

2 years ago

0.0.20230313

2 years ago

0.0.20230424

2 years ago

0.0.20230402

2 years ago

0.0.20230309

2 years ago

0.0.20230416

2 years ago

0.0.20230322

2 years ago

0.0.20230320

2 years ago

0.0.20230130

3 years ago

0.0.20221206

3 years ago

0.0.20221029

3 years ago

0.0.20221024

3 years ago

0.0.20220914

3 years ago