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/**
19 * Service definition for CivicInfo (v2).
20 *
21 * <p>
22 * Provides polling places, early vote locations, contest data, election
23 * officials, and government representatives for U.S. residential addresses.</p>
24 *
25 * <p>
26 * For more information about this service, see the API
27 * <a href="https://developers.google.com/civic-information" target="_blank">Documentation</a>
28 * </p>
29 *
30 * @author Google, Inc.
31 */
32class Google_Service_CivicInfo extends Google_Service
33{
34
35
36  public $divisions;
37  public $elections;
38  public $representatives;
39
40  /**
41   * Constructs the internal representation of the CivicInfo service.
42   *
43   * @param Google_Client $client
44   */
45  public function __construct(Google_Client $client)
46  {
47    parent::__construct($client);
48    $this->rootUrl = 'https://www.googleapis.com/';
49    $this->servicePath = 'civicinfo/v2/';
50    $this->batchPath = 'batch/civicinfo/v2';
51    $this->version = 'v2';
52    $this->serviceName = 'civicinfo';
53
54    $this->divisions = new Google_Service_CivicInfo_Resource_Divisions(
55        $this,
56        $this->serviceName,
57        'divisions',
58        array(
59          'methods' => array(
60            'search' => array(
61              'path' => 'divisions',
62              'httpMethod' => 'GET',
63              'parameters' => array(
64                'query' => array(
65                  'location' => 'query',
66                  'type' => 'string',
67                ),
68              ),
69            ),
70          )
71        )
72    );
73    $this->elections = new Google_Service_CivicInfo_Resource_Elections(
74        $this,
75        $this->serviceName,
76        'elections',
77        array(
78          'methods' => array(
79            'electionQuery' => array(
80              'path' => 'elections',
81              'httpMethod' => 'GET',
82              'parameters' => array(),
83            ),'voterInfoQuery' => array(
84              'path' => 'voterinfo',
85              'httpMethod' => 'GET',
86              'parameters' => array(
87                'address' => array(
88                  'location' => 'query',
89                  'type' => 'string',
90                  'required' => true,
91                ),
92                'electionId' => array(
93                  'location' => 'query',
94                  'type' => 'string',
95                ),
96                'officialOnly' => array(
97                  'location' => 'query',
98                  'type' => 'boolean',
99                ),
100                'returnAllAvailableData' => array(
101                  'location' => 'query',
102                  'type' => 'boolean',
103                ),
104              ),
105            ),
106          )
107        )
108    );
109    $this->representatives = new Google_Service_CivicInfo_Resource_Representatives(
110        $this,
111        $this->serviceName,
112        'representatives',
113        array(
114          'methods' => array(
115            'representativeInfoByAddress' => array(
116              'path' => 'representatives',
117              'httpMethod' => 'GET',
118              'parameters' => array(
119                'address' => array(
120                  'location' => 'query',
121                  'type' => 'string',
122                ),
123                'includeOffices' => array(
124                  'location' => 'query',
125                  'type' => 'boolean',
126                ),
127                'levels' => array(
128                  'location' => 'query',
129                  'type' => 'string',
130                  'repeated' => true,
131                ),
132                'roles' => array(
133                  'location' => 'query',
134                  'type' => 'string',
135                  'repeated' => true,
136                ),
137              ),
138            ),'representativeInfoByDivision' => array(
139              'path' => 'representatives/{ocdId}',
140              'httpMethod' => 'GET',
141              'parameters' => array(
142                'ocdId' => array(
143                  'location' => 'path',
144                  'type' => 'string',
145                  'required' => true,
146                ),
147                'levels' => array(
148                  'location' => 'query',
149                  'type' => 'string',
150                  'repeated' => true,
151                ),
152                'recursive' => array(
153                  'location' => 'query',
154                  'type' => 'boolean',
155                ),
156                'roles' => array(
157                  'location' => 'query',
158                  'type' => 'string',
159                  'repeated' => true,
160                ),
161              ),
162            ),
163          )
164        )
165    );
166  }
167}
168