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\ElectionsQueryResponse;
|
---|
21 | use 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 | */
|
---|
31 | class Elections extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * List of available elections to query. (elections.electionQuery)
|
---|
35 | *
|
---|
36 | * @param array $optParams Optional parameters.
|
---|
37 | *
|
---|
38 | * @opt_param bool productionDataOnly Whether to include data that has not been
|
---|
39 | * allowlisted yet
|
---|
40 | * @return ElectionsQueryResponse
|
---|
41 | * @throws \Google\Service\Exception
|
---|
42 | */
|
---|
43 | public function electionQuery($optParams = [])
|
---|
44 | {
|
---|
45 | $params = [];
|
---|
46 | $params = array_merge($params, $optParams);
|
---|
47 | return $this->call('electionQuery', [$params], ElectionsQueryResponse::class);
|
---|
48 | }
|
---|
49 | /**
|
---|
50 | * Looks up information relevant to a voter based on the voter's registered
|
---|
51 | * address. (elections.voterInfoQuery)
|
---|
52 | *
|
---|
53 | * @param array $optParams Optional parameters.
|
---|
54 | *
|
---|
55 | * @opt_param string address The registered address of the voter to look up.
|
---|
56 | * @opt_param string electionId The unique ID of the election to look up. A list
|
---|
57 | * of election IDs can be obtained at
|
---|
58 | * https://www.googleapis.com/civicinfo/{version}/elections. If no election ID
|
---|
59 | * is specified in the query and there is more than one election with data for
|
---|
60 | * the given voter, the additional elections are provided in the otherElections
|
---|
61 | * response field.
|
---|
62 | * @opt_param bool officialOnly If set to true, only data from official state
|
---|
63 | * sources will be returned.
|
---|
64 | * @opt_param bool productionDataOnly Whether to include data that has not been
|
---|
65 | * vetted yet. Should only be made available to internal IPs or trusted
|
---|
66 | * partners. This is a non-discoverable parameter in the One Platform API
|
---|
67 | * config.
|
---|
68 | * @opt_param bool returnAllAvailableData If set to true, the query will return
|
---|
69 | * the success code and include any partial information when it is unable to
|
---|
70 | * determine a matching address or unable to determine the election for
|
---|
71 | * electionId=0 queries.
|
---|
72 | * @return VoterInfoResponse
|
---|
73 | * @throws \Google\Service\Exception
|
---|
74 | */
|
---|
75 | public function voterInfoQuery($optParams = [])
|
---|
76 | {
|
---|
77 | $params = [];
|
---|
78 | $params = array_merge($params, $optParams);
|
---|
79 | return $this->call('voterInfoQuery', [$params], VoterInfoResponse::class);
|
---|
80 | }
|
---|
81 | }
|
---|
82 |
|
---|
83 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
84 | class_alias(Elections::class, 'Google_Service_CivicInfo_Resource_Elections');
|
---|