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