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\MyBusinessBusinessInformation\Resource;
19
20use Google\Service\MyBusinessBusinessInformation\AssociateLocationRequest;
21use Google\Service\MyBusinessBusinessInformation\Attributes as AttributesModel;
22use Google\Service\MyBusinessBusinessInformation\ClearLocationAssociationRequest;
23use Google\Service\MyBusinessBusinessInformation\GoogleUpdatedLocation;
24use Google\Service\MyBusinessBusinessInformation\Location;
25use Google\Service\MyBusinessBusinessInformation\MybusinessbusinessinformationEmpty;
26
27/**
28 * The "locations" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $mybusinessbusinessinformationService = new Google\Service\MyBusinessBusinessInformation(...);
32 *   $locations = $mybusinessbusinessinformationService->locations;
33 *  </code>
34 */
35class Locations extends \Google\Service\Resource
36{
37  /**
38   * Associates a location to a place ID. Any previous association is overwritten.
39   * This operation is only valid if the location is unverified. The association
40   * must be valid, that is, it appears in the list of `SearchGoogleLocations`.
41   * (locations.associate)
42   *
43   * @param string $name Required. The resource name of the location to associate.
44   * @param AssociateLocationRequest $postBody
45   * @param array $optParams Optional parameters.
46   * @return MybusinessbusinessinformationEmpty
47   */
48  public function associate($name, AssociateLocationRequest $postBody, $optParams = [])
49  {
50    $params = ['name' => $name, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('associate', [$params], MybusinessbusinessinformationEmpty::class);
53  }
54  /**
55   * Clears an association between a location and its place ID. This operation is
56   * only valid if the location is unverified.
57   * (locations.clearLocationAssociation)
58   *
59   * @param string $name Required. The resource name of the location to
60   * disassociate.
61   * @param ClearLocationAssociationRequest $postBody
62   * @param array $optParams Optional parameters.
63   * @return MybusinessbusinessinformationEmpty
64   */
65  public function clearLocationAssociation($name, ClearLocationAssociationRequest $postBody, $optParams = [])
66  {
67    $params = ['name' => $name, 'postBody' => $postBody];
68    $params = array_merge($params, $optParams);
69    return $this->call('clearLocationAssociation', [$params], MybusinessbusinessinformationEmpty::class);
70  }
71  /**
72   * Deletes a location. If this location cannot be deleted using the API and it
73   * is marked so in the `google.mybusiness.businessinformation.v1.LocationState`,
74   * use the [Google Business Profile](https://business.google.com/manage/)
75   * website. (locations.delete)
76   *
77   * @param string $name Required. The name of the location to delete.
78   * @param array $optParams Optional parameters.
79   * @return MybusinessbusinessinformationEmpty
80   */
81  public function delete($name, $optParams = [])
82  {
83    $params = ['name' => $name];
84    $params = array_merge($params, $optParams);
85    return $this->call('delete', [$params], MybusinessbusinessinformationEmpty::class);
86  }
87  /**
88   * Returns the specified location. (locations.get)
89   *
90   * @param string $name Required. The name of the location to fetch.
91   * @param array $optParams Optional parameters.
92   *
93   * @opt_param string readMask Required. Read mask to specify what fields will be
94   * returned in the response.
95   * @return Location
96   */
97  public function get($name, $optParams = [])
98  {
99    $params = ['name' => $name];
100    $params = array_merge($params, $optParams);
101    return $this->call('get', [$params], Location::class);
102  }
103  /**
104   * Looks up all the attributes set for a given location.
105   * (locations.getAttributes)
106   *
107   * @param string $name Required. Google identifier for this location in the form
108   * of `locations/{location_id}/attributes`.
109   * @param array $optParams Optional parameters.
110   * @return Attributes
111   */
112  public function getAttributes($name, $optParams = [])
113  {
114    $params = ['name' => $name];
115    $params = array_merge($params, $optParams);
116    return $this->call('getAttributes', [$params], AttributesModel::class);
117  }
118  /**
119   * Gets the Google-updated version of the specified location.
120   * (locations.getGoogleUpdated)
121   *
122   * @param string $name Required. The name of the location to fetch.
123   * @param array $optParams Optional parameters.
124   *
125   * @opt_param string readMask Required. Read mask to specify what fields will be
126   * returned in the response.
127   * @return GoogleUpdatedLocation
128   */
129  public function getGoogleUpdated($name, $optParams = [])
130  {
131    $params = ['name' => $name];
132    $params = array_merge($params, $optParams);
133    return $this->call('getGoogleUpdated', [$params], GoogleUpdatedLocation::class);
134  }
135  /**
136   * Updates the specified location. (locations.patch)
137   *
138   * @param string $name Google identifier for this location in the form:
139   * `locations/{location_id}`.
140   * @param Location $postBody
141   * @param array $optParams Optional parameters.
142   *
143   * @opt_param string updateMask Required. The specific fields to update.
144   * @opt_param bool validateOnly Optional. If true, the request is validated
145   * without actually updating the location. When this field is set, we will only
146   * return validation errors if there were any. The response will be empty if no
147   * errors were found.
148   * @return Location
149   */
150  public function patch($name, Location $postBody, $optParams = [])
151  {
152    $params = ['name' => $name, 'postBody' => $postBody];
153    $params = array_merge($params, $optParams);
154    return $this->call('patch', [$params], Location::class);
155  }
156  /**
157   * Update attributes for a given location. (locations.updateAttributes)
158   *
159   * @param string $name Required. Google identifier for this location in the form
160   * of `locations/{location_id}/attributes`.
161   * @param AttributesModel $postBody
162   * @param array $optParams Optional parameters.
163   *
164   * @opt_param string attributeMask Required. Attribute name of attributes that
165   * you'd like to update. Represented by `attributes/{attribute}`. Updates: All
166   * attributes provided in the attributes field that you would like to update
167   * must be set in the `attribute_mask`. Attributes set in the above list but not
168   * in the `attribute_mask` will be ignored. Deletes: If you'd like to delete
169   * certain attributes, they must be specified in the `attribute_mask` with no
170   * matching entry in the attributes list. If you'd like to delete all attributes
171   * set on a location, you should look up all the applicable attributes for the
172   * location and then add them to the `attribute_mask` with an empty attributes
173   * field.
174   * @return AttributesModel
175   */
176  public function updateAttributes($name, AttributesModel $postBody, $optParams = [])
177  {
178    $params = ['name' => $name, 'postBody' => $postBody];
179    $params = array_merge($params, $optParams);
180    return $this->call('updateAttributes', [$params], AttributesModel::class);
181  }
182}
183
184// Adding a class alias for backwards compatibility with the previous class name.
185class_alias(Locations::class, 'Google_Service_MyBusinessBusinessInformation_Resource_Locations');
186