@maxim_mazurok/gapi.client.cloudsupport-v2 0.0.20230626
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 +1319 -0
- package/package.json +20 -0
- package/readme.md +118 -0
- package/tests.ts +190 -0
- package/tsconfig.json +18 -0
- package/tslint.json +6 -0
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.cloudsupport-v2",
|
|
3
|
+
"version": "0.0.20230626",
|
|
4
|
+
"description": "TypeScript typings for Google Cloud Support API v2",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"email": "maxim@mazurok.com",
|
|
8
|
+
"name": "Maxim Mazurok",
|
|
9
|
+
"url": "https://maxim.mazurok.com"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
|
14
|
+
},
|
|
15
|
+
"types": "index.d.ts",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@types/gapi.client": "*",
|
|
18
|
+
"@types/gapi.client.discovery": "*"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# TypeScript typings for Google Cloud Support API v2
|
|
2
|
+
|
|
3
|
+
Manages Google Cloud technical support cases for Customer Care support offerings.
|
|
4
|
+
For detailed description please check [documentation](https://cloud.google.com/support/docs/apis).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Google Cloud Support API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.cloudsupport-v2 --save-dev
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
You need to initialize Google API client in your code:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
gapi.load('client', () => {
|
|
20
|
+
// now we can use gapi.client
|
|
21
|
+
// ...
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then load api client wrapper:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
gapi.client.load('https://cloudsupport.googleapis.com/$discovery/rest?version=v2', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.cloudsupport
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
|
|
36
|
+
gapi.client.load('cloudsupport', 'v2', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.cloudsupport
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Don't forget to authenticate your client before sending any request to resources:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// declare client_id registered in Google Developers Console
|
|
46
|
+
var client_id = '',
|
|
47
|
+
scope = [
|
|
48
|
+
// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
|
|
49
|
+
'https://www.googleapis.com/auth/cloud-platform',
|
|
50
|
+
],
|
|
51
|
+
immediate = true;
|
|
52
|
+
// ...
|
|
53
|
+
|
|
54
|
+
gapi.auth.authorize(
|
|
55
|
+
{ client_id: client_id, scope: scope, immediate: immediate },
|
|
56
|
+
authResult => {
|
|
57
|
+
if (authResult && !authResult.error) {
|
|
58
|
+
/* handle successful authorization */
|
|
59
|
+
} else {
|
|
60
|
+
/* handle authorization error */
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
After that you can use Google Cloud Support API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
Retrieve valid classifications to be used when creating a support case. The classications are hierarchical, with each classification containing all levels of the hierarchy, separated by `" > "`. For example `"Technical Issue > Compute > Compute Engine"`. Classification IDs returned by `caseClassifications.search` are guaranteed to be valid for at least 6 months. If a given classification is deactiveated, it will immediately stop being returned. After 6 months, `case.create` requests using the classification ID will fail.
|
|
71
|
+
*/
|
|
72
|
+
await gapi.client.cloudsupport.caseClassifications.search({ });
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
Close the specified case.
|
|
76
|
+
*/
|
|
77
|
+
await gapi.client.cloudsupport.cases.close({ name: "name", });
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
Create a new case and associate it with the given Google Cloud Resource. The case object must have the following fields set: `display_name`, `description`, `classification`, and `priority`.
|
|
81
|
+
*/
|
|
82
|
+
await gapi.client.cloudsupport.cases.create({ parent: "parent", });
|
|
83
|
+
|
|
84
|
+
/*
|
|
85
|
+
Escalate a case. Escalating a case will initiate the Google Cloud Support escalation management process. This operation is only available to certain Customer Care tiers. Go to https://cloud.google.com/support and look for 'Technical support escalations' in the feature list to find out which tiers are able to perform escalations.
|
|
86
|
+
*/
|
|
87
|
+
await gapi.client.cloudsupport.cases.escalate({ name: "name", });
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
Retrieve the specified case.
|
|
91
|
+
*/
|
|
92
|
+
await gapi.client.cloudsupport.cases.get({ name: "name", });
|
|
93
|
+
|
|
94
|
+
/*
|
|
95
|
+
Retrieve all cases under the specified parent. Note: Listing cases under an Organization returns only the cases directly parented by that organization. To retrieve all cases under an organization, including cases parented by projects under that organization, use `cases.search`.
|
|
96
|
+
*/
|
|
97
|
+
await gapi.client.cloudsupport.cases.list({ parent: "parent", });
|
|
98
|
+
|
|
99
|
+
/*
|
|
100
|
+
Update the specified case. Only a subset of fields can be updated.
|
|
101
|
+
*/
|
|
102
|
+
await gapi.client.cloudsupport.cases.patch({ name: "name", });
|
|
103
|
+
|
|
104
|
+
/*
|
|
105
|
+
Search cases using the specified query.
|
|
106
|
+
*/
|
|
107
|
+
await gapi.client.cloudsupport.cases.search({ parent: "parent", });
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
Download a file attachment on a case. Note: HTTP requests must append "?alt=media" to the URL.
|
|
111
|
+
*/
|
|
112
|
+
await gapi.client.cloudsupport.media.download({ name: "name", });
|
|
113
|
+
|
|
114
|
+
/*
|
|
115
|
+
Create a file attachment on a case or Cloud resource. The attachment object must have the following fields set: filename.
|
|
116
|
+
*/
|
|
117
|
+
await gapi.client.cloudsupport.media.upload({ parent: "parent", });
|
|
118
|
+
```
|
package/tests.ts
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.cloudsupport-v2 definition tests */
|
|
2
|
+
// IMPORTANT
|
|
3
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
|
4
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
|
5
|
+
|
|
6
|
+
// Revision: 20230626
|
|
7
|
+
|
|
8
|
+
gapi.load('client', async () => {
|
|
9
|
+
/** now we can use gapi.client */
|
|
10
|
+
|
|
11
|
+
await gapi.client.load('https://cloudsupport.googleapis.com/$discovery/rest?version=v2');
|
|
12
|
+
/** now we can use gapi.client.cloudsupport */
|
|
13
|
+
|
|
14
|
+
/** don't forget to authenticate your client before sending any request to resources: */
|
|
15
|
+
/** declare client_id registered in Google Developers Console */
|
|
16
|
+
const client_id = '<<PUT YOUR CLIENT ID HERE>>';
|
|
17
|
+
const scope = [
|
|
18
|
+
/** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. */
|
|
19
|
+
'https://www.googleapis.com/auth/cloud-platform',
|
|
20
|
+
];
|
|
21
|
+
const immediate = false;
|
|
22
|
+
gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
|
|
23
|
+
if (authResult && !authResult.error) {
|
|
24
|
+
/** handle successful authorization */
|
|
25
|
+
run();
|
|
26
|
+
} else {
|
|
27
|
+
/** handle authorization error */
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
async function run() {
|
|
32
|
+
/**
|
|
33
|
+
* Retrieve valid classifications to be used when creating a support case. The classications are hierarchical, with each classification containing all levels of the hierarchy, separated by
|
|
34
|
+
* `" > "`. For example `"Technical Issue > Compute > Compute Engine"`. Classification IDs returned by `caseClassifications.search` are guaranteed to be valid for at least 6 months. If a
|
|
35
|
+
* given classification is deactiveated, it will immediately stop being returned. After 6 months, `case.create` requests using the classification ID will fail.
|
|
36
|
+
*/
|
|
37
|
+
await gapi.client.cloudsupport.caseClassifications.search({
|
|
38
|
+
pageSize: 42,
|
|
39
|
+
pageToken: "Test string",
|
|
40
|
+
query: "Test string",
|
|
41
|
+
});
|
|
42
|
+
/** Close the specified case. */
|
|
43
|
+
await gapi.client.cloudsupport.cases.close({
|
|
44
|
+
name: "Test string",
|
|
45
|
+
}, {
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Create a new case and associate it with the given Google Cloud Resource. The case object must have the following fields set: `display_name`, `description`, `classification`, and
|
|
49
|
+
* `priority`.
|
|
50
|
+
*/
|
|
51
|
+
await gapi.client.cloudsupport.cases.create({
|
|
52
|
+
parent: "Test string",
|
|
53
|
+
}, {
|
|
54
|
+
classification: {
|
|
55
|
+
displayName: "Test string",
|
|
56
|
+
id: "Test string",
|
|
57
|
+
},
|
|
58
|
+
contactEmail: "Test string",
|
|
59
|
+
createTime: "Test string",
|
|
60
|
+
creator: {
|
|
61
|
+
displayName: "Test string",
|
|
62
|
+
email: "Test string",
|
|
63
|
+
googleSupport: true,
|
|
64
|
+
},
|
|
65
|
+
description: "Test string",
|
|
66
|
+
displayName: "Test string",
|
|
67
|
+
escalated: true,
|
|
68
|
+
languageCode: "Test string",
|
|
69
|
+
name: "Test string",
|
|
70
|
+
priority: "Test string",
|
|
71
|
+
state: "Test string",
|
|
72
|
+
subscriberEmailAddresses: [
|
|
73
|
+
"Test string"
|
|
74
|
+
],
|
|
75
|
+
testCase: true,
|
|
76
|
+
timeZone: "Test string",
|
|
77
|
+
updateTime: "Test string",
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* Escalate a case. Escalating a case will initiate the Google Cloud Support escalation management process. This operation is only available to certain Customer Care tiers. Go to
|
|
81
|
+
* https://cloud.google.com/support and look for 'Technical support escalations' in the feature list to find out which tiers are able to perform escalations.
|
|
82
|
+
*/
|
|
83
|
+
await gapi.client.cloudsupport.cases.escalate({
|
|
84
|
+
name: "Test string",
|
|
85
|
+
}, {
|
|
86
|
+
escalation: {
|
|
87
|
+
justification: "Test string",
|
|
88
|
+
reason: "Test string",
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
/** Retrieve the specified case. */
|
|
92
|
+
await gapi.client.cloudsupport.cases.get({
|
|
93
|
+
name: "Test string",
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* Retrieve all cases under the specified parent. Note: Listing cases under an Organization returns only the cases directly parented by that organization. To retrieve all cases under an
|
|
97
|
+
* organization, including cases parented by projects under that organization, use `cases.search`.
|
|
98
|
+
*/
|
|
99
|
+
await gapi.client.cloudsupport.cases.list({
|
|
100
|
+
filter: "Test string",
|
|
101
|
+
pageSize: 42,
|
|
102
|
+
pageToken: "Test string",
|
|
103
|
+
parent: "Test string",
|
|
104
|
+
});
|
|
105
|
+
/** Update the specified case. Only a subset of fields can be updated. */
|
|
106
|
+
await gapi.client.cloudsupport.cases.patch({
|
|
107
|
+
name: "Test string",
|
|
108
|
+
updateMask: "Test string",
|
|
109
|
+
}, {
|
|
110
|
+
classification: {
|
|
111
|
+
displayName: "Test string",
|
|
112
|
+
id: "Test string",
|
|
113
|
+
},
|
|
114
|
+
contactEmail: "Test string",
|
|
115
|
+
createTime: "Test string",
|
|
116
|
+
creator: {
|
|
117
|
+
displayName: "Test string",
|
|
118
|
+
email: "Test string",
|
|
119
|
+
googleSupport: true,
|
|
120
|
+
},
|
|
121
|
+
description: "Test string",
|
|
122
|
+
displayName: "Test string",
|
|
123
|
+
escalated: true,
|
|
124
|
+
languageCode: "Test string",
|
|
125
|
+
name: "Test string",
|
|
126
|
+
priority: "Test string",
|
|
127
|
+
state: "Test string",
|
|
128
|
+
subscriberEmailAddresses: [
|
|
129
|
+
"Test string"
|
|
130
|
+
],
|
|
131
|
+
testCase: true,
|
|
132
|
+
timeZone: "Test string",
|
|
133
|
+
updateTime: "Test string",
|
|
134
|
+
});
|
|
135
|
+
/** Search cases using the specified query. */
|
|
136
|
+
await gapi.client.cloudsupport.cases.search({
|
|
137
|
+
pageSize: 42,
|
|
138
|
+
pageToken: "Test string",
|
|
139
|
+
parent: "Test string",
|
|
140
|
+
query: "Test string",
|
|
141
|
+
});
|
|
142
|
+
/** Retrieve all attachments associated with a support case. */
|
|
143
|
+
await gapi.client.cloudsupport.cases.attachments.list({
|
|
144
|
+
pageSize: 42,
|
|
145
|
+
pageToken: "Test string",
|
|
146
|
+
parent: "Test string",
|
|
147
|
+
});
|
|
148
|
+
/** Add a new comment to the specified Case. The comment object must have the following fields set: body. */
|
|
149
|
+
await gapi.client.cloudsupport.cases.comments.create({
|
|
150
|
+
parent: "Test string",
|
|
151
|
+
}, {
|
|
152
|
+
body: "Test string",
|
|
153
|
+
createTime: "Test string",
|
|
154
|
+
creator: {
|
|
155
|
+
displayName: "Test string",
|
|
156
|
+
email: "Test string",
|
|
157
|
+
googleSupport: true,
|
|
158
|
+
},
|
|
159
|
+
name: "Test string",
|
|
160
|
+
plainTextBody: "Test string",
|
|
161
|
+
});
|
|
162
|
+
/** Retrieve all Comments associated with the Case object. */
|
|
163
|
+
await gapi.client.cloudsupport.cases.comments.list({
|
|
164
|
+
pageSize: 42,
|
|
165
|
+
pageToken: "Test string",
|
|
166
|
+
parent: "Test string",
|
|
167
|
+
});
|
|
168
|
+
/** Download a file attachment on a case. Note: HTTP requests must append "?alt=media" to the URL. */
|
|
169
|
+
await gapi.client.cloudsupport.media.download({
|
|
170
|
+
name: "Test string",
|
|
171
|
+
});
|
|
172
|
+
/** Create a file attachment on a case or Cloud resource. The attachment object must have the following fields set: filename. */
|
|
173
|
+
await gapi.client.cloudsupport.media.upload({
|
|
174
|
+
parent: "Test string",
|
|
175
|
+
}, {
|
|
176
|
+
attachment: {
|
|
177
|
+
createTime: "Test string",
|
|
178
|
+
creator: {
|
|
179
|
+
displayName: "Test string",
|
|
180
|
+
email: "Test string",
|
|
181
|
+
googleSupport: true,
|
|
182
|
+
},
|
|
183
|
+
filename: "Test string",
|
|
184
|
+
mimeType: "Test string",
|
|
185
|
+
name: "Test string",
|
|
186
|
+
sizeBytes: "Test string",
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": ["es6", "dom"],
|
|
5
|
+
"noImplicitAny": true,
|
|
6
|
+
"noImplicitThis": true,
|
|
7
|
+
"strictNullChecks": true,
|
|
8
|
+
"baseUrl": "../",
|
|
9
|
+
"typeRoots": [
|
|
10
|
+
"../"
|
|
11
|
+
],
|
|
12
|
+
"types": [],
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"strictFunctionTypes": true
|
|
16
|
+
},
|
|
17
|
+
"files": ["index.d.ts", "tests.ts"]
|
|
18
|
+
}
|