[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\CivicInfo\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\CivicInfo\RepresentativeInfoData;
|
---|
| 21 | use Google\Service\CivicInfo\RepresentativeInfoResponse;
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * The "representatives" collection of methods.
|
---|
| 25 | * Typical usage is:
|
---|
| 26 | * <code>
|
---|
| 27 | * $civicinfoService = new Google\Service\CivicInfo(...);
|
---|
| 28 | * $representatives = $civicinfoService->representatives;
|
---|
| 29 | * </code>
|
---|
| 30 | */
|
---|
| 31 | class Representatives extends \Google\Service\Resource
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * Looks up political geography and representative information for a single
|
---|
| 35 | * address. (representatives.representativeInfoByAddress)
|
---|
| 36 | *
|
---|
| 37 | * @param array $optParams Optional parameters.
|
---|
| 38 | *
|
---|
| 39 | * @opt_param string address The address to look up. May only be specified if
|
---|
| 40 | * the field ocdId is not given in the URL
|
---|
| 41 | * @opt_param bool includeOffices Whether to return information about offices
|
---|
| 42 | * and officials. If false, only the top-level district information will be
|
---|
| 43 | * returned.
|
---|
| 44 | * @opt_param string levels A list of office levels to filter by. Only offices
|
---|
| 45 | * that serve at least one of these levels will be returned. Divisions that
|
---|
| 46 | * don't contain a matching office will not be returned.
|
---|
| 47 | * @opt_param string roles A list of office roles to filter by. Only offices
|
---|
| 48 | * fulfilling one of these roles will be returned. Divisions that don't contain
|
---|
| 49 | * a matching office will not be returned.
|
---|
| 50 | * @return RepresentativeInfoResponse
|
---|
| 51 | * @throws \Google\Service\Exception
|
---|
| 52 | */
|
---|
| 53 | public function representativeInfoByAddress($optParams = [])
|
---|
| 54 | {
|
---|
| 55 | $params = [];
|
---|
| 56 | $params = array_merge($params, $optParams);
|
---|
| 57 | return $this->call('representativeInfoByAddress', [$params], RepresentativeInfoResponse::class);
|
---|
| 58 | }
|
---|
| 59 | /**
|
---|
| 60 | * Looks up representative information for a single geographic division.
|
---|
| 61 | * (representatives.representativeInfoByDivision)
|
---|
| 62 | *
|
---|
| 63 | * @param string $ocdId The Open Civic Data division identifier of the division
|
---|
| 64 | * to look up.
|
---|
| 65 | * @param array $optParams Optional parameters.
|
---|
| 66 | *
|
---|
| 67 | * @opt_param string levels A list of office levels to filter by. Only offices
|
---|
| 68 | * that serve at least one of these levels will be returned. Divisions that
|
---|
| 69 | * don't contain a matching office will not be returned.
|
---|
| 70 | * @opt_param bool recursive If true, information about all divisions contained
|
---|
| 71 | * in the division requested will be included as well. For example, if querying
|
---|
| 72 | * ocd-division/country:us/district:dc, this would also return all DC's wards
|
---|
| 73 | * and ANCs.
|
---|
| 74 | * @opt_param string roles A list of office roles to filter by. Only offices
|
---|
| 75 | * fulfilling one of these roles will be returned. Divisions that don't contain
|
---|
| 76 | * a matching office will not be returned.
|
---|
| 77 | * @return RepresentativeInfoData
|
---|
| 78 | * @throws \Google\Service\Exception
|
---|
| 79 | */
|
---|
| 80 | public function representativeInfoByDivision($ocdId, $optParams = [])
|
---|
| 81 | {
|
---|
| 82 | $params = ['ocdId' => $ocdId];
|
---|
| 83 | $params = array_merge($params, $optParams);
|
---|
| 84 | return $this->call('representativeInfoByDivision', [$params], RepresentativeInfoData::class);
|
---|
| 85 | }
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 89 | class_alias(Representatives::class, 'Google_Service_CivicInfo_Resource_Representatives');
|
---|