| OLD | NEW |
| (Empty) |
| 1 library googleapis.civicinfo.v1; | |
| 2 | |
| 3 import "dart:core" as core; | |
| 4 import "dart:collection" as collection; | |
| 5 import "dart:async" as async; | |
| 6 import "dart:convert" as convert; | |
| 7 | |
| 8 import "package:crypto/crypto.dart" as crypto; | |
| 9 import 'package:http/http.dart' as http; | |
| 10 import '../src/common_internal.dart' as common_internal; | |
| 11 import '../common/common.dart' as common; | |
| 12 | |
| 13 export '../common/common.dart' show ApiRequestError; | |
| 14 export '../common/common.dart' show DetailedApiRequestError; | |
| 15 | |
| 16 /** An API for accessing civic information. */ | |
| 17 class CivicinfoApi { | |
| 18 | |
| 19 final common_internal.ApiRequester _requester; | |
| 20 | |
| 21 DivisionsResourceApi get divisions => new DivisionsResourceApi(_requester); | |
| 22 ElectionsResourceApi get elections => new ElectionsResourceApi(_requester); | |
| 23 RepresentativesResourceApi get representatives => new RepresentativesResourceA
pi(_requester); | |
| 24 | |
| 25 CivicinfoApi(http.Client client, {core.String rootUrl: "https://www.googleapis
.com/", core.String servicePath: "civicinfo/v1/"}) : | |
| 26 _requester = new common_internal.ApiRequester(client, rootUrl, servicePath
); | |
| 27 } | |
| 28 | |
| 29 | |
| 30 /** Not documented yet. */ | |
| 31 class DivisionsResourceApi { | |
| 32 final common_internal.ApiRequester _requester; | |
| 33 | |
| 34 DivisionsResourceApi(common_internal.ApiRequester client) : | |
| 35 _requester = client; | |
| 36 | |
| 37 /** | |
| 38 * Searches for political divisions by their natural name or OCD ID. | |
| 39 * | |
| 40 * Request parameters: | |
| 41 * | |
| 42 * [query] - The search query. Queries can cover any parts of a OCD ID or a | |
| 43 * human readable division name. All words given in the query are treated as | |
| 44 * required patterns. In addition to that, most query operators of the Apache | |
| 45 * Lucene library are supported. See | |
| 46 * http://lucene.apache.org/core/2_9_4/queryparsersyntax.html | |
| 47 * | |
| 48 * Completes with a [DivisionSearchResponse]. | |
| 49 * | |
| 50 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
| 51 * error. | |
| 52 * | |
| 53 * If the used [http.Client] completes with an error when making a REST call, | |
| 54 * this method will complete with the same error. | |
| 55 */ | |
| 56 async.Future<DivisionSearchResponse> search({core.String query}) { | |
| 57 var _url = null; | |
| 58 var _queryParams = new core.Map(); | |
| 59 var _uploadMedia = null; | |
| 60 var _uploadOptions = null; | |
| 61 var _downloadOptions = common.DownloadOptions.Metadata; | |
| 62 var _body = null; | |
| 63 | |
| 64 if (query != null) { | |
| 65 _queryParams["query"] = [query]; | |
| 66 } | |
| 67 | |
| 68 | |
| 69 _url = 'representatives/division_search'; | |
| 70 | |
| 71 var _response = _requester.request(_url, | |
| 72 "GET", | |
| 73 body: _body, | |
| 74 queryParams: _queryParams, | |
| 75 uploadOptions: _uploadOptions, | |
| 76 uploadMedia: _uploadMedia, | |
| 77 downloadOptions: _downloadOptions); | |
| 78 return _response.then((data) => new DivisionSearchResponse.fromJson(data)); | |
| 79 } | |
| 80 | |
| 81 } | |
| 82 | |
| 83 | |
| 84 /** Not documented yet. */ | |
| 85 class ElectionsResourceApi { | |
| 86 final common_internal.ApiRequester _requester; | |
| 87 | |
| 88 ElectionsResourceApi(common_internal.ApiRequester client) : | |
| 89 _requester = client; | |
| 90 | |
| 91 /** | |
| 92 * List of available elections to query. | |
| 93 * | |
| 94 * Request parameters: | |
| 95 * | |
| 96 * Completes with a [ElectionsQueryResponse]. | |
| 97 * | |
| 98 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
| 99 * error. | |
| 100 * | |
| 101 * If the used [http.Client] completes with an error when making a REST call, | |
| 102 * this method will complete with the same error. | |
| 103 */ | |
| 104 async.Future<ElectionsQueryResponse> electionQuery() { | |
| 105 var _url = null; | |
| 106 var _queryParams = new core.Map(); | |
| 107 var _uploadMedia = null; | |
| 108 var _uploadOptions = null; | |
| 109 var _downloadOptions = common.DownloadOptions.Metadata; | |
| 110 var _body = null; | |
| 111 | |
| 112 | |
| 113 | |
| 114 _url = 'elections'; | |
| 115 | |
| 116 var _response = _requester.request(_url, | |
| 117 "GET", | |
| 118 body: _body, | |
| 119 queryParams: _queryParams, | |
| 120 uploadOptions: _uploadOptions, | |
| 121 uploadMedia: _uploadMedia, | |
| 122 downloadOptions: _downloadOptions); | |
| 123 return _response.then((data) => new ElectionsQueryResponse.fromJson(data)); | |
| 124 } | |
| 125 | |
| 126 /** | |
| 127 * Looks up information relevant to a voter based on the voter's registered | |
| 128 * address. | |
| 129 * | |
| 130 * [request] - The metadata request object. | |
| 131 * | |
| 132 * Request parameters: | |
| 133 * | |
| 134 * [electionId] - The unique ID of the election to look up. A list of election | |
| 135 * IDs can be obtained at | |
| 136 * https://www.googleapis.com/civicinfo/{version}/elections | |
| 137 * | |
| 138 * [officialOnly] - If set to true, only data from official state sources will | |
| 139 * be returned. | |
| 140 * | |
| 141 * Completes with a [VoterInfoResponse]. | |
| 142 * | |
| 143 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
| 144 * error. | |
| 145 * | |
| 146 * If the used [http.Client] completes with an error when making a REST call, | |
| 147 * this method will complete with the same error. | |
| 148 */ | |
| 149 async.Future<VoterInfoResponse> voterInfoQuery(VoterInfoRequest request, core.
String electionId, {core.bool officialOnly}) { | |
| 150 var _url = null; | |
| 151 var _queryParams = new core.Map(); | |
| 152 var _uploadMedia = null; | |
| 153 var _uploadOptions = null; | |
| 154 var _downloadOptions = common.DownloadOptions.Metadata; | |
| 155 var _body = null; | |
| 156 | |
| 157 if (request != null) { | |
| 158 _body = convert.JSON.encode((request).toJson()); | |
| 159 } | |
| 160 if (electionId == null) { | |
| 161 throw new core.ArgumentError("Parameter electionId is required."); | |
| 162 } | |
| 163 if (officialOnly != null) { | |
| 164 _queryParams["officialOnly"] = ["${officialOnly}"]; | |
| 165 } | |
| 166 | |
| 167 | |
| 168 _url = 'voterinfo/' + common_internal.Escaper.ecapeVariable('$electionId') +
'/lookup'; | |
| 169 | |
| 170 var _response = _requester.request(_url, | |
| 171 "POST", | |
| 172 body: _body, | |
| 173 queryParams: _queryParams, | |
| 174 uploadOptions: _uploadOptions, | |
| 175 uploadMedia: _uploadMedia, | |
| 176 downloadOptions: _downloadOptions); | |
| 177 return _response.then((data) => new VoterInfoResponse.fromJson(data)); | |
| 178 } | |
| 179 | |
| 180 } | |
| 181 | |
| 182 | |
| 183 /** Not documented yet. */ | |
| 184 class RepresentativesResourceApi { | |
| 185 final common_internal.ApiRequester _requester; | |
| 186 | |
| 187 RepresentativesResourceApi(common_internal.ApiRequester client) : | |
| 188 _requester = client; | |
| 189 | |
| 190 /** | |
| 191 * Looks up political geography and representative information based on an | |
| 192 * address or Open Civic Data division identifier. | |
| 193 * | |
| 194 * [request] - The metadata request object. | |
| 195 * | |
| 196 * Request parameters: | |
| 197 * | |
| 198 * [includeOffices] - Whether to return information about offices and | |
| 199 * officials. If false, only the top-level district information will be | |
| 200 * returned. | |
| 201 * | |
| 202 * [ocdId] - The division to look up. May only be specified if the address | |
| 203 * field is not given in the request body. | |
| 204 * | |
| 205 * [recursive] - When ocd_id is supplied, return all divisions which are | |
| 206 * hierarchically nested within the queried division. For example, if querying | |
| 207 * ocd-division/country:us/district:dc, this would also return all DC's wards | |
| 208 * and ANCs. | |
| 209 * | |
| 210 * Completes with a [RepresentativeInfoResponse]. | |
| 211 * | |
| 212 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
| 213 * error. | |
| 214 * | |
| 215 * If the used [http.Client] completes with an error when making a REST call, | |
| 216 * this method will complete with the same error. | |
| 217 */ | |
| 218 async.Future<RepresentativeInfoResponse> representativeInfoQuery(Representativ
eInfoRequest request, {core.bool includeOffices, core.String ocdId, core.bool re
cursive}) { | |
| 219 var _url = null; | |
| 220 var _queryParams = new core.Map(); | |
| 221 var _uploadMedia = null; | |
| 222 var _uploadOptions = null; | |
| 223 var _downloadOptions = common.DownloadOptions.Metadata; | |
| 224 var _body = null; | |
| 225 | |
| 226 if (request != null) { | |
| 227 _body = convert.JSON.encode((request).toJson()); | |
| 228 } | |
| 229 if (includeOffices != null) { | |
| 230 _queryParams["includeOffices"] = ["${includeOffices}"]; | |
| 231 } | |
| 232 if (ocdId != null) { | |
| 233 _queryParams["ocdId"] = [ocdId]; | |
| 234 } | |
| 235 if (recursive != null) { | |
| 236 _queryParams["recursive"] = ["${recursive}"]; | |
| 237 } | |
| 238 | |
| 239 | |
| 240 _url = 'representatives/lookup'; | |
| 241 | |
| 242 var _response = _requester.request(_url, | |
| 243 "POST", | |
| 244 body: _body, | |
| 245 queryParams: _queryParams, | |
| 246 uploadOptions: _uploadOptions, | |
| 247 uploadMedia: _uploadMedia, | |
| 248 downloadOptions: _downloadOptions); | |
| 249 return _response.then((data) => new RepresentativeInfoResponse.fromJson(data
)); | |
| 250 } | |
| 251 | |
| 252 } | |
| 253 | |
| 254 | |
| 255 | |
| 256 /** Describes information about a regional election administrative area. */ | |
| 257 class AdministrationRegion { | |
| 258 /** The election administration body for this area. */ | |
| 259 AdministrativeBody electionAdministrationBody; | |
| 260 | |
| 261 /** | |
| 262 * An ID for this object. IDs may change in future requests and should not be | |
| 263 * cached. Access to this field requires special access that can be requested | |
| 264 * from the Request more link on the Quotas page. | |
| 265 */ | |
| 266 core.String id; | |
| 267 | |
| 268 /** | |
| 269 * The city or county that provides election information for this voter. This | |
| 270 * object can have the same elements as state. | |
| 271 */ | |
| 272 AdministrationRegion localJurisdiction; | |
| 273 | |
| 274 /** The name of the jurisdiction. */ | |
| 275 core.String name; | |
| 276 | |
| 277 /** | |
| 278 * A list of sources for this area. If multiple sources are listed the data | |
| 279 * has been aggregated from those sources. | |
| 280 */ | |
| 281 core.List<Source> sources; | |
| 282 | |
| 283 | |
| 284 AdministrationRegion(); | |
| 285 | |
| 286 AdministrationRegion.fromJson(core.Map _json) { | |
| 287 if (_json.containsKey("electionAdministrationBody")) { | |
| 288 electionAdministrationBody = new AdministrativeBody.fromJson(_json["electi
onAdministrationBody"]); | |
| 289 } | |
| 290 if (_json.containsKey("id")) { | |
| 291 id = _json["id"]; | |
| 292 } | |
| 293 if (_json.containsKey("local_jurisdiction")) { | |
| 294 localJurisdiction = new AdministrationRegion.fromJson(_json["local_jurisdi
ction"]); | |
| 295 } | |
| 296 if (_json.containsKey("name")) { | |
| 297 name = _json["name"]; | |
| 298 } | |
| 299 if (_json.containsKey("sources")) { | |
| 300 sources = _json["sources"].map((value) => new Source.fromJson(value)).toLi
st(); | |
| 301 } | |
| 302 } | |
| 303 | |
| 304 core.Map toJson() { | |
| 305 var _json = new core.Map(); | |
| 306 if (electionAdministrationBody != null) { | |
| 307 _json["electionAdministrationBody"] = (electionAdministrationBody).toJson(
); | |
| 308 } | |
| 309 if (id != null) { | |
| 310 _json["id"] = id; | |
| 311 } | |
| 312 if (localJurisdiction != null) { | |
| 313 _json["local_jurisdiction"] = (localJurisdiction).toJson(); | |
| 314 } | |
| 315 if (name != null) { | |
| 316 _json["name"] = name; | |
| 317 } | |
| 318 if (sources != null) { | |
| 319 _json["sources"] = sources.map((value) => (value).toJson()).toList(); | |
| 320 } | |
| 321 return _json; | |
| 322 } | |
| 323 } | |
| 324 | |
| 325 | |
| 326 /** | |
| 327 * Information about an election administrative body (e.g. County Board of | |
| 328 * Elections). | |
| 329 */ | |
| 330 class AdministrativeBody { | |
| 331 /** | |
| 332 * A URL provided by this administrative body for information on absentee | |
| 333 * voting. | |
| 334 */ | |
| 335 core.String absenteeVotingInfoUrl; | |
| 336 | |
| 337 /** | |
| 338 * A URL provided by this administrative body to give contest information to | |
| 339 * the voter. | |
| 340 */ | |
| 341 core.String ballotInfoUrl; | |
| 342 | |
| 343 /** The mailing address of this administrative body. */ | |
| 344 SimpleAddressType correspondenceAddress; | |
| 345 | |
| 346 /** | |
| 347 * A URL provided by this administrative body for looking up general election | |
| 348 * information. | |
| 349 */ | |
| 350 core.String electionInfoUrl; | |
| 351 | |
| 352 /** The election officials for this election administrative body. */ | |
| 353 core.List<ElectionOfficial> electionOfficials; | |
| 354 | |
| 355 /** | |
| 356 * A URL provided by this administrative body for confirming that the voter is | |
| 357 * registered to vote. | |
| 358 */ | |
| 359 core.String electionRegistrationConfirmationUrl; | |
| 360 | |
| 361 /** | |
| 362 * A URL provided by this administrative body for looking up how to register | |
| 363 * to vote. | |
| 364 */ | |
| 365 core.String electionRegistrationUrl; | |
| 366 | |
| 367 /** | |
| 368 * A URL provided by this administrative body describing election rules to the | |
| 369 * voter. | |
| 370 */ | |
| 371 core.String electionRulesUrl; | |
| 372 | |
| 373 /** A description of the hours of operation for this administrative body. */ | |
| 374 core.String hoursOfOperation; | |
| 375 | |
| 376 /** The name of this election administrative body. */ | |
| 377 core.String name; | |
| 378 | |
| 379 /** The physical address of this administrative body. */ | |
| 380 SimpleAddressType physicalAddress; | |
| 381 | |
| 382 /** A description of the services this administrative body may provide. */ | |
| 383 core.List<core.String> voterServices; | |
| 384 | |
| 385 /** | |
| 386 * A URL provided by this administrative body for looking up where to vote. | |
| 387 */ | |
| 388 core.String votingLocationFinderUrl; | |
| 389 | |
| 390 | |
| 391 AdministrativeBody(); | |
| 392 | |
| 393 AdministrativeBody.fromJson(core.Map _json) { | |
| 394 if (_json.containsKey("absenteeVotingInfoUrl")) { | |
| 395 absenteeVotingInfoUrl = _json["absenteeVotingInfoUrl"]; | |
| 396 } | |
| 397 if (_json.containsKey("ballotInfoUrl")) { | |
| 398 ballotInfoUrl = _json["ballotInfoUrl"]; | |
| 399 } | |
| 400 if (_json.containsKey("correspondenceAddress")) { | |
| 401 correspondenceAddress = new SimpleAddressType.fromJson(_json["corresponden
ceAddress"]); | |
| 402 } | |
| 403 if (_json.containsKey("electionInfoUrl")) { | |
| 404 electionInfoUrl = _json["electionInfoUrl"]; | |
| 405 } | |
| 406 if (_json.containsKey("electionOfficials")) { | |
| 407 electionOfficials = _json["electionOfficials"].map((value) => new Election
Official.fromJson(value)).toList(); | |
| 408 } | |
| 409 if (_json.containsKey("electionRegistrationConfirmationUrl")) { | |
| 410 electionRegistrationConfirmationUrl = _json["electionRegistrationConfirmat
ionUrl"]; | |
| 411 } | |
| 412 if (_json.containsKey("electionRegistrationUrl")) { | |
| 413 electionRegistrationUrl = _json["electionRegistrationUrl"]; | |
| 414 } | |
| 415 if (_json.containsKey("electionRulesUrl")) { | |
| 416 electionRulesUrl = _json["electionRulesUrl"]; | |
| 417 } | |
| 418 if (_json.containsKey("hoursOfOperation")) { | |
| 419 hoursOfOperation = _json["hoursOfOperation"]; | |
| 420 } | |
| 421 if (_json.containsKey("name")) { | |
| 422 name = _json["name"]; | |
| 423 } | |
| 424 if (_json.containsKey("physicalAddress")) { | |
| 425 physicalAddress = new SimpleAddressType.fromJson(_json["physicalAddress"])
; | |
| 426 } | |
| 427 if (_json.containsKey("voter_services")) { | |
| 428 voterServices = _json["voter_services"]; | |
| 429 } | |
| 430 if (_json.containsKey("votingLocationFinderUrl")) { | |
| 431 votingLocationFinderUrl = _json["votingLocationFinderUrl"]; | |
| 432 } | |
| 433 } | |
| 434 | |
| 435 core.Map toJson() { | |
| 436 var _json = new core.Map(); | |
| 437 if (absenteeVotingInfoUrl != null) { | |
| 438 _json["absenteeVotingInfoUrl"] = absenteeVotingInfoUrl; | |
| 439 } | |
| 440 if (ballotInfoUrl != null) { | |
| 441 _json["ballotInfoUrl"] = ballotInfoUrl; | |
| 442 } | |
| 443 if (correspondenceAddress != null) { | |
| 444 _json["correspondenceAddress"] = (correspondenceAddress).toJson(); | |
| 445 } | |
| 446 if (electionInfoUrl != null) { | |
| 447 _json["electionInfoUrl"] = electionInfoUrl; | |
| 448 } | |
| 449 if (electionOfficials != null) { | |
| 450 _json["electionOfficials"] = electionOfficials.map((value) => (value).toJs
on()).toList(); | |
| 451 } | |
| 452 if (electionRegistrationConfirmationUrl != null) { | |
| 453 _json["electionRegistrationConfirmationUrl"] = electionRegistrationConfirm
ationUrl; | |
| 454 } | |
| 455 if (electionRegistrationUrl != null) { | |
| 456 _json["electionRegistrationUrl"] = electionRegistrationUrl; | |
| 457 } | |
| 458 if (electionRulesUrl != null) { | |
| 459 _json["electionRulesUrl"] = electionRulesUrl; | |
| 460 } | |
| 461 if (hoursOfOperation != null) { | |
| 462 _json["hoursOfOperation"] = hoursOfOperation; | |
| 463 } | |
| 464 if (name != null) { | |
| 465 _json["name"] = name; | |
| 466 } | |
| 467 if (physicalAddress != null) { | |
| 468 _json["physicalAddress"] = (physicalAddress).toJson(); | |
| 469 } | |
| 470 if (voterServices != null) { | |
| 471 _json["voter_services"] = voterServices; | |
| 472 } | |
| 473 if (votingLocationFinderUrl != null) { | |
| 474 _json["votingLocationFinderUrl"] = votingLocationFinderUrl; | |
| 475 } | |
| 476 return _json; | |
| 477 } | |
| 478 } | |
| 479 | |
| 480 | |
| 481 /** Information about a candidate running for elected office. */ | |
| 482 class Candidate { | |
| 483 /** The URL for the candidate's campaign web site. */ | |
| 484 core.String candidateUrl; | |
| 485 | |
| 486 /** A list of known (social) media channels for this candidate. */ | |
| 487 core.List<Channel> channels; | |
| 488 | |
| 489 /** The email address for the candidate's campaign. */ | |
| 490 core.String email; | |
| 491 | |
| 492 /** The candidate's name. */ | |
| 493 core.String name; | |
| 494 | |
| 495 /** The order the candidate appears on the ballot for this contest. */ | |
| 496 core.String orderOnBallot; | |
| 497 | |
| 498 /** The full name of the party the candidate is a member of. */ | |
| 499 core.String party; | |
| 500 | |
| 501 /** The voice phone number for the candidate's campaign office. */ | |
| 502 core.String phone; | |
| 503 | |
| 504 /** A URL for a photo of the candidate. */ | |
| 505 core.String photoUrl; | |
| 506 | |
| 507 | |
| 508 Candidate(); | |
| 509 | |
| 510 Candidate.fromJson(core.Map _json) { | |
| 511 if (_json.containsKey("candidateUrl")) { | |
| 512 candidateUrl = _json["candidateUrl"]; | |
| 513 } | |
| 514 if (_json.containsKey("channels")) { | |
| 515 channels = _json["channels"].map((value) => new Channel.fromJson(value)).t
oList(); | |
| 516 } | |
| 517 if (_json.containsKey("email")) { | |
| 518 email = _json["email"]; | |
| 519 } | |
| 520 if (_json.containsKey("name")) { | |
| 521 name = _json["name"]; | |
| 522 } | |
| 523 if (_json.containsKey("orderOnBallot")) { | |
| 524 orderOnBallot = _json["orderOnBallot"]; | |
| 525 } | |
| 526 if (_json.containsKey("party")) { | |
| 527 party = _json["party"]; | |
| 528 } | |
| 529 if (_json.containsKey("phone")) { | |
| 530 phone = _json["phone"]; | |
| 531 } | |
| 532 if (_json.containsKey("photoUrl")) { | |
| 533 photoUrl = _json["photoUrl"]; | |
| 534 } | |
| 535 } | |
| 536 | |
| 537 core.Map toJson() { | |
| 538 var _json = new core.Map(); | |
| 539 if (candidateUrl != null) { | |
| 540 _json["candidateUrl"] = candidateUrl; | |
| 541 } | |
| 542 if (channels != null) { | |
| 543 _json["channels"] = channels.map((value) => (value).toJson()).toList(); | |
| 544 } | |
| 545 if (email != null) { | |
| 546 _json["email"] = email; | |
| 547 } | |
| 548 if (name != null) { | |
| 549 _json["name"] = name; | |
| 550 } | |
| 551 if (orderOnBallot != null) { | |
| 552 _json["orderOnBallot"] = orderOnBallot; | |
| 553 } | |
| 554 if (party != null) { | |
| 555 _json["party"] = party; | |
| 556 } | |
| 557 if (phone != null) { | |
| 558 _json["phone"] = phone; | |
| 559 } | |
| 560 if (photoUrl != null) { | |
| 561 _json["photoUrl"] = photoUrl; | |
| 562 } | |
| 563 return _json; | |
| 564 } | |
| 565 } | |
| 566 | |
| 567 | |
| 568 /** A social media or web channel for a candidate. */ | |
| 569 class Channel { | |
| 570 /** The unique public identifier for the candidate's channel. */ | |
| 571 core.String id; | |
| 572 | |
| 573 /** | |
| 574 * The type of channel. The following is a list of types of channels, but is | |
| 575 * not exhaustive. More channel types may be added at a later time. One of: | |
| 576 * GooglePlus, YouTube, Facebook, Twitter | |
| 577 */ | |
| 578 core.String type; | |
| 579 | |
| 580 | |
| 581 Channel(); | |
| 582 | |
| 583 Channel.fromJson(core.Map _json) { | |
| 584 if (_json.containsKey("id")) { | |
| 585 id = _json["id"]; | |
| 586 } | |
| 587 if (_json.containsKey("type")) { | |
| 588 type = _json["type"]; | |
| 589 } | |
| 590 } | |
| 591 | |
| 592 core.Map toJson() { | |
| 593 var _json = new core.Map(); | |
| 594 if (id != null) { | |
| 595 _json["id"] = id; | |
| 596 } | |
| 597 if (type != null) { | |
| 598 _json["type"] = type; | |
| 599 } | |
| 600 return _json; | |
| 601 } | |
| 602 } | |
| 603 | |
| 604 | |
| 605 /** Information about a contest that appears on a voter's ballot. */ | |
| 606 class Contest { | |
| 607 /** | |
| 608 * A number specifying the position of this contest on the voter's ballot. | |
| 609 */ | |
| 610 core.String ballotPlacement; | |
| 611 | |
| 612 /** The candidate choices for this contest. */ | |
| 613 core.List<Candidate> candidates; | |
| 614 | |
| 615 /** Information about the electoral district that this contest is in. */ | |
| 616 ElectoralDistrict district; | |
| 617 | |
| 618 /** | |
| 619 * A description of any additional eligibility requirements for voting in this | |
| 620 * contest. | |
| 621 */ | |
| 622 core.String electorateSpecifications; | |
| 623 | |
| 624 /** | |
| 625 * An ID for this object. IDs may change in future requests and should not be | |
| 626 * cached. Access to this field requires special access that can be requested | |
| 627 * from the Request more link on the Quotas page. | |
| 628 */ | |
| 629 core.String id; | |
| 630 | |
| 631 /** | |
| 632 * The level of office for this contest. One of: federal, state, county, city, | |
| 633 * other | |
| 634 */ | |
| 635 core.String level; | |
| 636 | |
| 637 /** | |
| 638 * The number of candidates that will be elected to office in this contest. | |
| 639 */ | |
| 640 core.String numberElected; | |
| 641 | |
| 642 /** The number of candidates that a voter may vote for in this contest. */ | |
| 643 core.String numberVotingFor; | |
| 644 | |
| 645 /** The name of the office for this contest. */ | |
| 646 core.String office; | |
| 647 | |
| 648 /** If this is a partisan election, the name of the party it is for. */ | |
| 649 core.String primaryParty; | |
| 650 | |
| 651 /** | |
| 652 * A brief description of the referendum. This field is only populated for | |
| 653 * contests of type 'Referendum'. | |
| 654 */ | |
| 655 core.String referendumSubtitle; | |
| 656 | |
| 657 /** | |
| 658 * The title of the referendum (e.g. 'Proposition 42'). This field is only | |
| 659 * populated for contests of type 'Referendum'. | |
| 660 */ | |
| 661 core.String referendumTitle; | |
| 662 | |
| 663 /** | |
| 664 * A link to the referendum. This field is only populated for contests of type | |
| 665 * 'Referendum'. | |
| 666 */ | |
| 667 core.String referendumUrl; | |
| 668 | |
| 669 /** | |
| 670 * A list of sources for this contest. If multiple sources are listed, the | |
| 671 * data has been aggregated from those sources. | |
| 672 */ | |
| 673 core.List<Source> sources; | |
| 674 | |
| 675 /** | |
| 676 * "Yes" or "No" depending on whether this a contest being held outside the | |
| 677 * normal election cycle. | |
| 678 */ | |
| 679 core.String special; | |
| 680 | |
| 681 /** | |
| 682 * The type of contest. Usually this will be 'General', 'Primary', or | |
| 683 * 'Run-off' for contests with candidates. For referenda this will be | |
| 684 * 'Referendum'. | |
| 685 */ | |
| 686 core.String type; | |
| 687 | |
| 688 | |
| 689 Contest(); | |
| 690 | |
| 691 Contest.fromJson(core.Map _json) { | |
| 692 if (_json.containsKey("ballotPlacement")) { | |
| 693 ballotPlacement = _json["ballotPlacement"]; | |
| 694 } | |
| 695 if (_json.containsKey("candidates")) { | |
| 696 candidates = _json["candidates"].map((value) => new Candidate.fromJson(val
ue)).toList(); | |
| 697 } | |
| 698 if (_json.containsKey("district")) { | |
| 699 district = new ElectoralDistrict.fromJson(_json["district"]); | |
| 700 } | |
| 701 if (_json.containsKey("electorateSpecifications")) { | |
| 702 electorateSpecifications = _json["electorateSpecifications"]; | |
| 703 } | |
| 704 if (_json.containsKey("id")) { | |
| 705 id = _json["id"]; | |
| 706 } | |
| 707 if (_json.containsKey("level")) { | |
| 708 level = _json["level"]; | |
| 709 } | |
| 710 if (_json.containsKey("numberElected")) { | |
| 711 numberElected = _json["numberElected"]; | |
| 712 } | |
| 713 if (_json.containsKey("numberVotingFor")) { | |
| 714 numberVotingFor = _json["numberVotingFor"]; | |
| 715 } | |
| 716 if (_json.containsKey("office")) { | |
| 717 office = _json["office"]; | |
| 718 } | |
| 719 if (_json.containsKey("primaryParty")) { | |
| 720 primaryParty = _json["primaryParty"]; | |
| 721 } | |
| 722 if (_json.containsKey("referendumSubtitle")) { | |
| 723 referendumSubtitle = _json["referendumSubtitle"]; | |
| 724 } | |
| 725 if (_json.containsKey("referendumTitle")) { | |
| 726 referendumTitle = _json["referendumTitle"]; | |
| 727 } | |
| 728 if (_json.containsKey("referendumUrl")) { | |
| 729 referendumUrl = _json["referendumUrl"]; | |
| 730 } | |
| 731 if (_json.containsKey("sources")) { | |
| 732 sources = _json["sources"].map((value) => new Source.fromJson(value)).toLi
st(); | |
| 733 } | |
| 734 if (_json.containsKey("special")) { | |
| 735 special = _json["special"]; | |
| 736 } | |
| 737 if (_json.containsKey("type")) { | |
| 738 type = _json["type"]; | |
| 739 } | |
| 740 } | |
| 741 | |
| 742 core.Map toJson() { | |
| 743 var _json = new core.Map(); | |
| 744 if (ballotPlacement != null) { | |
| 745 _json["ballotPlacement"] = ballotPlacement; | |
| 746 } | |
| 747 if (candidates != null) { | |
| 748 _json["candidates"] = candidates.map((value) => (value).toJson()).toList()
; | |
| 749 } | |
| 750 if (district != null) { | |
| 751 _json["district"] = (district).toJson(); | |
| 752 } | |
| 753 if (electorateSpecifications != null) { | |
| 754 _json["electorateSpecifications"] = electorateSpecifications; | |
| 755 } | |
| 756 if (id != null) { | |
| 757 _json["id"] = id; | |
| 758 } | |
| 759 if (level != null) { | |
| 760 _json["level"] = level; | |
| 761 } | |
| 762 if (numberElected != null) { | |
| 763 _json["numberElected"] = numberElected; | |
| 764 } | |
| 765 if (numberVotingFor != null) { | |
| 766 _json["numberVotingFor"] = numberVotingFor; | |
| 767 } | |
| 768 if (office != null) { | |
| 769 _json["office"] = office; | |
| 770 } | |
| 771 if (primaryParty != null) { | |
| 772 _json["primaryParty"] = primaryParty; | |
| 773 } | |
| 774 if (referendumSubtitle != null) { | |
| 775 _json["referendumSubtitle"] = referendumSubtitle; | |
| 776 } | |
| 777 if (referendumTitle != null) { | |
| 778 _json["referendumTitle"] = referendumTitle; | |
| 779 } | |
| 780 if (referendumUrl != null) { | |
| 781 _json["referendumUrl"] = referendumUrl; | |
| 782 } | |
| 783 if (sources != null) { | |
| 784 _json["sources"] = sources.map((value) => (value).toJson()).toList(); | |
| 785 } | |
| 786 if (special != null) { | |
| 787 _json["special"] = special; | |
| 788 } | |
| 789 if (type != null) { | |
| 790 _json["type"] = type; | |
| 791 } | |
| 792 return _json; | |
| 793 } | |
| 794 } | |
| 795 | |
| 796 | |
| 797 /** The result of a division search query. */ | |
| 798 class DivisionSearchResponse { | |
| 799 /** | |
| 800 * Identifies what kind of resource this is. Value: the fixed string | |
| 801 * "civicinfo#divisionSearchResponse". | |
| 802 */ | |
| 803 core.String kind; | |
| 804 | |
| 805 /** Not documented yet. */ | |
| 806 core.List<DivisionSearchResult> results; | |
| 807 | |
| 808 /** | |
| 809 * The result of the request. One of: success, addressUnparseable, | |
| 810 * noAddressParameter, internalLookupFailure | |
| 811 */ | |
| 812 core.String status; | |
| 813 | |
| 814 | |
| 815 DivisionSearchResponse(); | |
| 816 | |
| 817 DivisionSearchResponse.fromJson(core.Map _json) { | |
| 818 if (_json.containsKey("kind")) { | |
| 819 kind = _json["kind"]; | |
| 820 } | |
| 821 if (_json.containsKey("results")) { | |
| 822 results = _json["results"].map((value) => new DivisionSearchResult.fromJso
n(value)).toList(); | |
| 823 } | |
| 824 if (_json.containsKey("status")) { | |
| 825 status = _json["status"]; | |
| 826 } | |
| 827 } | |
| 828 | |
| 829 core.Map toJson() { | |
| 830 var _json = new core.Map(); | |
| 831 if (kind != null) { | |
| 832 _json["kind"] = kind; | |
| 833 } | |
| 834 if (results != null) { | |
| 835 _json["results"] = results.map((value) => (value).toJson()).toList(); | |
| 836 } | |
| 837 if (status != null) { | |
| 838 _json["status"] = status; | |
| 839 } | |
| 840 return _json; | |
| 841 } | |
| 842 } | |
| 843 | |
| 844 | |
| 845 /** | |
| 846 * Represents a political geographic division that matches the requested query. | |
| 847 */ | |
| 848 class DivisionSearchResult { | |
| 849 /** | |
| 850 * Other Open Civic Data identifiers that refer to the same division -- for | |
| 851 * example, those that refer to other political divisions whose boundaries are | |
| 852 * defined to be coterminous with this one. For example, | |
| 853 * ocd-division/country:us/state:wy will include an alias of | |
| 854 * ocd-division/country:us/state:wy/cd:1, since Wyoming has only one | |
| 855 * Congressional district. | |
| 856 */ | |
| 857 core.List<core.String> aliases; | |
| 858 | |
| 859 /** The name of the division. */ | |
| 860 core.String name; | |
| 861 | |
| 862 /** The unique Open Civic Data identifier for this division. */ | |
| 863 core.String ocdId; | |
| 864 | |
| 865 | |
| 866 DivisionSearchResult(); | |
| 867 | |
| 868 DivisionSearchResult.fromJson(core.Map _json) { | |
| 869 if (_json.containsKey("aliases")) { | |
| 870 aliases = _json["aliases"]; | |
| 871 } | |
| 872 if (_json.containsKey("name")) { | |
| 873 name = _json["name"]; | |
| 874 } | |
| 875 if (_json.containsKey("ocdId")) { | |
| 876 ocdId = _json["ocdId"]; | |
| 877 } | |
| 878 } | |
| 879 | |
| 880 core.Map toJson() { | |
| 881 var _json = new core.Map(); | |
| 882 if (aliases != null) { | |
| 883 _json["aliases"] = aliases; | |
| 884 } | |
| 885 if (name != null) { | |
| 886 _json["name"] = name; | |
| 887 } | |
| 888 if (ocdId != null) { | |
| 889 _json["ocdId"] = ocdId; | |
| 890 } | |
| 891 return _json; | |
| 892 } | |
| 893 } | |
| 894 | |
| 895 | |
| 896 /** Information about the election that was queried. */ | |
| 897 class Election { | |
| 898 /** Day of the election in YYYY-MM-DD format. */ | |
| 899 core.String electionDay; | |
| 900 | |
| 901 /** The unique ID of this election. */ | |
| 902 core.String id; | |
| 903 | |
| 904 /** A displayable name for the election. */ | |
| 905 core.String name; | |
| 906 | |
| 907 | |
| 908 Election(); | |
| 909 | |
| 910 Election.fromJson(core.Map _json) { | |
| 911 if (_json.containsKey("electionDay")) { | |
| 912 electionDay = _json["electionDay"]; | |
| 913 } | |
| 914 if (_json.containsKey("id")) { | |
| 915 id = _json["id"]; | |
| 916 } | |
| 917 if (_json.containsKey("name")) { | |
| 918 name = _json["name"]; | |
| 919 } | |
| 920 } | |
| 921 | |
| 922 core.Map toJson() { | |
| 923 var _json = new core.Map(); | |
| 924 if (electionDay != null) { | |
| 925 _json["electionDay"] = electionDay; | |
| 926 } | |
| 927 if (id != null) { | |
| 928 _json["id"] = id; | |
| 929 } | |
| 930 if (name != null) { | |
| 931 _json["name"] = name; | |
| 932 } | |
| 933 return _json; | |
| 934 } | |
| 935 } | |
| 936 | |
| 937 | |
| 938 /** Information about individual election officials. */ | |
| 939 class ElectionOfficial { | |
| 940 /** The email address of the election official. */ | |
| 941 core.String emailAddress; | |
| 942 | |
| 943 /** The fax number of the election official. */ | |
| 944 core.String faxNumber; | |
| 945 | |
| 946 /** The full name of the election official. */ | |
| 947 core.String name; | |
| 948 | |
| 949 /** The office phone number of the election official. */ | |
| 950 core.String officePhoneNumber; | |
| 951 | |
| 952 /** The title of the election official. */ | |
| 953 core.String title; | |
| 954 | |
| 955 | |
| 956 ElectionOfficial(); | |
| 957 | |
| 958 ElectionOfficial.fromJson(core.Map _json) { | |
| 959 if (_json.containsKey("emailAddress")) { | |
| 960 emailAddress = _json["emailAddress"]; | |
| 961 } | |
| 962 if (_json.containsKey("faxNumber")) { | |
| 963 faxNumber = _json["faxNumber"]; | |
| 964 } | |
| 965 if (_json.containsKey("name")) { | |
| 966 name = _json["name"]; | |
| 967 } | |
| 968 if (_json.containsKey("officePhoneNumber")) { | |
| 969 officePhoneNumber = _json["officePhoneNumber"]; | |
| 970 } | |
| 971 if (_json.containsKey("title")) { | |
| 972 title = _json["title"]; | |
| 973 } | |
| 974 } | |
| 975 | |
| 976 core.Map toJson() { | |
| 977 var _json = new core.Map(); | |
| 978 if (emailAddress != null) { | |
| 979 _json["emailAddress"] = emailAddress; | |
| 980 } | |
| 981 if (faxNumber != null) { | |
| 982 _json["faxNumber"] = faxNumber; | |
| 983 } | |
| 984 if (name != null) { | |
| 985 _json["name"] = name; | |
| 986 } | |
| 987 if (officePhoneNumber != null) { | |
| 988 _json["officePhoneNumber"] = officePhoneNumber; | |
| 989 } | |
| 990 if (title != null) { | |
| 991 _json["title"] = title; | |
| 992 } | |
| 993 return _json; | |
| 994 } | |
| 995 } | |
| 996 | |
| 997 | |
| 998 /** The list of elections available for this version of the API. */ | |
| 999 class ElectionsQueryResponse { | |
| 1000 /** A list of available elections */ | |
| 1001 core.List<Election> elections; | |
| 1002 | |
| 1003 /** | |
| 1004 * Identifies what kind of resource this is. Value: the fixed string | |
| 1005 * "civicinfo#electionsQueryResponse". | |
| 1006 */ | |
| 1007 core.String kind; | |
| 1008 | |
| 1009 | |
| 1010 ElectionsQueryResponse(); | |
| 1011 | |
| 1012 ElectionsQueryResponse.fromJson(core.Map _json) { | |
| 1013 if (_json.containsKey("elections")) { | |
| 1014 elections = _json["elections"].map((value) => new Election.fromJson(value)
).toList(); | |
| 1015 } | |
| 1016 if (_json.containsKey("kind")) { | |
| 1017 kind = _json["kind"]; | |
| 1018 } | |
| 1019 } | |
| 1020 | |
| 1021 core.Map toJson() { | |
| 1022 var _json = new core.Map(); | |
| 1023 if (elections != null) { | |
| 1024 _json["elections"] = elections.map((value) => (value).toJson()).toList(); | |
| 1025 } | |
| 1026 if (kind != null) { | |
| 1027 _json["kind"] = kind; | |
| 1028 } | |
| 1029 return _json; | |
| 1030 } | |
| 1031 } | |
| 1032 | |
| 1033 | |
| 1034 /** Describes the geographic scope of a contest. */ | |
| 1035 class ElectoralDistrict { | |
| 1036 /** | |
| 1037 * An identifier for this district, relative to its scope. For example, the | |
| 1038 * 34th State Senate district would have id "34" and a scope of stateUpper. | |
| 1039 */ | |
| 1040 core.String id; | |
| 1041 | |
| 1042 /** The name of the district. */ | |
| 1043 core.String name; | |
| 1044 | |
| 1045 /** | |
| 1046 * The geographic scope of this district. If unspecified the district's | |
| 1047 * geography is not known. One of: national, statewide, congressional, | |
| 1048 * stateUpper, stateLower, countywide, judicial, schoolBoard, cityWide, | |
| 1049 * township, countyCouncil, cityCouncil, ward, special | |
| 1050 */ | |
| 1051 core.String scope; | |
| 1052 | |
| 1053 | |
| 1054 ElectoralDistrict(); | |
| 1055 | |
| 1056 ElectoralDistrict.fromJson(core.Map _json) { | |
| 1057 if (_json.containsKey("id")) { | |
| 1058 id = _json["id"]; | |
| 1059 } | |
| 1060 if (_json.containsKey("name")) { | |
| 1061 name = _json["name"]; | |
| 1062 } | |
| 1063 if (_json.containsKey("scope")) { | |
| 1064 scope = _json["scope"]; | |
| 1065 } | |
| 1066 } | |
| 1067 | |
| 1068 core.Map toJson() { | |
| 1069 var _json = new core.Map(); | |
| 1070 if (id != null) { | |
| 1071 _json["id"] = id; | |
| 1072 } | |
| 1073 if (name != null) { | |
| 1074 _json["name"] = name; | |
| 1075 } | |
| 1076 if (scope != null) { | |
| 1077 _json["scope"] = scope; | |
| 1078 } | |
| 1079 return _json; | |
| 1080 } | |
| 1081 } | |
| 1082 | |
| 1083 | |
| 1084 /** Describes a political geography. */ | |
| 1085 class GeographicDivision { | |
| 1086 /** | |
| 1087 * Any other valid OCD IDs that refer to the same division. | |
| 1088 * | |
| 1089 * Because OCD IDs are meant to be human-readable and at least somewhat | |
| 1090 * predictable, there are occasionally several identifiers for a single | |
| 1091 * division. These identifiers are defined to be equivalent to one another, | |
| 1092 * and one is always indicated as the primary identifier. The primary | |
| 1093 * identifier will be returned in ocd_id above, and any other equivalent valid | |
| 1094 * identifiers will be returned in this list. | |
| 1095 * | |
| 1096 * For example, if this division's OCD ID is | |
| 1097 * ocd-division/country:us/district:dc, this will contain | |
| 1098 * ocd-division/country:us/state:dc. | |
| 1099 */ | |
| 1100 core.List<core.String> alsoKnownAs; | |
| 1101 | |
| 1102 /** The name of the division. */ | |
| 1103 core.String name; | |
| 1104 | |
| 1105 /** | |
| 1106 * List of keys in the offices object, one for each office elected from this | |
| 1107 * division. Will only be present if includeOffices was true (or absent) in | |
| 1108 * the request. | |
| 1109 */ | |
| 1110 core.List<core.String> officeIds; | |
| 1111 | |
| 1112 /** | |
| 1113 * The geographic scope of the division. If unspecified, the division's | |
| 1114 * geography is not known. One of: national, statewide, congressional, | |
| 1115 * stateUpper, stateLower, countywide, judicial, schoolBoard, cityWide, | |
| 1116 * township, countyCouncil, cityCouncil, ward, special | |
| 1117 */ | |
| 1118 core.String scope; | |
| 1119 | |
| 1120 | |
| 1121 GeographicDivision(); | |
| 1122 | |
| 1123 GeographicDivision.fromJson(core.Map _json) { | |
| 1124 if (_json.containsKey("alsoKnownAs")) { | |
| 1125 alsoKnownAs = _json["alsoKnownAs"]; | |
| 1126 } | |
| 1127 if (_json.containsKey("name")) { | |
| 1128 name = _json["name"]; | |
| 1129 } | |
| 1130 if (_json.containsKey("officeIds")) { | |
| 1131 officeIds = _json["officeIds"]; | |
| 1132 } | |
| 1133 if (_json.containsKey("scope")) { | |
| 1134 scope = _json["scope"]; | |
| 1135 } | |
| 1136 } | |
| 1137 | |
| 1138 core.Map toJson() { | |
| 1139 var _json = new core.Map(); | |
| 1140 if (alsoKnownAs != null) { | |
| 1141 _json["alsoKnownAs"] = alsoKnownAs; | |
| 1142 } | |
| 1143 if (name != null) { | |
| 1144 _json["name"] = name; | |
| 1145 } | |
| 1146 if (officeIds != null) { | |
| 1147 _json["officeIds"] = officeIds; | |
| 1148 } | |
| 1149 if (scope != null) { | |
| 1150 _json["scope"] = scope; | |
| 1151 } | |
| 1152 return _json; | |
| 1153 } | |
| 1154 } | |
| 1155 | |
| 1156 | |
| 1157 /** Information about an Office held by one or more Officials. */ | |
| 1158 class Office { | |
| 1159 /** The OCD ID of the division with which this office is associated. */ | |
| 1160 core.String divisionId; | |
| 1161 | |
| 1162 /** | |
| 1163 * The level of this elected office. One of: federal, state, county, city, | |
| 1164 * other | |
| 1165 */ | |
| 1166 core.String level; | |
| 1167 | |
| 1168 /** The human-readable name of the office. */ | |
| 1169 core.String name; | |
| 1170 | |
| 1171 /** | |
| 1172 * List of keys in the officials object of people who presently hold this | |
| 1173 * office. | |
| 1174 */ | |
| 1175 core.List<core.String> officialIds; | |
| 1176 | |
| 1177 /** | |
| 1178 * A list of sources for this office. If multiple sources are listed, the data | |
| 1179 * has been aggregated from those sources. | |
| 1180 */ | |
| 1181 core.List<Source> sources; | |
| 1182 | |
| 1183 | |
| 1184 Office(); | |
| 1185 | |
| 1186 Office.fromJson(core.Map _json) { | |
| 1187 if (_json.containsKey("divisionId")) { | |
| 1188 divisionId = _json["divisionId"]; | |
| 1189 } | |
| 1190 if (_json.containsKey("level")) { | |
| 1191 level = _json["level"]; | |
| 1192 } | |
| 1193 if (_json.containsKey("name")) { | |
| 1194 name = _json["name"]; | |
| 1195 } | |
| 1196 if (_json.containsKey("officialIds")) { | |
| 1197 officialIds = _json["officialIds"]; | |
| 1198 } | |
| 1199 if (_json.containsKey("sources")) { | |
| 1200 sources = _json["sources"].map((value) => new Source.fromJson(value)).toLi
st(); | |
| 1201 } | |
| 1202 } | |
| 1203 | |
| 1204 core.Map toJson() { | |
| 1205 var _json = new core.Map(); | |
| 1206 if (divisionId != null) { | |
| 1207 _json["divisionId"] = divisionId; | |
| 1208 } | |
| 1209 if (level != null) { | |
| 1210 _json["level"] = level; | |
| 1211 } | |
| 1212 if (name != null) { | |
| 1213 _json["name"] = name; | |
| 1214 } | |
| 1215 if (officialIds != null) { | |
| 1216 _json["officialIds"] = officialIds; | |
| 1217 } | |
| 1218 if (sources != null) { | |
| 1219 _json["sources"] = sources.map((value) => (value).toJson()).toList(); | |
| 1220 } | |
| 1221 return _json; | |
| 1222 } | |
| 1223 } | |
| 1224 | |
| 1225 | |
| 1226 /** Information about a person holding an elected office. */ | |
| 1227 class Official { | |
| 1228 /** Addresses at which to contact the official. */ | |
| 1229 core.List<SimpleAddressType> address; | |
| 1230 | |
| 1231 /** A list of known (social) media channels for this official. */ | |
| 1232 core.List<Channel> channels; | |
| 1233 | |
| 1234 /** The direct email addresses for the official. */ | |
| 1235 core.List<core.String> emails; | |
| 1236 | |
| 1237 /** The official's name. */ | |
| 1238 core.String name; | |
| 1239 | |
| 1240 /** The full name of the party the official belongs to. */ | |
| 1241 core.String party; | |
| 1242 | |
| 1243 /** The official's public contact phone numbers. */ | |
| 1244 core.List<core.String> phones; | |
| 1245 | |
| 1246 /** A URL for a photo of the official. */ | |
| 1247 core.String photoUrl; | |
| 1248 | |
| 1249 /** The official's public website URLs. */ | |
| 1250 core.List<core.String> urls; | |
| 1251 | |
| 1252 | |
| 1253 Official(); | |
| 1254 | |
| 1255 Official.fromJson(core.Map _json) { | |
| 1256 if (_json.containsKey("address")) { | |
| 1257 address = _json["address"].map((value) => new SimpleAddressType.fromJson(v
alue)).toList(); | |
| 1258 } | |
| 1259 if (_json.containsKey("channels")) { | |
| 1260 channels = _json["channels"].map((value) => new Channel.fromJson(value)).t
oList(); | |
| 1261 } | |
| 1262 if (_json.containsKey("emails")) { | |
| 1263 emails = _json["emails"]; | |
| 1264 } | |
| 1265 if (_json.containsKey("name")) { | |
| 1266 name = _json["name"]; | |
| 1267 } | |
| 1268 if (_json.containsKey("party")) { | |
| 1269 party = _json["party"]; | |
| 1270 } | |
| 1271 if (_json.containsKey("phones")) { | |
| 1272 phones = _json["phones"]; | |
| 1273 } | |
| 1274 if (_json.containsKey("photoUrl")) { | |
| 1275 photoUrl = _json["photoUrl"]; | |
| 1276 } | |
| 1277 if (_json.containsKey("urls")) { | |
| 1278 urls = _json["urls"]; | |
| 1279 } | |
| 1280 } | |
| 1281 | |
| 1282 core.Map toJson() { | |
| 1283 var _json = new core.Map(); | |
| 1284 if (address != null) { | |
| 1285 _json["address"] = address.map((value) => (value).toJson()).toList(); | |
| 1286 } | |
| 1287 if (channels != null) { | |
| 1288 _json["channels"] = channels.map((value) => (value).toJson()).toList(); | |
| 1289 } | |
| 1290 if (emails != null) { | |
| 1291 _json["emails"] = emails; | |
| 1292 } | |
| 1293 if (name != null) { | |
| 1294 _json["name"] = name; | |
| 1295 } | |
| 1296 if (party != null) { | |
| 1297 _json["party"] = party; | |
| 1298 } | |
| 1299 if (phones != null) { | |
| 1300 _json["phones"] = phones; | |
| 1301 } | |
| 1302 if (photoUrl != null) { | |
| 1303 _json["photoUrl"] = photoUrl; | |
| 1304 } | |
| 1305 if (urls != null) { | |
| 1306 _json["urls"] = urls; | |
| 1307 } | |
| 1308 return _json; | |
| 1309 } | |
| 1310 } | |
| 1311 | |
| 1312 | |
| 1313 /** | |
| 1314 * A location where a voter can vote. This may be an early vote site, an | |
| 1315 * election day voting location, or a drop off location for a completed ballot. | |
| 1316 */ | |
| 1317 class PollingLocation { | |
| 1318 /** The address of the location. */ | |
| 1319 SimpleAddressType address; | |
| 1320 | |
| 1321 /** | |
| 1322 * The last date that this early vote site or drop off location may be used. | |
| 1323 * This field is not populated for polling locations. | |
| 1324 */ | |
| 1325 core.String endDate; | |
| 1326 | |
| 1327 /** | |
| 1328 * An ID for this object. IDs may change in future requests and should not be | |
| 1329 * cached. Access to this field requires special access that can be requested | |
| 1330 * from the Request more link on the Quotas page. | |
| 1331 */ | |
| 1332 core.String id; | |
| 1333 | |
| 1334 /** | |
| 1335 * The name of the early vote site or drop off location. This field is not | |
| 1336 * populated for polling locations. | |
| 1337 */ | |
| 1338 core.String name; | |
| 1339 | |
| 1340 /** | |
| 1341 * Notes about this location (e.g. accessibility ramp or entrance to use). | |
| 1342 */ | |
| 1343 core.String notes; | |
| 1344 | |
| 1345 /** A description of when this location is open. */ | |
| 1346 core.String pollingHours; | |
| 1347 | |
| 1348 /** | |
| 1349 * A list of sources for this location. If multiple sources are listed the | |
| 1350 * data has been aggregated from those sources. | |
| 1351 */ | |
| 1352 core.List<Source> sources; | |
| 1353 | |
| 1354 /** | |
| 1355 * The first date that this early vote site or drop off location may be used. | |
| 1356 * This field is not populated for polling locations. | |
| 1357 */ | |
| 1358 core.String startDate; | |
| 1359 | |
| 1360 /** | |
| 1361 * The services provided by this early vote site or drop off location. This | |
| 1362 * field is not populated for polling locations. | |
| 1363 */ | |
| 1364 core.String voterServices; | |
| 1365 | |
| 1366 | |
| 1367 PollingLocation(); | |
| 1368 | |
| 1369 PollingLocation.fromJson(core.Map _json) { | |
| 1370 if (_json.containsKey("address")) { | |
| 1371 address = new SimpleAddressType.fromJson(_json["address"]); | |
| 1372 } | |
| 1373 if (_json.containsKey("endDate")) { | |
| 1374 endDate = _json["endDate"]; | |
| 1375 } | |
| 1376 if (_json.containsKey("id")) { | |
| 1377 id = _json["id"]; | |
| 1378 } | |
| 1379 if (_json.containsKey("name")) { | |
| 1380 name = _json["name"]; | |
| 1381 } | |
| 1382 if (_json.containsKey("notes")) { | |
| 1383 notes = _json["notes"]; | |
| 1384 } | |
| 1385 if (_json.containsKey("pollingHours")) { | |
| 1386 pollingHours = _json["pollingHours"]; | |
| 1387 } | |
| 1388 if (_json.containsKey("sources")) { | |
| 1389 sources = _json["sources"].map((value) => new Source.fromJson(value)).toLi
st(); | |
| 1390 } | |
| 1391 if (_json.containsKey("startDate")) { | |
| 1392 startDate = _json["startDate"]; | |
| 1393 } | |
| 1394 if (_json.containsKey("voterServices")) { | |
| 1395 voterServices = _json["voterServices"]; | |
| 1396 } | |
| 1397 } | |
| 1398 | |
| 1399 core.Map toJson() { | |
| 1400 var _json = new core.Map(); | |
| 1401 if (address != null) { | |
| 1402 _json["address"] = (address).toJson(); | |
| 1403 } | |
| 1404 if (endDate != null) { | |
| 1405 _json["endDate"] = endDate; | |
| 1406 } | |
| 1407 if (id != null) { | |
| 1408 _json["id"] = id; | |
| 1409 } | |
| 1410 if (name != null) { | |
| 1411 _json["name"] = name; | |
| 1412 } | |
| 1413 if (notes != null) { | |
| 1414 _json["notes"] = notes; | |
| 1415 } | |
| 1416 if (pollingHours != null) { | |
| 1417 _json["pollingHours"] = pollingHours; | |
| 1418 } | |
| 1419 if (sources != null) { | |
| 1420 _json["sources"] = sources.map((value) => (value).toJson()).toList(); | |
| 1421 } | |
| 1422 if (startDate != null) { | |
| 1423 _json["startDate"] = startDate; | |
| 1424 } | |
| 1425 if (voterServices != null) { | |
| 1426 _json["voterServices"] = voterServices; | |
| 1427 } | |
| 1428 return _json; | |
| 1429 } | |
| 1430 } | |
| 1431 | |
| 1432 | |
| 1433 /** | |
| 1434 * A request for political geography and representative information for an | |
| 1435 * address. | |
| 1436 */ | |
| 1437 class RepresentativeInfoRequest { | |
| 1438 /** | |
| 1439 * The address to look up. May only be specified if the field ocdId is not | |
| 1440 * given in the URL. | |
| 1441 */ | |
| 1442 core.String address; | |
| 1443 | |
| 1444 | |
| 1445 RepresentativeInfoRequest(); | |
| 1446 | |
| 1447 RepresentativeInfoRequest.fromJson(core.Map _json) { | |
| 1448 if (_json.containsKey("address")) { | |
| 1449 address = _json["address"]; | |
| 1450 } | |
| 1451 } | |
| 1452 | |
| 1453 core.Map toJson() { | |
| 1454 var _json = new core.Map(); | |
| 1455 if (address != null) { | |
| 1456 _json["address"] = address; | |
| 1457 } | |
| 1458 return _json; | |
| 1459 } | |
| 1460 } | |
| 1461 | |
| 1462 | |
| 1463 /** The result of a representative info lookup query. */ | |
| 1464 class RepresentativeInfoResponse { | |
| 1465 /** Political geographic divisions that contain the requested address. */ | |
| 1466 core.Map<core.String, GeographicDivision> divisions; | |
| 1467 | |
| 1468 /** | |
| 1469 * Identifies what kind of resource this is. Value: the fixed string | |
| 1470 * "civicinfo#representativeInfoResponse". | |
| 1471 */ | |
| 1472 core.String kind; | |
| 1473 | |
| 1474 /** The normalized version of the requested address */ | |
| 1475 SimpleAddressType normalizedInput; | |
| 1476 | |
| 1477 /** | |
| 1478 * Elected offices referenced by the divisions listed above. Will only be | |
| 1479 * present if includeOffices was true in the request. | |
| 1480 */ | |
| 1481 core.Map<core.String, Office> offices; | |
| 1482 | |
| 1483 /** | |
| 1484 * Officials holding the offices listed above. Will only be present if | |
| 1485 * includeOffices was true in the request. | |
| 1486 */ | |
| 1487 core.Map<core.String, Official> officials; | |
| 1488 | |
| 1489 /** | |
| 1490 * The result of the request. One of: success, noStreetSegmentFound, | |
| 1491 * addressUnparseable, noAddressParameter, multipleStreetSegmentsFound, | |
| 1492 * electionOver, electionUnknown, internalLookupFailure, | |
| 1493 * RequestedBothAddressAndOcdId | |
| 1494 */ | |
| 1495 core.String status; | |
| 1496 | |
| 1497 | |
| 1498 RepresentativeInfoResponse(); | |
| 1499 | |
| 1500 RepresentativeInfoResponse.fromJson(core.Map _json) { | |
| 1501 if (_json.containsKey("divisions")) { | |
| 1502 divisions = common_internal.mapMap(_json["divisions"], (item) => new Geogr
aphicDivision.fromJson(item)); | |
| 1503 } | |
| 1504 if (_json.containsKey("kind")) { | |
| 1505 kind = _json["kind"]; | |
| 1506 } | |
| 1507 if (_json.containsKey("normalizedInput")) { | |
| 1508 normalizedInput = new SimpleAddressType.fromJson(_json["normalizedInput"])
; | |
| 1509 } | |
| 1510 if (_json.containsKey("offices")) { | |
| 1511 offices = common_internal.mapMap(_json["offices"], (item) => new Office.fr
omJson(item)); | |
| 1512 } | |
| 1513 if (_json.containsKey("officials")) { | |
| 1514 officials = common_internal.mapMap(_json["officials"], (item) => new Offic
ial.fromJson(item)); | |
| 1515 } | |
| 1516 if (_json.containsKey("status")) { | |
| 1517 status = _json["status"]; | |
| 1518 } | |
| 1519 } | |
| 1520 | |
| 1521 core.Map toJson() { | |
| 1522 var _json = new core.Map(); | |
| 1523 if (divisions != null) { | |
| 1524 _json["divisions"] = common_internal.mapMap(divisions, (item) => (item).to
Json()); | |
| 1525 } | |
| 1526 if (kind != null) { | |
| 1527 _json["kind"] = kind; | |
| 1528 } | |
| 1529 if (normalizedInput != null) { | |
| 1530 _json["normalizedInput"] = (normalizedInput).toJson(); | |
| 1531 } | |
| 1532 if (offices != null) { | |
| 1533 _json["offices"] = common_internal.mapMap(offices, (item) => (item).toJson
()); | |
| 1534 } | |
| 1535 if (officials != null) { | |
| 1536 _json["officials"] = common_internal.mapMap(officials, (item) => (item).to
Json()); | |
| 1537 } | |
| 1538 if (status != null) { | |
| 1539 _json["status"] = status; | |
| 1540 } | |
| 1541 return _json; | |
| 1542 } | |
| 1543 } | |
| 1544 | |
| 1545 | |
| 1546 /** A simple representation of an address. */ | |
| 1547 class SimpleAddressType { | |
| 1548 /** The city or town for the address. */ | |
| 1549 core.String city; | |
| 1550 | |
| 1551 /** The street name and number of this address. */ | |
| 1552 core.String line1; | |
| 1553 | |
| 1554 /** The second line the address, if needed. */ | |
| 1555 core.String line2; | |
| 1556 | |
| 1557 /** The third line of the address, if needed. */ | |
| 1558 core.String line3; | |
| 1559 | |
| 1560 /** The name of the location. */ | |
| 1561 core.String locationName; | |
| 1562 | |
| 1563 /** The US two letter state abbreviation of the address. */ | |
| 1564 core.String state; | |
| 1565 | |
| 1566 /** The US Postal Zip Code of the address. */ | |
| 1567 core.String zip; | |
| 1568 | |
| 1569 | |
| 1570 SimpleAddressType(); | |
| 1571 | |
| 1572 SimpleAddressType.fromJson(core.Map _json) { | |
| 1573 if (_json.containsKey("city")) { | |
| 1574 city = _json["city"]; | |
| 1575 } | |
| 1576 if (_json.containsKey("line1")) { | |
| 1577 line1 = _json["line1"]; | |
| 1578 } | |
| 1579 if (_json.containsKey("line2")) { | |
| 1580 line2 = _json["line2"]; | |
| 1581 } | |
| 1582 if (_json.containsKey("line3")) { | |
| 1583 line3 = _json["line3"]; | |
| 1584 } | |
| 1585 if (_json.containsKey("locationName")) { | |
| 1586 locationName = _json["locationName"]; | |
| 1587 } | |
| 1588 if (_json.containsKey("state")) { | |
| 1589 state = _json["state"]; | |
| 1590 } | |
| 1591 if (_json.containsKey("zip")) { | |
| 1592 zip = _json["zip"]; | |
| 1593 } | |
| 1594 } | |
| 1595 | |
| 1596 core.Map toJson() { | |
| 1597 var _json = new core.Map(); | |
| 1598 if (city != null) { | |
| 1599 _json["city"] = city; | |
| 1600 } | |
| 1601 if (line1 != null) { | |
| 1602 _json["line1"] = line1; | |
| 1603 } | |
| 1604 if (line2 != null) { | |
| 1605 _json["line2"] = line2; | |
| 1606 } | |
| 1607 if (line3 != null) { | |
| 1608 _json["line3"] = line3; | |
| 1609 } | |
| 1610 if (locationName != null) { | |
| 1611 _json["locationName"] = locationName; | |
| 1612 } | |
| 1613 if (state != null) { | |
| 1614 _json["state"] = state; | |
| 1615 } | |
| 1616 if (zip != null) { | |
| 1617 _json["zip"] = zip; | |
| 1618 } | |
| 1619 return _json; | |
| 1620 } | |
| 1621 } | |
| 1622 | |
| 1623 | |
| 1624 /** | |
| 1625 * Contains information about the data source for the element containing it. | |
| 1626 */ | |
| 1627 class Source { | |
| 1628 /** The name of the data source. */ | |
| 1629 core.String name; | |
| 1630 | |
| 1631 /** Whether this data comes from an official government source. */ | |
| 1632 core.bool official; | |
| 1633 | |
| 1634 | |
| 1635 Source(); | |
| 1636 | |
| 1637 Source.fromJson(core.Map _json) { | |
| 1638 if (_json.containsKey("name")) { | |
| 1639 name = _json["name"]; | |
| 1640 } | |
| 1641 if (_json.containsKey("official")) { | |
| 1642 official = _json["official"]; | |
| 1643 } | |
| 1644 } | |
| 1645 | |
| 1646 core.Map toJson() { | |
| 1647 var _json = new core.Map(); | |
| 1648 if (name != null) { | |
| 1649 _json["name"] = name; | |
| 1650 } | |
| 1651 if (official != null) { | |
| 1652 _json["official"] = official; | |
| 1653 } | |
| 1654 return _json; | |
| 1655 } | |
| 1656 } | |
| 1657 | |
| 1658 | |
| 1659 /** A request for information about a voter. */ | |
| 1660 class VoterInfoRequest { | |
| 1661 /** The registered address of the voter to look up. */ | |
| 1662 core.String address; | |
| 1663 | |
| 1664 | |
| 1665 VoterInfoRequest(); | |
| 1666 | |
| 1667 VoterInfoRequest.fromJson(core.Map _json) { | |
| 1668 if (_json.containsKey("address")) { | |
| 1669 address = _json["address"]; | |
| 1670 } | |
| 1671 } | |
| 1672 | |
| 1673 core.Map toJson() { | |
| 1674 var _json = new core.Map(); | |
| 1675 if (address != null) { | |
| 1676 _json["address"] = address; | |
| 1677 } | |
| 1678 return _json; | |
| 1679 } | |
| 1680 } | |
| 1681 | |
| 1682 | |
| 1683 /** The result of a voter info lookup query. */ | |
| 1684 class VoterInfoResponse { | |
| 1685 /** Contests that will appear on the voter's ballot. */ | |
| 1686 core.List<Contest> contests; | |
| 1687 | |
| 1688 /** | |
| 1689 * Locations where a voter is eligible to drop off a completed ballot. The | |
| 1690 * voter must have received and completed a ballot prior to arriving at the | |
| 1691 * location. The location may not have ballots available on the premises. | |
| 1692 * These locations could be open on or before election day as indicated in the | |
| 1693 * pollingHours field. | |
| 1694 */ | |
| 1695 core.List<PollingLocation> dropOffLocations; | |
| 1696 | |
| 1697 /** | |
| 1698 * Locations where the voter is eligible to vote early, prior to election day. | |
| 1699 */ | |
| 1700 core.List<PollingLocation> earlyVoteSites; | |
| 1701 | |
| 1702 /** The election that was queried. */ | |
| 1703 Election election; | |
| 1704 | |
| 1705 /** | |
| 1706 * Identifies what kind of resource this is. Value: the fixed string | |
| 1707 * "civicinfo#voterInfoResponse". | |
| 1708 */ | |
| 1709 core.String kind; | |
| 1710 | |
| 1711 /** The normalized version of the requested address */ | |
| 1712 SimpleAddressType normalizedInput; | |
| 1713 | |
| 1714 /** Locations where the voter is eligible to vote on election day. */ | |
| 1715 core.List<PollingLocation> pollingLocations; | |
| 1716 | |
| 1717 /** Not documented yet. */ | |
| 1718 core.String precinctId; | |
| 1719 | |
| 1720 /** | |
| 1721 * Local Election Information for the state that the voter votes in. For the | |
| 1722 * US, there will only be one element in this array. | |
| 1723 */ | |
| 1724 core.List<AdministrationRegion> state; | |
| 1725 | |
| 1726 /** | |
| 1727 * The result of the request. One of: success, noStreetSegmentFound, | |
| 1728 * addressUnparseable, noAddressParameter, multipleStreetSegmentsFound, | |
| 1729 * electionOver, electionUnknown, internalLookupFailure | |
| 1730 */ | |
| 1731 core.String status; | |
| 1732 | |
| 1733 | |
| 1734 VoterInfoResponse(); | |
| 1735 | |
| 1736 VoterInfoResponse.fromJson(core.Map _json) { | |
| 1737 if (_json.containsKey("contests")) { | |
| 1738 contests = _json["contests"].map((value) => new Contest.fromJson(value)).t
oList(); | |
| 1739 } | |
| 1740 if (_json.containsKey("dropOffLocations")) { | |
| 1741 dropOffLocations = _json["dropOffLocations"].map((value) => new PollingLoc
ation.fromJson(value)).toList(); | |
| 1742 } | |
| 1743 if (_json.containsKey("earlyVoteSites")) { | |
| 1744 earlyVoteSites = _json["earlyVoteSites"].map((value) => new PollingLocatio
n.fromJson(value)).toList(); | |
| 1745 } | |
| 1746 if (_json.containsKey("election")) { | |
| 1747 election = new Election.fromJson(_json["election"]); | |
| 1748 } | |
| 1749 if (_json.containsKey("kind")) { | |
| 1750 kind = _json["kind"]; | |
| 1751 } | |
| 1752 if (_json.containsKey("normalizedInput")) { | |
| 1753 normalizedInput = new SimpleAddressType.fromJson(_json["normalizedInput"])
; | |
| 1754 } | |
| 1755 if (_json.containsKey("pollingLocations")) { | |
| 1756 pollingLocations = _json["pollingLocations"].map((value) => new PollingLoc
ation.fromJson(value)).toList(); | |
| 1757 } | |
| 1758 if (_json.containsKey("precinctId")) { | |
| 1759 precinctId = _json["precinctId"]; | |
| 1760 } | |
| 1761 if (_json.containsKey("state")) { | |
| 1762 state = _json["state"].map((value) => new AdministrationRegion.fromJson(va
lue)).toList(); | |
| 1763 } | |
| 1764 if (_json.containsKey("status")) { | |
| 1765 status = _json["status"]; | |
| 1766 } | |
| 1767 } | |
| 1768 | |
| 1769 core.Map toJson() { | |
| 1770 var _json = new core.Map(); | |
| 1771 if (contests != null) { | |
| 1772 _json["contests"] = contests.map((value) => (value).toJson()).toList(); | |
| 1773 } | |
| 1774 if (dropOffLocations != null) { | |
| 1775 _json["dropOffLocations"] = dropOffLocations.map((value) => (value).toJson
()).toList(); | |
| 1776 } | |
| 1777 if (earlyVoteSites != null) { | |
| 1778 _json["earlyVoteSites"] = earlyVoteSites.map((value) => (value).toJson()).
toList(); | |
| 1779 } | |
| 1780 if (election != null) { | |
| 1781 _json["election"] = (election).toJson(); | |
| 1782 } | |
| 1783 if (kind != null) { | |
| 1784 _json["kind"] = kind; | |
| 1785 } | |
| 1786 if (normalizedInput != null) { | |
| 1787 _json["normalizedInput"] = (normalizedInput).toJson(); | |
| 1788 } | |
| 1789 if (pollingLocations != null) { | |
| 1790 _json["pollingLocations"] = pollingLocations.map((value) => (value).toJson
()).toList(); | |
| 1791 } | |
| 1792 if (precinctId != null) { | |
| 1793 _json["precinctId"] = precinctId; | |
| 1794 } | |
| 1795 if (state != null) { | |
| 1796 _json["state"] = state.map((value) => (value).toJson()).toList(); | |
| 1797 } | |
| 1798 if (status != null) { | |
| 1799 _json["status"] = status; | |
| 1800 } | |
| 1801 return _json; | |
| 1802 } | |
| 1803 } | |
| 1804 | |
| 1805 | |
| OLD | NEW |