0.0.20250611 • Published 10 months ago

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

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months 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. When this endpoint is called, no "response body" will be returned. Instead, the attachment's blob will be returned. 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.20250528

10 months ago

0.0.20250527

10 months ago

0.0.20250404

12 months ago

0.0.20250522

10 months ago

0.0.20250520

10 months ago

0.0.20250521

10 months ago

0.0.20250416

12 months ago

0.0.20250417

12 months ago

0.0.20250414

12 months ago

0.0.20250429

11 months ago

0.0.20250428

11 months ago

0.0.20250304

1 year ago

0.0.20250305

1 year ago

0.0.20250423

11 months ago

0.0.20250424

11 months ago

0.0.20250421

11 months ago

0.0.20250422

11 months ago

0.0.20250319

1 year ago

0.0.20250317

1 year ago

0.0.20250313

1 year ago

0.0.20250311

1 year ago

0.0.20250312

1 year ago

0.0.20250205

1 year ago

0.0.20250327

1 year ago

0.0.20250324

1 year ago

0.0.20250325

1 year ago

0.0.20250218

1 year ago

0.0.20250219

1 year ago

0.0.20250212

1 year ago

0.0.20250220

1 year ago

0.0.20250227

1 year ago

0.0.20250225

1 year ago

0.0.20250226

1 year ago

0.0.20250224

1 year ago

0.0.20250112

1 year ago

0.0.20250115

1 year ago

0.0.20250116

1 year ago

0.0.20250114

1 year ago

0.0.20250128

1 year ago

0.0.20250129

1 year ago

0.0.20250127

1 year ago

0.0.20250130

1 year ago

0.0.20241212

1 year ago

0.0.20241211

1 year ago

0.0.20241209

1 year ago

0.0.20250609

10 months ago

0.0.20241103

1 year ago

0.0.20250605

10 months ago

0.0.20250603

10 months ago

0.0.20250602

10 months ago

0.0.20241218

1 year ago

0.0.20241231

1 year ago

0.0.20241112

1 year ago

0.0.20250611

10 months ago

0.0.20241106

1 year ago

0.0.20241104

1 year ago

0.0.20241120

1 year ago

0.0.20250508

11 months ago

0.0.20250506

11 months ago

0.0.20250507

11 months ago

0.0.20250505

11 months ago

0.0.20241118

1 year ago

0.0.20250519

11 months ago

0.0.20250513

11 months ago

0.0.20250514

11 months ago

0.0.20241101

1 year ago

0.0.20241030

1 year ago

0.0.20241029

1 year ago

0.0.20241028

1 year ago

0.0.20241022

1 year ago

0.0.20241021

1 year ago

0.0.20241020

1 year ago

0.0.20241014

1 year ago

0.0.20241001

1 year ago

0.0.20241008

1 year ago

0.0.20241007

1 year ago

0.0.20241009

1 year ago

0.0.20240918

2 years ago

0.0.20240916

2 years ago

0.0.20240922

2 years ago

0.0.20240923

2 years ago

0.0.20240909

2 years ago

0.0.20240905

2 years ago

0.0.20240910

2 years ago

0.0.20240911

2 years ago

0.0.20240904

2 years ago

0.0.20240902

2 years ago

0.0.20240827

2 years ago

0.0.20240828

2 years ago

0.0.20240826

2 years ago

0.0.20240602

2 years ago

0.0.20240603

2 years ago

0.0.20240604

2 years ago

0.0.20240721

2 years ago

0.0.20240617

2 years ago

0.0.20240619

2 years ago

0.0.20240616

2 years ago

0.0.20240731

2 years ago

0.0.20240610

2 years ago

0.0.20240611

2 years ago

0.0.20240630

2 years ago

0.0.20240624

2 years ago

0.0.20240623

2 years ago

0.0.20240809

2 years ago

0.0.20240804

2 years ago

0.0.20240529

2 years ago

0.0.20240805

2 years ago

0.0.20240807

2 years ago

0.0.20240802

2 years ago

0.0.20240527

2 years ago

0.0.20240528

2 years ago

0.0.20240521

2 years ago

0.0.20240522

2 years ago

0.0.20240819

2 years ago

0.0.20240818

2 years ago

0.0.20240812

2 years ago

0.0.20240814

2 years ago

0.0.20240709

2 years ago

0.0.20240707

2 years ago

0.0.20240708

2 years ago

0.0.20240701

2 years ago

0.0.20240702

2 years ago

0.0.20240825

2 years ago

0.0.20240821

2 years ago

0.0.20240719

2 years ago

0.0.20240713

2 years ago

0.0.20240710

2 years ago

0.0.20240520

2 years ago

0.0.20240519

2 years ago

0.0.20240515

2 years ago

0.0.20240514

2 years ago

0.0.20240513

2 years ago

0.0.20240512

2 years ago

0.0.20240508

2 years ago

0.0.20240505

2 years ago

0.0.20240501

2 years ago

0.0.20240430

2 years ago

0.0.20240429

2 years ago

0.0.20240428

2 years ago

0.0.20240424

2 years ago

0.0.20240423

2 years ago

0.0.20240422

2 years ago

0.0.20240421

2 years ago

0.0.20240416

2 years ago

0.0.20240413

2 years ago

0.0.20240403

2 years ago

0.0.20240331

2 years ago

0.0.20240327

2 years ago

0.0.20240322

2 years ago

0.0.20240320

2 years ago

0.0.20240318

2 years ago

0.0.20240317

2 years ago

0.0.20240313

2 years ago

0.0.20240310

2 years ago

0.0.20240312

2 years ago

0.0.20240306

2 years ago

0.0.20240305

2 years ago

0.0.20240304

2 years ago

0.0.20240303

2 years ago

0.0.20240228

2 years ago

0.0.20240227

2 years ago

0.0.20240225

2 years ago

0.0.20240221

2 years ago

0.0.20240220

2 years ago

0.0.20240219

2 years ago

0.0.20240214

2 years ago

0.0.20240213

2 years ago

0.0.20240212

2 years ago

0.0.20240211

2 years ago

0.0.20240207

2 years ago

0.0.20240206

2 years ago

0.0.20240205

2 years ago

0.0.20240204

2 years ago

0.0.20240131

2 years ago

0.0.20240130

2 years ago

0.0.20240129

2 years ago

0.0.20240123

2 years ago

0.0.20240122

2 years ago

0.0.20240120

2 years ago

0.0.20240116

2 years ago

0.0.20240111

2 years ago

0.0.20240107

2 years ago

0.0.20231220

2 years ago

0.0.20231219

2 years ago

0.0.20231217

2 years ago

0.0.20231213

2 years ago

0.0.20231212

2 years ago

0.0.20231211

2 years ago

0.0.20231207

2 years ago

0.0.20231204

2 years ago

0.0.20231203

2 years ago

0.0.20230818

3 years ago

0.0.20230816

3 years ago

0.0.20231106

2 years ago

0.0.20231029

2 years ago

0.0.20231105

2 years ago

0.0.20230731

3 years ago

0.0.20230814

3 years ago

0.0.20230815

3 years ago

0.0.20231031

2 years ago

0.0.20231113

2 years ago

0.0.20231115

2 years ago

0.0.20231030

2 years ago

0.0.20230807

3 years ago

0.0.20230808

3 years ago

0.0.20230926

3 years ago

0.0.20230927

3 years ago

0.0.20230806

3 years ago

0.0.20230809

3 years ago

0.0.20231018

2 years ago

0.0.20230920

3 years ago

0.0.20231017

2 years ago

0.0.20230723

3 years ago

0.0.20230726

3 years ago

0.0.20230925

3 years ago

0.0.20230801

3 years ago

0.0.20230724

3 years ago

0.0.20230923

3 years ago

0.0.20230725

3 years ago

0.0.20231023

2 years ago

0.0.20231022

2 years ago

0.0.20231101

2 years ago

0.0.20231024

2 years ago

0.0.20230730

3 years ago

0.0.20230917

3 years ago

0.0.20230719

3 years ago

0.0.20230717

3 years ago

0.0.20230718

3 years ago

0.0.20230919

3 years ago

0.0.20231128

2 years ago

0.0.20230711

3 years ago

0.0.20230910

3 years ago

0.0.20230712

3 years ago

0.0.20231009

2 years ago

0.0.20230710

3 years ago

0.0.20230913

3 years ago

0.0.20230716

3 years ago

0.0.20230911

3 years ago

0.0.20230912

3 years ago

0.0.20231011

2 years ago

0.0.20231015

2 years ago

0.0.20230708

3 years ago

0.0.20230907

3 years ago

0.0.20230904

3 years ago

0.0.20230905

3 years ago

0.0.20230822

3 years ago

0.0.20230704

3 years ago

0.0.20230627

3 years ago

0.0.20230705

3 years ago

0.0.20230628

3 years ago

0.0.20230823

3 years ago

0.0.20231001

2 years ago

0.0.20231003

2 years ago

0.0.20231002

2 years ago

0.0.20230626

3 years ago