0.0.20240519 • Published 1 day ago

@maxim_mazurok/gapi.client.cloudsupport-v2 v0.0.20240519

Weekly downloads
-
License
MIT
Repository
github
Last release
1 day ago

TypeScript typings for Google Cloud Support API v2

Manages Google Cloud technical support cases for Customer Care support offerings. For detailed description please check documentation.

Installing

Install typings for Google Cloud Support API:

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

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 = [
    // 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 Google Cloud Support API resources:

/*
Retrieve valid classifications to use when creating a support case. Classifications are hierarchical. Each classification is a string containing all levels of the hierarchy separated by `" > "`. For example, `"Technical Issue > Compute > Compute Engine"`. Classification IDs returned by this endpoint are valid for at least six months. When a classification is deactivated, this endpoint immediately stops returning it. After six months, `case.create` requests using the classification will fail. EXAMPLES: cURL: ```bash curl \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ 'https://cloudsupport.googleapis.com/v2/caseClassifications:search?query=display_name:"*Compute%20Engine*"' ``` Python: ```python import googleapiclient.discovery supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version="v2", discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version=v2", ) request = supportApiService.caseClassifications().search( query='display_name:"*Compute Engine*"' ) print(request.execute()) ```
*/
await gapi.client.cloudsupport.caseClassifications.search({});

/*
Close a case. EXAMPLES: cURL: ```bash case="projects/some-project/cases/43595344" curl \ --request POST \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://cloudsupport.googleapis.com/v2/$case:close" ``` Python: ```python import googleapiclient.discovery api_version = "v2" supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}", ) request = supportApiService.cases().close( name="projects/some-project/cases/43595344" ) print(request.execute()) ```
*/
await gapi.client.cloudsupport.cases.close({name: 'name'});

/*
Create a new case and associate it with a parent. It must have the following fields set: `display_name`, `description`, `classification`, and `priority`. If you're just testing the API and don't want to route your case to an agent, set `testCase=true`. EXAMPLES: cURL: ```bash parent="projects/some-project" curl \ --request POST \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ --header 'Content-Type: application/json' \ --data '{ "display_name": "Test case created by me.", "description": "a random test case, feel free to close", "classification": { "id": "100IK2AKCLHMGRJ9CDGMOCGP8DM6UTB4BT262T31BT1M2T31DHNMENPO6KS36CPJ786L2TBFEHGN6NPI64R3CDHN8880G08I1H3MURR7DHII0GRCDTQM8" }, "time_zone": "-07:00", "subscriber_email_addresses": [ "foo@domain.com", "bar@domain.com" ], "testCase": true, "priority": "P3" }' \ "https://cloudsupport.googleapis.com/v2/$parent/cases" ``` Python: ```python import googleapiclient.discovery api_version = "v2" supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}", ) request = supportApiService.cases().create( parent="projects/some-project", body={ "displayName": "A Test Case", "description": "This is a test case.", "testCase": True, "priority": "P2", "classification": { "id": "100IK2AKCLHMGRJ9CDGMOCGP8DM6UTB4BT262T31BT1M2T31DHNMENPO6KS36CPJ786L2TBFEHGN6NPI64R3CDHN8880G08I1H3MURR7DHII0GRCDTQM8" }, }, ) print(request.execute()) ```
*/
await gapi.client.cloudsupport.cases.create({parent: 'parent'});

/*
Escalate a case, starting the Google Cloud Support escalation management process. This operation is only available for some support services. Go to https://cloud.google.com/support and look for 'Technical support escalations' in the feature list to find out which ones let you do that. EXAMPLES: cURL: ```bash case="projects/some-project/cases/43595344" curl \ --request POST \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ --header "Content-Type: application/json" \ --data '{ "escalation": { "reason": "BUSINESS_IMPACT", "justification": "This is a test escalation." } }' \ "https://cloudsupport.googleapis.com/v2/$case:escalate" ``` Python: ```python import googleapiclient.discovery api_version = "v2" supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}", ) request = supportApiService.cases().escalate( name="projects/some-project/cases/43595344", body={ "escalation": { "reason": "BUSINESS_IMPACT", "justification": "This is a test escalation.", }, }, ) print(request.execute()) ```
*/
await gapi.client.cloudsupport.cases.escalate({name: 'name'});

/*
Retrieve a case. EXAMPLES: cURL: ```bash case="projects/some-project/cases/16033687" curl \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://cloudsupport.googleapis.com/v2/$case" ``` Python: ```python import googleapiclient.discovery api_version = "v2" supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}", ) request = supportApiService.cases().get( name="projects/some-project/cases/43595344", ) print(request.execute()) ```
*/
await gapi.client.cloudsupport.cases.get({name: 'name'});

/*
Retrieve all cases under a parent, but not its children. For example, listing cases under an organization only returns the cases that are directly parented by that organization. To retrieve cases under an organization and its projects, use `cases.search`. EXAMPLES: cURL: ```bash parent="projects/some-project" curl \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://cloudsupport.googleapis.com/v2/$parent/cases" ``` Python: ```python import googleapiclient.discovery api_version = "v2" supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}", ) request = supportApiService.cases().list(parent="projects/some-project") print(request.execute()) ```
*/
await gapi.client.cloudsupport.cases.list({parent: 'parent'});

/*
Update a case. Only some fields can be updated. EXAMPLES: cURL: ```bash case="projects/some-project/cases/43595344" curl \ --request PATCH \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ --header "Content-Type: application/json" \ --data '{ "priority": "P1" }' \ "https://cloudsupport.googleapis.com/v2/$case?updateMask=priority" ``` Python: ```python import googleapiclient.discovery api_version = "v2" supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}", ) request = supportApiService.cases().patch( name="projects/some-project/cases/43112854", body={ "displayName": "This is Now a New Title", "priority": "P2", }, ) print(request.execute()) ```
*/
await gapi.client.cloudsupport.cases.patch({name: 'name'});

/*
Search for cases using a query. EXAMPLES: cURL: ```bash parent="projects/some-project" curl \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://cloudsupport.googleapis.com/v2/$parent/cases:search" ``` Python: ```python import googleapiclient.discovery api_version = "v2" supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}", ) request = supportApiService.cases().search( parent="projects/some-project", query="state=OPEN" ) print(request.execute()) ```
*/
await gapi.client.cloudsupport.cases.search({parent: 'parent'});

/*
Download a file attached to a case. Note: HTTP requests must append "?alt=media" to the URL. EXAMPLES: cURL: ```bash name="projects/some-project/cases/43594844/attachments/0674M00000WijAnZAJ" curl \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://cloudsupport.googleapis.com/v2/$name:download?alt=media" ``` Python: ```python import googleapiclient.discovery api_version = "v2" supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}", ) request = supportApiService.media().download( name="projects/some-project/cases/43595344/attachments/0684M00000Pw6pHQAR" ) request.uri = request.uri.split("?")[0] + "?alt=media" print(request.execute()) ```
*/
await gapi.client.cloudsupport.media.download({name: 'name'});

/*
Create a file attachment on a case or Cloud resource. The attachment must have the following fields set: `filename`. EXAMPLES: cURL: ```bash echo "This text is in a file I'm uploading using CSAPI." \ > "./example_file.txt" case="projects/some-project/cases/43594844" curl \ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ --data-binary @"./example_file.txt" \ "https://cloudsupport.googleapis.com/upload/v2beta/$case/attachments?attachment.filename=uploaded_via_curl.txt" ``` Python: ```python import googleapiclient.discovery api_version = "v2" supportApiService = googleapiclient.discovery.build( serviceName="cloudsupport", version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.com/$discovery/rest?version={api_version}", ) file_path = "./example_file.txt" with open(file_path, "w") as file: file.write( "This text is inside a file I'm going to upload using the Cloud Support API.", ) request = supportApiService.media().upload( parent="projects/some-project/cases/43595344", media_body=file_path ) request.uri = request.uri.split("?")[0] + "?attachment.filename=uploaded_via_python.txt" print(request.execute()) ```
*/
await gapi.client.cloudsupport.media.upload({parent: 'parent'});
0.0.20240519

1 day ago

0.0.20240515

5 days ago

0.0.20240514

6 days ago

0.0.20240513

7 days ago

0.0.20240512

8 days ago

0.0.20240508

12 days ago

0.0.20240505

15 days ago

0.0.20240501

19 days ago

0.0.20240430

20 days ago

0.0.20240429

21 days ago

0.0.20240428

22 days ago

0.0.20240424

26 days ago

0.0.20240423

27 days ago

0.0.20240422

28 days ago

0.0.20240421

29 days ago

0.0.20240416

1 month ago

0.0.20240413

1 month ago

0.0.20240403

2 months ago

0.0.20240331

2 months ago

0.0.20240327

2 months ago

0.0.20240322

2 months ago

0.0.20240320

2 months ago

0.0.20240318

2 months ago

0.0.20240317

2 months ago

0.0.20240313

2 months ago

0.0.20240310

2 months ago

0.0.20240312

2 months ago

0.0.20240306

3 months ago

0.0.20240305

3 months ago

0.0.20240304

3 months ago

0.0.20240303

3 months ago

0.0.20240228

3 months ago

0.0.20240227

3 months ago

0.0.20240225

3 months ago

0.0.20240221

3 months ago

0.0.20240220

3 months ago

0.0.20240219

3 months ago

0.0.20240214

3 months ago

0.0.20240213

3 months ago

0.0.20240212

3 months ago

0.0.20240211

3 months ago

0.0.20240207

3 months ago

0.0.20240206

3 months ago

0.0.20240205

4 months ago

0.0.20240204

4 months ago

0.0.20240131

4 months ago

0.0.20240130

4 months ago

0.0.20240129

4 months ago

0.0.20240123

4 months ago

0.0.20240122

4 months ago

0.0.20240120

4 months ago

0.0.20240116

4 months ago

0.0.20240111

4 months ago

0.0.20240107

4 months ago

0.0.20231220

5 months ago

0.0.20231219

5 months ago

0.0.20231217

5 months ago

0.0.20231213

5 months ago

0.0.20231212

5 months ago

0.0.20231211

5 months ago

0.0.20231207

6 months ago

0.0.20231204

6 months ago

0.0.20231203

6 months ago

0.0.20230818

9 months ago

0.0.20230816

9 months ago

0.0.20231106

7 months ago

0.0.20231029

7 months ago

0.0.20231105

7 months ago

0.0.20230731

10 months ago

0.0.20230814

9 months ago

0.0.20230815

9 months ago

0.0.20231031

7 months ago

0.0.20231113

6 months ago

0.0.20231115

6 months ago

0.0.20231030

7 months ago

0.0.20230807

10 months ago

0.0.20230808

10 months ago

0.0.20230926

8 months ago

0.0.20230927

8 months ago

0.0.20230806

10 months ago

0.0.20230809

10 months ago

0.0.20231018

7 months ago

0.0.20230920

8 months ago

0.0.20231017

7 months ago

0.0.20230723

10 months ago

0.0.20230726

10 months ago

0.0.20230925

8 months ago

0.0.20230801

10 months ago

0.0.20230724

10 months ago

0.0.20230923

8 months ago

0.0.20230725

10 months ago

0.0.20231023

7 months ago

0.0.20231022

7 months ago

0.0.20231101

7 months ago

0.0.20231024

7 months ago

0.0.20230730

10 months ago

0.0.20230917

8 months ago

0.0.20230719

10 months ago

0.0.20230717

10 months ago

0.0.20230718

10 months ago

0.0.20230919

8 months ago

0.0.20231128

6 months ago

0.0.20230711

10 months ago

0.0.20230910

8 months ago

0.0.20230712

10 months ago

0.0.20231009

7 months ago

0.0.20230710

11 months ago

0.0.20230913

8 months ago

0.0.20230716

10 months ago

0.0.20230911

8 months ago

0.0.20230912

8 months ago

0.0.20231011

7 months ago

0.0.20231015

7 months ago

0.0.20230708

11 months ago

0.0.20230907

9 months ago

0.0.20230904

9 months ago

0.0.20230905

9 months ago

0.0.20230822

9 months ago

0.0.20230704

11 months ago

0.0.20230627

11 months ago

0.0.20230705

11 months ago

0.0.20230628

11 months ago

0.0.20230823

9 months ago

0.0.20231001

8 months ago

0.0.20231003

8 months ago

0.0.20231002

8 months ago

0.0.20230626

11 months ago