create method
Add a new comment to a case.
The comment must have the following fields set: body
. EXAMPLES: cURL:
\ --header "Authorization: Bearer $(gcloud auth print-access-token)" \
--header 'Content-Type: application/json' \ --data '{ "body": "This is a
test comment." }' \
"https://cloudsupport.googleapis.com/v2/$case/comments" ``` 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() .comments() .create(
parent="projects/some-project/cases/43595344", body={"body": "This is a
test comment."}, ) ) print(request.execute()) ```
[request] - The metadata request object.
Request parameters:
[parent] - Required. The name of the case to which the comment should be
added.
Value must have pattern `^\[^/\]+/\[^/\]+/cases/\[^/\]+$`.
[$fields] - Selector specifying which fields to include in a partial
response.
Completes with a [Comment].
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<Comment> create(
Comment 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_ = 'v2beta/' + core.Uri.encodeFull('$parent') + '/comments';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Comment.fromJson(response_ as core.Map<core.String, core.dynamic>);
}