0.0.20241101 • Published 8 months ago

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

Weekly downloads
-
License
MIT
Repository
github
Last release
8 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. 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.20241101

8 months ago

0.0.20241030

8 months ago

0.0.20241029

8 months ago

0.0.20241028

8 months ago

0.0.20241022

8 months ago

0.0.20241021

9 months ago

0.0.20241020

9 months ago

0.0.20241014

9 months ago

0.0.20241001

9 months ago

0.0.20241008

9 months ago

0.0.20241007

9 months ago

0.0.20241009

9 months ago

0.0.20240918

10 months ago

0.0.20240916

10 months ago

0.0.20240922

10 months ago

0.0.20240923

9 months ago

0.0.20240909

10 months ago

0.0.20240905

10 months ago

0.0.20240910

10 months ago

0.0.20240911

10 months ago

0.0.20240904

10 months ago

0.0.20240902

10 months ago

0.0.20240827

10 months ago

0.0.20240828

10 months ago

0.0.20240826

10 months ago

0.0.20240602

1 year ago

0.0.20240603

1 year ago

0.0.20240604

1 year ago

0.0.20240721

12 months ago

0.0.20240617

1 year ago

0.0.20240619

1 year ago

0.0.20240616

1 year ago

0.0.20240731

11 months ago

0.0.20240610

1 year ago

0.0.20240611

1 year ago

0.0.20240630

1 year ago

0.0.20240624

1 year ago

0.0.20240623

1 year ago

0.0.20240809

11 months ago

0.0.20240804

11 months ago

0.0.20240529

1 year ago

0.0.20240805

11 months ago

0.0.20240807

11 months ago

0.0.20240802

11 months ago

0.0.20240527

1 year ago

0.0.20240528

1 year ago

0.0.20240521

1 year ago

0.0.20240522

1 year ago

0.0.20240819

11 months ago

0.0.20240818

11 months ago

0.0.20240812

11 months ago

0.0.20240814

11 months ago

0.0.20240709

12 months ago

0.0.20240707

12 months ago

0.0.20240708

12 months ago

0.0.20240701

1 year ago

0.0.20240702

1 year ago

0.0.20240825

10 months ago

0.0.20240821

11 months ago

0.0.20240719

12 months ago

0.0.20240713

12 months ago

0.0.20240710

12 months ago

0.0.20240520

1 year ago

0.0.20240519

1 year ago

0.0.20240515

1 year ago

0.0.20240514

1 year ago

0.0.20240513

1 year ago

0.0.20240512

1 year ago

0.0.20240508

1 year ago

0.0.20240505

1 year ago

0.0.20240501

1 year ago

0.0.20240430

1 year ago

0.0.20240429

1 year ago

0.0.20240428

1 year ago

0.0.20240424

1 year ago

0.0.20240423

1 year ago

0.0.20240422

1 year ago

0.0.20240421

1 year ago

0.0.20240416

1 year ago

0.0.20240413

1 year ago

0.0.20240403

1 year ago

0.0.20240331

1 year ago

0.0.20240327

1 year ago

0.0.20240322

1 year ago

0.0.20240320

1 year ago

0.0.20240318

1 year ago

0.0.20240317

1 year ago

0.0.20240313

1 year ago

0.0.20240310

1 year ago

0.0.20240312

1 year ago

0.0.20240306

1 year ago

0.0.20240305

1 year ago

0.0.20240304

1 year ago

0.0.20240303

1 year ago

0.0.20240228

1 year ago

0.0.20240227

1 year ago

0.0.20240225

1 year ago

0.0.20240221

1 year ago

0.0.20240220

1 year ago

0.0.20240219

1 year ago

0.0.20240214

1 year ago

0.0.20240213

1 year ago

0.0.20240212

1 year ago

0.0.20240211

1 year ago

0.0.20240207

1 year ago

0.0.20240206

1 year ago

0.0.20240205

1 year ago

0.0.20240204

1 year ago

0.0.20240131

1 year ago

0.0.20240130

1 year ago

0.0.20240129

1 year ago

0.0.20240123

1 year ago

0.0.20240122

1 year ago

0.0.20240120

1 year ago

0.0.20240116

1 year ago

0.0.20240111

1 year ago

0.0.20240107

1 year 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

2 years ago

0.0.20230816

2 years ago

0.0.20231106

2 years ago

0.0.20231029

2 years ago

0.0.20231105

2 years ago

0.0.20230731

2 years ago

0.0.20230814

2 years ago

0.0.20230815

2 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

2 years ago

0.0.20230808

2 years ago

0.0.20230926

2 years ago

0.0.20230927

2 years ago

0.0.20230806

2 years ago

0.0.20230809

2 years ago

0.0.20231018

2 years ago

0.0.20230920

2 years ago

0.0.20231017

2 years ago

0.0.20230723

2 years ago

0.0.20230726

2 years ago

0.0.20230925

2 years ago

0.0.20230801

2 years ago

0.0.20230724

2 years ago

0.0.20230923

2 years ago

0.0.20230725

2 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

2 years ago

0.0.20230917

2 years ago

0.0.20230719

2 years ago

0.0.20230717

2 years ago

0.0.20230718

2 years ago

0.0.20230919

2 years ago

0.0.20231128

2 years ago

0.0.20230711

2 years ago

0.0.20230910

2 years ago

0.0.20230712

2 years ago

0.0.20231009

2 years ago

0.0.20230710

2 years ago

0.0.20230913

2 years ago

0.0.20230716

2 years ago

0.0.20230911

2 years ago

0.0.20230912

2 years ago

0.0.20231011

2 years ago

0.0.20231015

2 years ago

0.0.20230708

2 years ago

0.0.20230907

2 years ago

0.0.20230904

2 years ago

0.0.20230905

2 years ago

0.0.20230822

2 years ago

0.0.20230704

2 years ago

0.0.20230627

2 years ago

0.0.20230705

2 years ago

0.0.20230628

2 years ago

0.0.20230823

2 years ago

0.0.20231001

2 years ago

0.0.20231003

2 years ago

0.0.20231002

2 years ago

0.0.20230626

2 years ago