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