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) : |
| 26 _requester = new common_internal.ApiRequester(client, "https://www.googlea
pis.com/", "/civicinfo/v1/"); |
| 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. For example, if |
| 1088 * this division's OCD ID is ocd-division/country:us/district:dc, this will |
| 1089 * contain ocd-division/country:us/state:dc. |
| 1090 */ |
| 1091 core.List<core.String> alsoKnownAs; |
| 1092 |
| 1093 /** The name of the division. */ |
| 1094 core.String name; |
| 1095 |
| 1096 /** |
| 1097 * List of keys in the offices object, one for each office elected from this |
| 1098 * division. Will only be present if includeOffices was true (or absent) in |
| 1099 * the request. |
| 1100 */ |
| 1101 core.List<core.String> officeIds; |
| 1102 |
| 1103 /** |
| 1104 * The geographic scope of the division. If unspecified, the division's |
| 1105 * geography is not known. One of: national, statewide, congressional, |
| 1106 * stateUpper, stateLower, countywide, judicial, schoolBoard, cityWide, |
| 1107 * township, countyCouncil, cityCouncil, ward, special |
| 1108 */ |
| 1109 core.String scope; |
| 1110 |
| 1111 |
| 1112 GeographicDivision(); |
| 1113 |
| 1114 GeographicDivision.fromJson(core.Map _json) { |
| 1115 if (_json.containsKey("alsoKnownAs")) { |
| 1116 alsoKnownAs = _json["alsoKnownAs"]; |
| 1117 } |
| 1118 if (_json.containsKey("name")) { |
| 1119 name = _json["name"]; |
| 1120 } |
| 1121 if (_json.containsKey("officeIds")) { |
| 1122 officeIds = _json["officeIds"]; |
| 1123 } |
| 1124 if (_json.containsKey("scope")) { |
| 1125 scope = _json["scope"]; |
| 1126 } |
| 1127 } |
| 1128 |
| 1129 core.Map toJson() { |
| 1130 var _json = new core.Map(); |
| 1131 if (alsoKnownAs != null) { |
| 1132 _json["alsoKnownAs"] = alsoKnownAs; |
| 1133 } |
| 1134 if (name != null) { |
| 1135 _json["name"] = name; |
| 1136 } |
| 1137 if (officeIds != null) { |
| 1138 _json["officeIds"] = officeIds; |
| 1139 } |
| 1140 if (scope != null) { |
| 1141 _json["scope"] = scope; |
| 1142 } |
| 1143 return _json; |
| 1144 } |
| 1145 } |
| 1146 |
| 1147 |
| 1148 /** Information about an Office held by one or more Officials. */ |
| 1149 class Office { |
| 1150 /** The OCD ID of the division with which this office is associated. */ |
| 1151 core.String divisionId; |
| 1152 |
| 1153 /** |
| 1154 * The level of this elected office. One of: federal, state, county, city, |
| 1155 * other |
| 1156 */ |
| 1157 core.String level; |
| 1158 |
| 1159 /** The human-readable name of the office. */ |
| 1160 core.String name; |
| 1161 |
| 1162 /** |
| 1163 * List of keys in the officials object of people who presently hold this |
| 1164 * office. |
| 1165 */ |
| 1166 core.List<core.String> officialIds; |
| 1167 |
| 1168 /** |
| 1169 * A list of sources for this office. If multiple sources are listed, the data |
| 1170 * has been aggregated from those sources. |
| 1171 */ |
| 1172 core.List<Source> sources; |
| 1173 |
| 1174 |
| 1175 Office(); |
| 1176 |
| 1177 Office.fromJson(core.Map _json) { |
| 1178 if (_json.containsKey("divisionId")) { |
| 1179 divisionId = _json["divisionId"]; |
| 1180 } |
| 1181 if (_json.containsKey("level")) { |
| 1182 level = _json["level"]; |
| 1183 } |
| 1184 if (_json.containsKey("name")) { |
| 1185 name = _json["name"]; |
| 1186 } |
| 1187 if (_json.containsKey("officialIds")) { |
| 1188 officialIds = _json["officialIds"]; |
| 1189 } |
| 1190 if (_json.containsKey("sources")) { |
| 1191 sources = _json["sources"].map((value) => new Source.fromJson(value)).toLi
st(); |
| 1192 } |
| 1193 } |
| 1194 |
| 1195 core.Map toJson() { |
| 1196 var _json = new core.Map(); |
| 1197 if (divisionId != null) { |
| 1198 _json["divisionId"] = divisionId; |
| 1199 } |
| 1200 if (level != null) { |
| 1201 _json["level"] = level; |
| 1202 } |
| 1203 if (name != null) { |
| 1204 _json["name"] = name; |
| 1205 } |
| 1206 if (officialIds != null) { |
| 1207 _json["officialIds"] = officialIds; |
| 1208 } |
| 1209 if (sources != null) { |
| 1210 _json["sources"] = sources.map((value) => (value).toJson()).toList(); |
| 1211 } |
| 1212 return _json; |
| 1213 } |
| 1214 } |
| 1215 |
| 1216 |
| 1217 /** Information about a official holding an elected office. */ |
| 1218 class Official { |
| 1219 /** Addresses at which to contact the official. */ |
| 1220 core.List<SimpleAddressType> address; |
| 1221 |
| 1222 /** A list of known (social) media channels for this official. */ |
| 1223 core.List<Channel> channels; |
| 1224 |
| 1225 /** The direct email addresses for the official. */ |
| 1226 core.List<core.String> emails; |
| 1227 |
| 1228 /** The official's name. */ |
| 1229 core.String name; |
| 1230 |
| 1231 /** The full name of the party the official belongs to. */ |
| 1232 core.String party; |
| 1233 |
| 1234 /** The official's public contact phone numbers. */ |
| 1235 core.List<core.String> phones; |
| 1236 |
| 1237 /** A URL for a photo of the official. */ |
| 1238 core.String photoUrl; |
| 1239 |
| 1240 /** The official's public website URLs. */ |
| 1241 core.List<core.String> urls; |
| 1242 |
| 1243 |
| 1244 Official(); |
| 1245 |
| 1246 Official.fromJson(core.Map _json) { |
| 1247 if (_json.containsKey("address")) { |
| 1248 address = _json["address"].map((value) => new SimpleAddressType.fromJson(v
alue)).toList(); |
| 1249 } |
| 1250 if (_json.containsKey("channels")) { |
| 1251 channels = _json["channels"].map((value) => new Channel.fromJson(value)).t
oList(); |
| 1252 } |
| 1253 if (_json.containsKey("emails")) { |
| 1254 emails = _json["emails"]; |
| 1255 } |
| 1256 if (_json.containsKey("name")) { |
| 1257 name = _json["name"]; |
| 1258 } |
| 1259 if (_json.containsKey("party")) { |
| 1260 party = _json["party"]; |
| 1261 } |
| 1262 if (_json.containsKey("phones")) { |
| 1263 phones = _json["phones"]; |
| 1264 } |
| 1265 if (_json.containsKey("photoUrl")) { |
| 1266 photoUrl = _json["photoUrl"]; |
| 1267 } |
| 1268 if (_json.containsKey("urls")) { |
| 1269 urls = _json["urls"]; |
| 1270 } |
| 1271 } |
| 1272 |
| 1273 core.Map toJson() { |
| 1274 var _json = new core.Map(); |
| 1275 if (address != null) { |
| 1276 _json["address"] = address.map((value) => (value).toJson()).toList(); |
| 1277 } |
| 1278 if (channels != null) { |
| 1279 _json["channels"] = channels.map((value) => (value).toJson()).toList(); |
| 1280 } |
| 1281 if (emails != null) { |
| 1282 _json["emails"] = emails; |
| 1283 } |
| 1284 if (name != null) { |
| 1285 _json["name"] = name; |
| 1286 } |
| 1287 if (party != null) { |
| 1288 _json["party"] = party; |
| 1289 } |
| 1290 if (phones != null) { |
| 1291 _json["phones"] = phones; |
| 1292 } |
| 1293 if (photoUrl != null) { |
| 1294 _json["photoUrl"] = photoUrl; |
| 1295 } |
| 1296 if (urls != null) { |
| 1297 _json["urls"] = urls; |
| 1298 } |
| 1299 return _json; |
| 1300 } |
| 1301 } |
| 1302 |
| 1303 |
| 1304 /** |
| 1305 * A location where a voter can vote. This may be an early vote site or an |
| 1306 * election day voting location. |
| 1307 */ |
| 1308 class PollingLocation { |
| 1309 /** The address of the location */ |
| 1310 SimpleAddressType address; |
| 1311 |
| 1312 /** |
| 1313 * The last date that this early vote site may be used. This field is not |
| 1314 * populated for polling locations. |
| 1315 */ |
| 1316 core.String endDate; |
| 1317 |
| 1318 /** |
| 1319 * An ID for this object. IDs may change in future requests and should not be |
| 1320 * cached. Access to this field requires special access that can be requested |
| 1321 * from the Request more link on the Quotas page. |
| 1322 */ |
| 1323 core.String id; |
| 1324 |
| 1325 /** |
| 1326 * The name of the early vote site. This field is not populated for polling |
| 1327 * locations. |
| 1328 */ |
| 1329 core.String name; |
| 1330 |
| 1331 /** Notes about this location (e.g. accessibility ramp or entrance to use) */ |
| 1332 core.String notes; |
| 1333 |
| 1334 /** A description of when this location is open. */ |
| 1335 core.String pollingHours; |
| 1336 |
| 1337 /** |
| 1338 * A list of sources for this location. If multiple sources are listed the |
| 1339 * data has been aggregated from those sources. |
| 1340 */ |
| 1341 core.List<Source> sources; |
| 1342 |
| 1343 /** |
| 1344 * The first date that this early vote site may be used. This field is not |
| 1345 * populated for polling locations. |
| 1346 */ |
| 1347 core.String startDate; |
| 1348 |
| 1349 /** |
| 1350 * The services provided by this early vote site. This field is not populated |
| 1351 * for polling locations. |
| 1352 */ |
| 1353 core.String voterServices; |
| 1354 |
| 1355 |
| 1356 PollingLocation(); |
| 1357 |
| 1358 PollingLocation.fromJson(core.Map _json) { |
| 1359 if (_json.containsKey("address")) { |
| 1360 address = new SimpleAddressType.fromJson(_json["address"]); |
| 1361 } |
| 1362 if (_json.containsKey("endDate")) { |
| 1363 endDate = _json["endDate"]; |
| 1364 } |
| 1365 if (_json.containsKey("id")) { |
| 1366 id = _json["id"]; |
| 1367 } |
| 1368 if (_json.containsKey("name")) { |
| 1369 name = _json["name"]; |
| 1370 } |
| 1371 if (_json.containsKey("notes")) { |
| 1372 notes = _json["notes"]; |
| 1373 } |
| 1374 if (_json.containsKey("pollingHours")) { |
| 1375 pollingHours = _json["pollingHours"]; |
| 1376 } |
| 1377 if (_json.containsKey("sources")) { |
| 1378 sources = _json["sources"].map((value) => new Source.fromJson(value)).toLi
st(); |
| 1379 } |
| 1380 if (_json.containsKey("startDate")) { |
| 1381 startDate = _json["startDate"]; |
| 1382 } |
| 1383 if (_json.containsKey("voterServices")) { |
| 1384 voterServices = _json["voterServices"]; |
| 1385 } |
| 1386 } |
| 1387 |
| 1388 core.Map toJson() { |
| 1389 var _json = new core.Map(); |
| 1390 if (address != null) { |
| 1391 _json["address"] = (address).toJson(); |
| 1392 } |
| 1393 if (endDate != null) { |
| 1394 _json["endDate"] = endDate; |
| 1395 } |
| 1396 if (id != null) { |
| 1397 _json["id"] = id; |
| 1398 } |
| 1399 if (name != null) { |
| 1400 _json["name"] = name; |
| 1401 } |
| 1402 if (notes != null) { |
| 1403 _json["notes"] = notes; |
| 1404 } |
| 1405 if (pollingHours != null) { |
| 1406 _json["pollingHours"] = pollingHours; |
| 1407 } |
| 1408 if (sources != null) { |
| 1409 _json["sources"] = sources.map((value) => (value).toJson()).toList(); |
| 1410 } |
| 1411 if (startDate != null) { |
| 1412 _json["startDate"] = startDate; |
| 1413 } |
| 1414 if (voterServices != null) { |
| 1415 _json["voterServices"] = voterServices; |
| 1416 } |
| 1417 return _json; |
| 1418 } |
| 1419 } |
| 1420 |
| 1421 |
| 1422 /** |
| 1423 * A request for political geography and representative information for an |
| 1424 * address. |
| 1425 */ |
| 1426 class RepresentativeInfoRequest { |
| 1427 /** |
| 1428 * The address to look up. May only be specified if the field ocdId is not |
| 1429 * given in the URL. |
| 1430 */ |
| 1431 core.String address; |
| 1432 |
| 1433 |
| 1434 RepresentativeInfoRequest(); |
| 1435 |
| 1436 RepresentativeInfoRequest.fromJson(core.Map _json) { |
| 1437 if (_json.containsKey("address")) { |
| 1438 address = _json["address"]; |
| 1439 } |
| 1440 } |
| 1441 |
| 1442 core.Map toJson() { |
| 1443 var _json = new core.Map(); |
| 1444 if (address != null) { |
| 1445 _json["address"] = address; |
| 1446 } |
| 1447 return _json; |
| 1448 } |
| 1449 } |
| 1450 |
| 1451 |
| 1452 /** The result of a representative info lookup query. */ |
| 1453 class RepresentativeInfoResponse { |
| 1454 /** Political geographic divisions that contain the requested address. */ |
| 1455 core.Map<core.String, GeographicDivision> divisions; |
| 1456 |
| 1457 /** |
| 1458 * Identifies what kind of resource this is. Value: the fixed string |
| 1459 * "civicinfo#representativeInfoResponse". |
| 1460 */ |
| 1461 core.String kind; |
| 1462 |
| 1463 /** The normalized version of the requested address */ |
| 1464 SimpleAddressType normalizedInput; |
| 1465 |
| 1466 /** |
| 1467 * Elected offices referenced by the divisions listed above. Will only be |
| 1468 * present if includeOffices was true in the request. |
| 1469 */ |
| 1470 core.Map<core.String, Office> offices; |
| 1471 |
| 1472 /** |
| 1473 * Officials holding the offices listed above. Will only be present if |
| 1474 * includeOffices was true in the request. |
| 1475 */ |
| 1476 core.Map<core.String, Official> officials; |
| 1477 |
| 1478 /** |
| 1479 * The result of the request. One of: success, noStreetSegmentFound, |
| 1480 * addressUnparseable, noAddressParameter, multipleStreetSegmentsFound, |
| 1481 * electionOver, electionUnknown, internalLookupFailure, |
| 1482 * RequestedBothAddressAndOcdId |
| 1483 */ |
| 1484 core.String status; |
| 1485 |
| 1486 |
| 1487 RepresentativeInfoResponse(); |
| 1488 |
| 1489 RepresentativeInfoResponse.fromJson(core.Map _json) { |
| 1490 if (_json.containsKey("divisions")) { |
| 1491 divisions = common_internal.mapMap(_json["divisions"], (item) => new Geogr
aphicDivision.fromJson(item)); |
| 1492 } |
| 1493 if (_json.containsKey("kind")) { |
| 1494 kind = _json["kind"]; |
| 1495 } |
| 1496 if (_json.containsKey("normalizedInput")) { |
| 1497 normalizedInput = new SimpleAddressType.fromJson(_json["normalizedInput"])
; |
| 1498 } |
| 1499 if (_json.containsKey("offices")) { |
| 1500 offices = common_internal.mapMap(_json["offices"], (item) => new Office.fr
omJson(item)); |
| 1501 } |
| 1502 if (_json.containsKey("officials")) { |
| 1503 officials = common_internal.mapMap(_json["officials"], (item) => new Offic
ial.fromJson(item)); |
| 1504 } |
| 1505 if (_json.containsKey("status")) { |
| 1506 status = _json["status"]; |
| 1507 } |
| 1508 } |
| 1509 |
| 1510 core.Map toJson() { |
| 1511 var _json = new core.Map(); |
| 1512 if (divisions != null) { |
| 1513 _json["divisions"] = common_internal.mapMap(divisions, (item) => (item).to
Json()); |
| 1514 } |
| 1515 if (kind != null) { |
| 1516 _json["kind"] = kind; |
| 1517 } |
| 1518 if (normalizedInput != null) { |
| 1519 _json["normalizedInput"] = (normalizedInput).toJson(); |
| 1520 } |
| 1521 if (offices != null) { |
| 1522 _json["offices"] = common_internal.mapMap(offices, (item) => (item).toJson
()); |
| 1523 } |
| 1524 if (officials != null) { |
| 1525 _json["officials"] = common_internal.mapMap(officials, (item) => (item).to
Json()); |
| 1526 } |
| 1527 if (status != null) { |
| 1528 _json["status"] = status; |
| 1529 } |
| 1530 return _json; |
| 1531 } |
| 1532 } |
| 1533 |
| 1534 |
| 1535 /** A simple representation of an address. */ |
| 1536 class SimpleAddressType { |
| 1537 /** The city or town for the address. */ |
| 1538 core.String city; |
| 1539 |
| 1540 /** The street name and number of this address. */ |
| 1541 core.String line1; |
| 1542 |
| 1543 /** The second line the address, if needed. */ |
| 1544 core.String line2; |
| 1545 |
| 1546 /** The third line of the address, if needed. */ |
| 1547 core.String line3; |
| 1548 |
| 1549 /** The name of the location. */ |
| 1550 core.String locationName; |
| 1551 |
| 1552 /** The US two letter state abbreviation of the address. */ |
| 1553 core.String state; |
| 1554 |
| 1555 /** The US Postal Zip Code of the address. */ |
| 1556 core.String zip; |
| 1557 |
| 1558 |
| 1559 SimpleAddressType(); |
| 1560 |
| 1561 SimpleAddressType.fromJson(core.Map _json) { |
| 1562 if (_json.containsKey("city")) { |
| 1563 city = _json["city"]; |
| 1564 } |
| 1565 if (_json.containsKey("line1")) { |
| 1566 line1 = _json["line1"]; |
| 1567 } |
| 1568 if (_json.containsKey("line2")) { |
| 1569 line2 = _json["line2"]; |
| 1570 } |
| 1571 if (_json.containsKey("line3")) { |
| 1572 line3 = _json["line3"]; |
| 1573 } |
| 1574 if (_json.containsKey("locationName")) { |
| 1575 locationName = _json["locationName"]; |
| 1576 } |
| 1577 if (_json.containsKey("state")) { |
| 1578 state = _json["state"]; |
| 1579 } |
| 1580 if (_json.containsKey("zip")) { |
| 1581 zip = _json["zip"]; |
| 1582 } |
| 1583 } |
| 1584 |
| 1585 core.Map toJson() { |
| 1586 var _json = new core.Map(); |
| 1587 if (city != null) { |
| 1588 _json["city"] = city; |
| 1589 } |
| 1590 if (line1 != null) { |
| 1591 _json["line1"] = line1; |
| 1592 } |
| 1593 if (line2 != null) { |
| 1594 _json["line2"] = line2; |
| 1595 } |
| 1596 if (line3 != null) { |
| 1597 _json["line3"] = line3; |
| 1598 } |
| 1599 if (locationName != null) { |
| 1600 _json["locationName"] = locationName; |
| 1601 } |
| 1602 if (state != null) { |
| 1603 _json["state"] = state; |
| 1604 } |
| 1605 if (zip != null) { |
| 1606 _json["zip"] = zip; |
| 1607 } |
| 1608 return _json; |
| 1609 } |
| 1610 } |
| 1611 |
| 1612 |
| 1613 /** |
| 1614 * Contains information about the data source for the element containing it. |
| 1615 */ |
| 1616 class Source { |
| 1617 /** The name of the data source. */ |
| 1618 core.String name; |
| 1619 |
| 1620 /** Whether this data comes from an official government source. */ |
| 1621 core.bool official; |
| 1622 |
| 1623 |
| 1624 Source(); |
| 1625 |
| 1626 Source.fromJson(core.Map _json) { |
| 1627 if (_json.containsKey("name")) { |
| 1628 name = _json["name"]; |
| 1629 } |
| 1630 if (_json.containsKey("official")) { |
| 1631 official = _json["official"]; |
| 1632 } |
| 1633 } |
| 1634 |
| 1635 core.Map toJson() { |
| 1636 var _json = new core.Map(); |
| 1637 if (name != null) { |
| 1638 _json["name"] = name; |
| 1639 } |
| 1640 if (official != null) { |
| 1641 _json["official"] = official; |
| 1642 } |
| 1643 return _json; |
| 1644 } |
| 1645 } |
| 1646 |
| 1647 |
| 1648 /** A request for information about a voter. */ |
| 1649 class VoterInfoRequest { |
| 1650 /** The registered address of the voter to look up. */ |
| 1651 core.String address; |
| 1652 |
| 1653 |
| 1654 VoterInfoRequest(); |
| 1655 |
| 1656 VoterInfoRequest.fromJson(core.Map _json) { |
| 1657 if (_json.containsKey("address")) { |
| 1658 address = _json["address"]; |
| 1659 } |
| 1660 } |
| 1661 |
| 1662 core.Map toJson() { |
| 1663 var _json = new core.Map(); |
| 1664 if (address != null) { |
| 1665 _json["address"] = address; |
| 1666 } |
| 1667 return _json; |
| 1668 } |
| 1669 } |
| 1670 |
| 1671 |
| 1672 /** The result of a voter info lookup query. */ |
| 1673 class VoterInfoResponse { |
| 1674 /** Contests that will appear on the voter's ballot */ |
| 1675 core.List<Contest> contests; |
| 1676 |
| 1677 /** |
| 1678 * Locations where the voter is eligible to vote early, prior to election day |
| 1679 */ |
| 1680 core.List<PollingLocation> earlyVoteSites; |
| 1681 |
| 1682 /** The election that was queried. */ |
| 1683 Election election; |
| 1684 |
| 1685 /** |
| 1686 * Identifies what kind of resource this is. Value: the fixed string |
| 1687 * "civicinfo#voterInfoResponse". |
| 1688 */ |
| 1689 core.String kind; |
| 1690 |
| 1691 /** The normalized version of the requested address */ |
| 1692 SimpleAddressType normalizedInput; |
| 1693 |
| 1694 /** |
| 1695 * Locations where the voter is eligible to vote on election day. For states |
| 1696 * with mail-in voting only, these locations will be nearby drop box |
| 1697 * locations. Drop box locations are free to the voter and may be used instead |
| 1698 * of placing the ballot in the mail. |
| 1699 */ |
| 1700 core.List<PollingLocation> pollingLocations; |
| 1701 |
| 1702 /** |
| 1703 * Local Election Information for the state that the voter votes in. For the |
| 1704 * US, there will only be one element in this array. |
| 1705 */ |
| 1706 core.List<AdministrationRegion> state; |
| 1707 |
| 1708 /** |
| 1709 * The result of the request. One of: success, noStreetSegmentFound, |
| 1710 * addressUnparseable, noAddressParameter, multipleStreetSegmentsFound, |
| 1711 * electionOver, electionUnknown, internalLookupFailure |
| 1712 */ |
| 1713 core.String status; |
| 1714 |
| 1715 |
| 1716 VoterInfoResponse(); |
| 1717 |
| 1718 VoterInfoResponse.fromJson(core.Map _json) { |
| 1719 if (_json.containsKey("contests")) { |
| 1720 contests = _json["contests"].map((value) => new Contest.fromJson(value)).t
oList(); |
| 1721 } |
| 1722 if (_json.containsKey("earlyVoteSites")) { |
| 1723 earlyVoteSites = _json["earlyVoteSites"].map((value) => new PollingLocatio
n.fromJson(value)).toList(); |
| 1724 } |
| 1725 if (_json.containsKey("election")) { |
| 1726 election = new Election.fromJson(_json["election"]); |
| 1727 } |
| 1728 if (_json.containsKey("kind")) { |
| 1729 kind = _json["kind"]; |
| 1730 } |
| 1731 if (_json.containsKey("normalizedInput")) { |
| 1732 normalizedInput = new SimpleAddressType.fromJson(_json["normalizedInput"])
; |
| 1733 } |
| 1734 if (_json.containsKey("pollingLocations")) { |
| 1735 pollingLocations = _json["pollingLocations"].map((value) => new PollingLoc
ation.fromJson(value)).toList(); |
| 1736 } |
| 1737 if (_json.containsKey("state")) { |
| 1738 state = _json["state"].map((value) => new AdministrationRegion.fromJson(va
lue)).toList(); |
| 1739 } |
| 1740 if (_json.containsKey("status")) { |
| 1741 status = _json["status"]; |
| 1742 } |
| 1743 } |
| 1744 |
| 1745 core.Map toJson() { |
| 1746 var _json = new core.Map(); |
| 1747 if (contests != null) { |
| 1748 _json["contests"] = contests.map((value) => (value).toJson()).toList(); |
| 1749 } |
| 1750 if (earlyVoteSites != null) { |
| 1751 _json["earlyVoteSites"] = earlyVoteSites.map((value) => (value).toJson()).
toList(); |
| 1752 } |
| 1753 if (election != null) { |
| 1754 _json["election"] = (election).toJson(); |
| 1755 } |
| 1756 if (kind != null) { |
| 1757 _json["kind"] = kind; |
| 1758 } |
| 1759 if (normalizedInput != null) { |
| 1760 _json["normalizedInput"] = (normalizedInput).toJson(); |
| 1761 } |
| 1762 if (pollingLocations != null) { |
| 1763 _json["pollingLocations"] = pollingLocations.map((value) => (value).toJson
()).toList(); |
| 1764 } |
| 1765 if (state != null) { |
| 1766 _json["state"] = state.map((value) => (value).toJson()).toList(); |
| 1767 } |
| 1768 if (status != null) { |
| 1769 _json["status"] = status; |
| 1770 } |
| 1771 return _json; |
| 1772 } |
| 1773 } |
| 1774 |
| 1775 |
OLD | NEW |