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\CivicInfo\Resource;
19
20use Google\Service\CivicInfo\RepresentativeInfoData;
21use 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 */
31class 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   */
52  public function representativeInfoByAddress($optParams = [])
53  {
54    $params = [];
55    $params = array_merge($params, $optParams);
56    return $this->call('representativeInfoByAddress', [$params], RepresentativeInfoResponse::class);
57  }
58  /**
59   * Looks up representative information for a single geographic division.
60   * (representatives.representativeInfoByDivision)
61   *
62   * @param string $ocdId The Open Civic Data division identifier of the division
63   * to look up.
64   * @param array $optParams Optional parameters.
65   *
66   * @opt_param string levels A list of office levels to filter by. Only offices
67   * that serve at least one of these levels will be returned. Divisions that
68   * don't contain a matching office will not be returned.
69   * @opt_param bool recursive If true, information about all divisions contained
70   * in the division requested will be included as well. For example, if querying
71   * ocd-division/country:us/district:dc, this would also return all DC's wards
72   * and ANCs.
73   * @opt_param string roles A list of office roles to filter by. Only offices
74   * fulfilling one of these roles will be returned. Divisions that don't contain
75   * a matching office will not be returned.
76   * @return RepresentativeInfoData
77   */
78  public function representativeInfoByDivision($ocdId, $optParams = [])
79  {
80    $params = ['ocdId' => $ocdId];
81    $params = array_merge($params, $optParams);
82    return $this->call('representativeInfoByDivision', [$params], RepresentativeInfoData::class);
83  }
84}
85
86// Adding a class alias for backwards compatibility with the previous class name.
87class_alias(Representatives::class, 'Google_Service_CivicInfo_Resource_Representatives');
88