@maxim_mazurok/gapi.client.cloudbilling-v1beta 0.0.20231124 → 0.0.20231201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1239 -1810
- package/package.json +6 -6
- package/readme.md +26 -21
- package/tests.ts +0 -798
- package/tsconfig.json +0 -18
- package/tslint.json +0 -6
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maxim_mazurok/gapi.client.cloudbilling-v1beta",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20231201",
|
|
4
4
|
"description": "TypeScript typings for Cloud Billing API v1beta",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
|
8
|
+
},
|
|
5
9
|
"license": "MIT",
|
|
6
10
|
"author": {
|
|
7
|
-
"email": "maxim@mazurok.com",
|
|
8
11
|
"name": "Maxim Mazurok",
|
|
12
|
+
"email": "maxim@mazurok.com",
|
|
9
13
|
"url": "https://maxim.mazurok.com"
|
|
10
14
|
},
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
|
14
|
-
},
|
|
15
15
|
"types": "index.d.ts",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@types/gapi.client": "*",
|
package/readme.md
CHANGED
|
@@ -25,10 +25,13 @@ gapi.load('client', () => {
|
|
|
25
25
|
Then load api client wrapper:
|
|
26
26
|
|
|
27
27
|
```typescript
|
|
28
|
-
gapi.client.load(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
gapi.client.load(
|
|
29
|
+
'https://cloudbilling.googleapis.com/$discovery/rest?version=v1beta',
|
|
30
|
+
() => {
|
|
31
|
+
// now we can use:
|
|
32
|
+
// gapi.client.cloudbilling
|
|
33
|
+
}
|
|
34
|
+
);
|
|
32
35
|
```
|
|
33
36
|
|
|
34
37
|
```typescript
|
|
@@ -45,50 +48,52 @@ Don't forget to authenticate your client before sending any request to resources
|
|
|
45
48
|
// declare client_id registered in Google Developers Console
|
|
46
49
|
var client_id = '',
|
|
47
50
|
scope = [
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
// View and manage your Google Cloud Platform billing accounts
|
|
52
|
+
'https://www.googleapis.com/auth/cloud-billing',
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
// View your Google Cloud Platform billing accounts
|
|
55
|
+
'https://www.googleapis.com/auth/cloud-billing.readonly',
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
|
|
58
|
+
'https://www.googleapis.com/auth/cloud-platform',
|
|
59
|
+
],
|
|
60
|
+
immediate = true;
|
|
58
61
|
// ...
|
|
59
62
|
|
|
60
63
|
gapi.auth.authorize(
|
|
61
|
-
{
|
|
64
|
+
{client_id: client_id, scope: scope, immediate: immediate},
|
|
62
65
|
authResult => {
|
|
63
66
|
if (authResult && !authResult.error) {
|
|
64
|
-
|
|
67
|
+
/* handle successful authorization */
|
|
65
68
|
} else {
|
|
66
|
-
|
|
69
|
+
/* handle authorization error */
|
|
67
70
|
}
|
|
68
|
-
}
|
|
71
|
+
}
|
|
72
|
+
);
|
|
69
73
|
```
|
|
70
74
|
|
|
71
75
|
After that you can use Cloud Billing API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
72
76
|
|
|
73
77
|
```typescript
|
|
74
|
-
|
|
75
78
|
/*
|
|
76
79
|
Use custom pricing in the estimate, using a `CostScenario` with a defined `billingAccount`.
|
|
77
80
|
*/
|
|
78
|
-
await gapi.client.cloudbilling.billingAccounts.estimateCostScenario({
|
|
81
|
+
await gapi.client.cloudbilling.billingAccounts.estimateCostScenario({
|
|
82
|
+
billingAccount: 'billingAccount',
|
|
83
|
+
});
|
|
79
84
|
|
|
80
85
|
/*
|
|
81
86
|
Gets a publicly listed SKU group.
|
|
82
87
|
*/
|
|
83
|
-
await gapi.client.cloudbilling.skuGroups.get({
|
|
88
|
+
await gapi.client.cloudbilling.skuGroups.get({name: 'name'});
|
|
84
89
|
|
|
85
90
|
/*
|
|
86
91
|
Lists all publicly listed SKU groups.
|
|
87
92
|
*/
|
|
88
|
-
await gapi.client.cloudbilling.skuGroups.list({
|
|
93
|
+
await gapi.client.cloudbilling.skuGroups.list({});
|
|
89
94
|
|
|
90
95
|
/*
|
|
91
96
|
Estimate list prices using a `CostScenario` without a defined `billingAccount`.
|
|
92
97
|
*/
|
|
93
|
-
await gapi.client.cloudbilling.estimateCostScenario({
|
|
98
|
+
await gapi.client.cloudbilling.estimateCostScenario({});
|
|
94
99
|
```
|