create method

Future<Case> create(
  1. Case request,
  2. String parent, {
  3. String? $fields,
})

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:

"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": [
"[email protected]", "[email protected]" ], "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()) ```

[request] - The metadata request object.

Request parameters:

[parent] - Required. The name of the parent under which the case should be
created.
Value must have pattern `^\[^/\]+/\[^/\]+$`.

[$fields] - Selector specifying which fields to include in a partial
response.

Completes with a [Case].

Completes with a [commons.ApiRequestError] if the API endpoint returned an
error.

If the used [http.Client] completes with an error when making a REST call,
this method will complete with the same error.

Implementation

async.Future<Case> create(
  Case request,
  core.String parent, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v2/' + core.Uri.encodeFull('$parent') + '/cases';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return Case.fromJson(response_ as core.Map<core.String, core.dynamic>);
}