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\MapsPlaces\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\MapsPlaces\GoogleMapsPlacesV1AutocompletePlacesRequest;
|
---|
21 | use Google\Service\MapsPlaces\GoogleMapsPlacesV1AutocompletePlacesResponse;
|
---|
22 | use Google\Service\MapsPlaces\GoogleMapsPlacesV1Place;
|
---|
23 | use Google\Service\MapsPlaces\GoogleMapsPlacesV1SearchNearbyRequest;
|
---|
24 | use Google\Service\MapsPlaces\GoogleMapsPlacesV1SearchNearbyResponse;
|
---|
25 | use Google\Service\MapsPlaces\GoogleMapsPlacesV1SearchTextRequest;
|
---|
26 | use Google\Service\MapsPlaces\GoogleMapsPlacesV1SearchTextResponse;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The "places" collection of methods.
|
---|
30 | * Typical usage is:
|
---|
31 | * <code>
|
---|
32 | * $placesService = new Google\Service\MapsPlaces(...);
|
---|
33 | * $places = $placesService->places;
|
---|
34 | * </code>
|
---|
35 | */
|
---|
36 | class Places extends \Google\Service\Resource
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Returns predictions for the given input. (places.autocomplete)
|
---|
40 | *
|
---|
41 | * @param GoogleMapsPlacesV1AutocompletePlacesRequest $postBody
|
---|
42 | * @param array $optParams Optional parameters.
|
---|
43 | * @return GoogleMapsPlacesV1AutocompletePlacesResponse
|
---|
44 | * @throws \Google\Service\Exception
|
---|
45 | */
|
---|
46 | public function autocomplete(GoogleMapsPlacesV1AutocompletePlacesRequest $postBody, $optParams = [])
|
---|
47 | {
|
---|
48 | $params = ['postBody' => $postBody];
|
---|
49 | $params = array_merge($params, $optParams);
|
---|
50 | return $this->call('autocomplete', [$params], GoogleMapsPlacesV1AutocompletePlacesResponse::class);
|
---|
51 | }
|
---|
52 | /**
|
---|
53 | * Get the details of a place based on its resource name, which is a string in
|
---|
54 | * the `places/{place_id}` format. (places.get)
|
---|
55 | *
|
---|
56 | * @param string $name Required. The resource name of a place, in the
|
---|
57 | * `places/{place_id}` format.
|
---|
58 | * @param array $optParams Optional parameters.
|
---|
59 | *
|
---|
60 | * @opt_param string languageCode Optional. Place details will be displayed with
|
---|
61 | * the preferred language if available. Current list of supported languages:
|
---|
62 | * https://developers.google.com/maps/faq#languagesupport.
|
---|
63 | * @opt_param string regionCode Optional. The Unicode country/region code (CLDR)
|
---|
64 | * of the location where the request is coming from. This parameter is used to
|
---|
65 | * display the place details, like region-specific place name, if available. The
|
---|
66 | * parameter can affect results based on applicable law. For more information,
|
---|
67 | * see https://www.unicode.org/cldr/charts/latest/supplemental/territory_languag
|
---|
68 | * e_information.html. Note that 3-digit region codes are not currently
|
---|
69 | * supported.
|
---|
70 | * @opt_param string sessionToken Optional. A string which identifies an
|
---|
71 | * Autocomplete session for billing purposes. Must be a URL and filename safe
|
---|
72 | * base64 string with at most 36 ASCII characters in length. Otherwise an
|
---|
73 | * INVALID_ARGUMENT error is returned. The session begins when the user starts
|
---|
74 | * typing a query, and concludes when they select a place and a call to Place
|
---|
75 | * Details or Address Validation is made. Each session can have multiple
|
---|
76 | * queries, followed by one Place Details or Address Validation request. The
|
---|
77 | * credentials used for each request within a session must belong to the same
|
---|
78 | * Google Cloud Console project. Once a session has concluded, the token is no
|
---|
79 | * longer valid; your app must generate a fresh token for each session. If the
|
---|
80 | * `session_token` parameter is omitted, or if you reuse a session token, the
|
---|
81 | * session is charged as if no session token was provided (each request is
|
---|
82 | * billed separately). We recommend the following guidelines: * Use session
|
---|
83 | * tokens for all Place Autocomplete calls. * Generate a fresh token for each
|
---|
84 | * session. Using a version 4 UUID is recommended. * Ensure that the credentials
|
---|
85 | * used for all Place Autocomplete, Place Details, and Address Validation
|
---|
86 | * requests within a session belong to the same Cloud Console project. * Be sure
|
---|
87 | * to pass a unique session token for each new session. Using the same token for
|
---|
88 | * more than one session will result in each request being billed individually.
|
---|
89 | * @return GoogleMapsPlacesV1Place
|
---|
90 | * @throws \Google\Service\Exception
|
---|
91 | */
|
---|
92 | public function get($name, $optParams = [])
|
---|
93 | {
|
---|
94 | $params = ['name' => $name];
|
---|
95 | $params = array_merge($params, $optParams);
|
---|
96 | return $this->call('get', [$params], GoogleMapsPlacesV1Place::class);
|
---|
97 | }
|
---|
98 | /**
|
---|
99 | * Search for places near locations. (places.searchNearby)
|
---|
100 | *
|
---|
101 | * @param GoogleMapsPlacesV1SearchNearbyRequest $postBody
|
---|
102 | * @param array $optParams Optional parameters.
|
---|
103 | * @return GoogleMapsPlacesV1SearchNearbyResponse
|
---|
104 | * @throws \Google\Service\Exception
|
---|
105 | */
|
---|
106 | public function searchNearby(GoogleMapsPlacesV1SearchNearbyRequest $postBody, $optParams = [])
|
---|
107 | {
|
---|
108 | $params = ['postBody' => $postBody];
|
---|
109 | $params = array_merge($params, $optParams);
|
---|
110 | return $this->call('searchNearby', [$params], GoogleMapsPlacesV1SearchNearbyResponse::class);
|
---|
111 | }
|
---|
112 | /**
|
---|
113 | * Text query based place search. (places.searchText)
|
---|
114 | *
|
---|
115 | * @param GoogleMapsPlacesV1SearchTextRequest $postBody
|
---|
116 | * @param array $optParams Optional parameters.
|
---|
117 | * @return GoogleMapsPlacesV1SearchTextResponse
|
---|
118 | * @throws \Google\Service\Exception
|
---|
119 | */
|
---|
120 | public function searchText(GoogleMapsPlacesV1SearchTextRequest $postBody, $optParams = [])
|
---|
121 | {
|
---|
122 | $params = ['postBody' => $postBody];
|
---|
123 | $params = array_merge($params, $optParams);
|
---|
124 | return $this->call('searchText', [$params], GoogleMapsPlacesV1SearchTextResponse::class);
|
---|
125 | }
|
---|
126 | }
|
---|
127 |
|
---|
128 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
129 | class_alias(Places::class, 'Google_Service_MapsPlaces_Resource_Places');
|
---|