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\ListQuestionsResponse;
21use Google\Service\MyBusinessQA\MybusinessqandaEmpty;
22use Google\Service\MyBusinessQA\Question;
23
24/**
25 * The "questions" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $mybusinessqandaService = new Google\Service\MyBusinessQA(...);
29 *   $questions = $mybusinessqandaService->questions;
30 *  </code>
31 */
32class LocationsQuestions extends \Google\Service\Resource
33{
34  /**
35   * Adds a question for the specified location. (questions.create)
36   *
37   * @param string $parent Required. The name of the location to write a question
38   * for.
39   * @param Question $postBody
40   * @param array $optParams Optional parameters.
41   * @return Question
42   */
43  public function create($parent, Question $postBody, $optParams = [])
44  {
45    $params = ['parent' => $parent, 'postBody' => $postBody];
46    $params = array_merge($params, $optParams);
47    return $this->call('create', [$params], Question::class);
48  }
49  /**
50   * Deletes a specific question written by the current user. (questions.delete)
51   *
52   * @param string $name Required. The name of the question to delete.
53   * @param array $optParams Optional parameters.
54   * @return MybusinessqandaEmpty
55   */
56  public function delete($name, $optParams = [])
57  {
58    $params = ['name' => $name];
59    $params = array_merge($params, $optParams);
60    return $this->call('delete', [$params], MybusinessqandaEmpty::class);
61  }
62  /**
63   * Returns the paginated list of questions and some of its answers for a
64   * specified location. This operation is only valid if the specified location is
65   * verified. (questions.listLocationsQuestions)
66   *
67   * @param string $parent Required. The name of the location to fetch questions
68   * for.
69   * @param array $optParams Optional parameters.
70   *
71   * @opt_param int answersPerQuestion Optional. How many answers to fetch per
72   * question. The default and maximum `answers_per_question` values are 10.
73   * @opt_param string filter Optional. A filter constraining the questions to
74   * return. The only filter currently supported is "ignore_answered=true"
75   * @opt_param string orderBy Optional. The order to return the questions. Valid
76   * options include 'update_time desc' and 'upvote_count desc', which will return
77   * the questions sorted descendingly by the requested field. The default sort
78   * order is 'update_time desc'.
79   * @opt_param int pageSize Optional. How many questions to fetch per page. The
80   * default and maximum `page_size` values are 10.
81   * @opt_param string pageToken Optional. If specified, the next page of
82   * questions is retrieved.
83   * @return ListQuestionsResponse
84   */
85  public function listLocationsQuestions($parent, $optParams = [])
86  {
87    $params = ['parent' => $parent];
88    $params = array_merge($params, $optParams);
89    return $this->call('list', [$params], ListQuestionsResponse::class);
90  }
91  /**
92   * Updates a specific question written by the current user. (questions.patch)
93   *
94   * @param string $name Immutable. The unique name for the question.
95   * locations/questions This field will be ignored if set during question
96   * creation.
97   * @param Question $postBody
98   * @param array $optParams Optional parameters.
99   *
100   * @opt_param string updateMask Required. The specific fields to update. Only
101   * question text can be updated.
102   * @return Question
103   */
104  public function patch($name, Question $postBody, $optParams = [])
105  {
106    $params = ['name' => $name, 'postBody' => $postBody];
107    $params = array_merge($params, $optParams);
108    return $this->call('patch', [$params], Question::class);
109  }
110}
111
112// Adding a class alias for backwards compatibility with the previous class name.
113class_alias(LocationsQuestions::class, 'Google_Service_MyBusinessQA_Resource_LocationsQuestions');
114