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\ElectionsQueryResponse;
21use Google\Service\CivicInfo\VoterInfoResponse;
22
23/**
24 * The "elections" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $civicinfoService = new Google\Service\CivicInfo(...);
28 *   $elections = $civicinfoService->elections;
29 *  </code>
30 */
31class Elections extends \Google\Service\Resource
32{
33  /**
34   * List of available elections to query. (elections.electionQuery)
35   *
36   * @param array $optParams Optional parameters.
37   * @return ElectionsQueryResponse
38   */
39  public function electionQuery($optParams = [])
40  {
41    $params = [];
42    $params = array_merge($params, $optParams);
43    return $this->call('electionQuery', [$params], ElectionsQueryResponse::class);
44  }
45  /**
46   * Looks up information relevant to a voter based on the voter's registered
47   * address. (elections.voterInfoQuery)
48   *
49   * @param string $address The registered address of the voter to look up.
50   * @param array $optParams Optional parameters.
51   *
52   * @opt_param string electionId The unique ID of the election to look up. A list
53   * of election IDs can be obtained at
54   * https://www.googleapis.com/civicinfo/{version}/elections. If no election ID
55   * is specified in the query and there is more than one election with data for
56   * the given voter, the additional elections are provided in the otherElections
57   * response field.
58   * @opt_param bool officialOnly If set to true, only data from official state
59   * sources will be returned.
60   * @opt_param bool returnAllAvailableData If set to true, the query will return
61   * the success code and include any partial information when it is unable to
62   * determine a matching address or unable to determine the election for
63   * electionId=0 queries.
64   * @return VoterInfoResponse
65   */
66  public function voterInfoQuery($address, $optParams = [])
67  {
68    $params = ['address' => $address];
69    $params = array_merge($params, $optParams);
70    return $this->call('voterInfoQuery', [$params], VoterInfoResponse::class);
71  }
72}
73
74// Adding a class alias for backwards compatibility with the previous class name.
75class_alias(Elections::class, 'Google_Service_CivicInfo_Resource_Elections');
76