[e3d4e0a] | 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\MyBusinessQA\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\MyBusinessQA\Answer;
|
---|
| 21 | use Google\Service\MyBusinessQA\ListAnswersResponse;
|
---|
| 22 | use Google\Service\MyBusinessQA\MybusinessqandaEmpty;
|
---|
| 23 | use Google\Service\MyBusinessQA\UpsertAnswerRequest;
|
---|
| 24 |
|
---|
| 25 | /**
|
---|
| 26 | * The "answers" collection of methods.
|
---|
| 27 | * Typical usage is:
|
---|
| 28 | * <code>
|
---|
| 29 | * $mybusinessqandaService = new Google\Service\MyBusinessQA(...);
|
---|
| 30 | * $answers = $mybusinessqandaService->locations_questions_answers;
|
---|
| 31 | * </code>
|
---|
| 32 | */
|
---|
| 33 | class LocationsQuestionsAnswers extends \Google\Service\Resource
|
---|
| 34 | {
|
---|
| 35 | /**
|
---|
| 36 | * Deletes the answer written by the current user to a question.
|
---|
| 37 | * (answers.delete)
|
---|
| 38 | *
|
---|
| 39 | * @param string $name Required. The name of the question to delete an answer
|
---|
| 40 | * for.
|
---|
| 41 | * @param array $optParams Optional parameters.
|
---|
| 42 | * @return MybusinessqandaEmpty
|
---|
| 43 | * @throws \Google\Service\Exception
|
---|
| 44 | */
|
---|
| 45 | public function delete($name, $optParams = [])
|
---|
| 46 | {
|
---|
| 47 | $params = ['name' => $name];
|
---|
| 48 | $params = array_merge($params, $optParams);
|
---|
| 49 | return $this->call('delete', [$params], MybusinessqandaEmpty::class);
|
---|
| 50 | }
|
---|
| 51 | /**
|
---|
| 52 | * Returns the paginated list of answers for a specified question.
|
---|
| 53 | * (answers.listLocationsQuestionsAnswers)
|
---|
| 54 | *
|
---|
| 55 | * @param string $parent Required. The name of the question to fetch answers
|
---|
| 56 | * for.
|
---|
| 57 | * @param array $optParams Optional parameters.
|
---|
| 58 | *
|
---|
| 59 | * @opt_param string orderBy Optional. The order to return the answers. Valid
|
---|
| 60 | * options include 'update_time desc' and 'upvote_count desc', which will return
|
---|
| 61 | * the answers sorted descendingly by the requested field. The default sort
|
---|
| 62 | * order is 'update_time desc'.
|
---|
| 63 | * @opt_param int pageSize Optional. How many answers to fetch per page. The
|
---|
| 64 | * default and maximum `page_size` values are 10.
|
---|
| 65 | * @opt_param string pageToken Optional. If specified, the next page of answers
|
---|
| 66 | * is retrieved.
|
---|
| 67 | * @return ListAnswersResponse
|
---|
| 68 | * @throws \Google\Service\Exception
|
---|
| 69 | */
|
---|
| 70 | public function listLocationsQuestionsAnswers($parent, $optParams = [])
|
---|
| 71 | {
|
---|
| 72 | $params = ['parent' => $parent];
|
---|
| 73 | $params = array_merge($params, $optParams);
|
---|
| 74 | return $this->call('list', [$params], ListAnswersResponse::class);
|
---|
| 75 | }
|
---|
| 76 | /**
|
---|
| 77 | * Creates an answer or updates the existing answer written by the user for the
|
---|
| 78 | * specified question. A user can only create one answer per question.
|
---|
| 79 | * (answers.upsert)
|
---|
| 80 | *
|
---|
| 81 | * @param string $parent Required. The name of the question to write an answer
|
---|
| 82 | * for.
|
---|
| 83 | * @param UpsertAnswerRequest $postBody
|
---|
| 84 | * @param array $optParams Optional parameters.
|
---|
| 85 | * @return Answer
|
---|
| 86 | * @throws \Google\Service\Exception
|
---|
| 87 | */
|
---|
| 88 | public function upsert($parent, UpsertAnswerRequest $postBody, $optParams = [])
|
---|
| 89 | {
|
---|
| 90 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 91 | $params = array_merge($params, $optParams);
|
---|
| 92 | return $this->call('upsert', [$params], Answer::class);
|
---|
| 93 | }
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 97 | class_alias(LocationsQuestionsAnswers::class, 'Google_Service_MyBusinessQA_Resource_LocationsQuestionsAnswers');
|
---|