1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\CloudSupport\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudSupport\Comment;
|
---|
21 | use Google\Service\CloudSupport\ListCommentsResponse;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "comments" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $cloudsupportService = new Google\Service\CloudSupport(...);
|
---|
28 | * $comments = $cloudsupportService->cases_comments;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class CasesComments extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Add a new comment to a case. The comment must have the following fields set:
|
---|
35 | * `body`. EXAMPLES: cURL: ```shell case="projects/some-project/cases/43591344"
|
---|
36 | * curl \ --request POST \ --header "Authorization: Bearer $(gcloud auth print-
|
---|
37 | * access-token)" \ --header 'Content-Type: application/json' \ --data '{
|
---|
38 | * "body": "This is a test comment." }' \
|
---|
39 | * "https://cloudsupport.googleapis.com/v2/$case/comments" ``` Python: ```python
|
---|
40 | * import googleapiclient.discovery api_version = "v2" supportApiService =
|
---|
41 | * googleapiclient.discovery.build( serviceName="cloudsupport",
|
---|
42 | * version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.co
|
---|
43 | * m/$discovery/rest?version={api_version}", ) request = (
|
---|
44 | * supportApiService.cases() .comments() .create( parent="projects/some-
|
---|
45 | * project/cases/43595344", body={"body": "This is a test comment."}, ) )
|
---|
46 | * print(request.execute()) ``` (comments.create)
|
---|
47 | *
|
---|
48 | * @param string $parent Required. The name of the case to which the comment
|
---|
49 | * should be added.
|
---|
50 | * @param Comment $postBody
|
---|
51 | * @param array $optParams Optional parameters.
|
---|
52 | * @return Comment
|
---|
53 | * @throws \Google\Service\Exception
|
---|
54 | */
|
---|
55 | public function create($parent, Comment $postBody, $optParams = [])
|
---|
56 | {
|
---|
57 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
58 | $params = array_merge($params, $optParams);
|
---|
59 | return $this->call('create', [$params], Comment::class);
|
---|
60 | }
|
---|
61 | /**
|
---|
62 | * List all the comments associated with a case. EXAMPLES: cURL: ```shell
|
---|
63 | * case="projects/some-project/cases/43595344" curl \ --header "Authorization:
|
---|
64 | * Bearer $(gcloud auth print-access-token)" \
|
---|
65 | * "https://cloudsupport.googleapis.com/v2/$case/comments" ``` Python: ```python
|
---|
66 | * import googleapiclient.discovery api_version = "v2" supportApiService =
|
---|
67 | * googleapiclient.discovery.build( serviceName="cloudsupport",
|
---|
68 | * version=api_version, discoveryServiceUrl=f"https://cloudsupport.googleapis.co
|
---|
69 | * m/$discovery/rest?version={api_version}", ) request = (
|
---|
70 | * supportApiService.cases() .comments() .list(parent="projects/some-
|
---|
71 | * project/cases/43595344") ) print(request.execute()) ```
|
---|
72 | * (comments.listCasesComments)
|
---|
73 | *
|
---|
74 | * @param string $parent Required. The name of the case for which to list
|
---|
75 | * comments.
|
---|
76 | * @param array $optParams Optional parameters.
|
---|
77 | *
|
---|
78 | * @opt_param int pageSize The maximum number of comments to fetch. Defaults to
|
---|
79 | * 10.
|
---|
80 | * @opt_param string pageToken A token identifying the page of results to
|
---|
81 | * return. If unspecified, the first page is returned.
|
---|
82 | * @return ListCommentsResponse
|
---|
83 | * @throws \Google\Service\Exception
|
---|
84 | */
|
---|
85 | public function listCasesComments($parent, $optParams = [])
|
---|
86 | {
|
---|
87 | $params = ['parent' => $parent];
|
---|
88 | $params = array_merge($params, $optParams);
|
---|
89 | return $this->call('list', [$params], ListCommentsResponse::class);
|
---|
90 | }
|
---|
91 | }
|
---|
92 |
|
---|
93 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
94 | class_alias(CasesComments::class, 'Google_Service_CloudSupport_Resource_CasesComments');
|
---|