Index: generated/googleapis/lib/civicinfo/v2.dart |
diff --git a/generated/googleapis/lib/civicinfo/v1.dart b/generated/googleapis/lib/civicinfo/v2.dart |
similarity index 84% |
copy from generated/googleapis/lib/civicinfo/v1.dart |
copy to generated/googleapis/lib/civicinfo/v2.dart |
index 2869359ab57c814b9979ba38339ff5da6b4dd430..c05e94d1b67c9940ccaec572cdbe967f22a288cd 100644 |
--- a/generated/googleapis/lib/civicinfo/v1.dart |
+++ b/generated/googleapis/lib/civicinfo/v2.dart |
@@ -1,4 +1,4 @@ |
-library googleapis.civicinfo.v1; |
+library googleapis.civicinfo.v2; |
import "dart:core" as core; |
import "dart:collection" as collection; |
@@ -23,7 +23,7 @@ class CivicinfoApi { |
RepresentativesResourceApi get representatives => new RepresentativesResourceApi(_requester); |
CivicinfoApi(http.Client client) : |
- _requester = new common_internal.ApiRequester(client, "https://www.googleapis.com/", "civicinfo/v1/"); |
+ _requester = new common_internal.ApiRequester(client, "https://www.googleapis.com/", "civicinfo/v2/"); |
} |
@@ -66,7 +66,7 @@ class DivisionsResourceApi { |
} |
- _url = 'representatives/division_search'; |
+ _url = 'divisions'; |
var _response = _requester.request(_url, |
"GET", |
@@ -127,10 +127,10 @@ class ElectionsResourceApi { |
* Looks up information relevant to a voter based on the voter's registered |
* address. |
* |
- * [request] - The metadata request object. |
- * |
* Request parameters: |
* |
+ * [address] - The registered address of the voter to look up. |
+ * |
* [electionId] - The unique ID of the election to look up. A list of election |
* IDs can be obtained at |
* https://www.googleapis.com/civicinfo/{version}/elections |
@@ -146,7 +146,7 @@ class ElectionsResourceApi { |
* If the used [http.Client] completes with an error when making a REST call, |
* this method will complete with the same error. |
*/ |
- async.Future<VoterInfoResponse> voterInfoQuery(VoterInfoRequest request, core.String electionId, {core.bool officialOnly}) { |
+ async.Future<VoterInfoResponse> voterInfoQuery(core.String address, {core.String electionId, core.bool officialOnly}) { |
var _url = null; |
var _queryParams = new core.Map(); |
var _uploadMedia = null; |
@@ -154,21 +154,22 @@ class ElectionsResourceApi { |
var _downloadOptions = common.DownloadOptions.Metadata; |
var _body = null; |
- if (request != null) { |
- _body = convert.JSON.encode((request).toJson()); |
+ if (address == null) { |
+ throw new core.ArgumentError("Parameter address is required."); |
} |
- if (electionId == null) { |
- throw new core.ArgumentError("Parameter electionId is required."); |
+ _queryParams["address"] = [address]; |
+ if (electionId != null) { |
+ _queryParams["electionId"] = [electionId]; |
} |
if (officialOnly != null) { |
_queryParams["officialOnly"] = ["${officialOnly}"]; |
} |
- _url = 'voterinfo/' + common_internal.Escaper.ecapeVariable('$electionId') + '/lookup'; |
+ _url = 'voterinfo'; |
var _response = _requester.request(_url, |
- "POST", |
+ "GET", |
body: _body, |
queryParams: _queryParams, |
uploadOptions: _uploadOptions, |
@@ -188,24 +189,25 @@ class RepresentativesResourceApi { |
_requester = client; |
/** |
- * Looks up political geography and representative information based on an |
- * address or Open Civic Data division identifier. |
- * |
- * [request] - The metadata request object. |
+ * Looks up political geography and representative information for a single |
+ * address. |
* |
* Request parameters: |
* |
+ * [address] - The address to look up. May only be specified if the field |
+ * ocdId is not given in the URL. |
+ * |
* [includeOffices] - Whether to return information about offices and |
* officials. If false, only the top-level district information will be |
* returned. |
* |
- * [ocdId] - The division to look up. May only be specified if the address |
- * field is not given in the request body. |
+ * [levels] - A list of office levels to filter by. Only offices that serve at |
+ * least one of these levels will be returned. Divisions that don't contain a |
+ * matching office will not be returned. |
* |
- * [recursive] - When ocd_id is supplied, return all divisions which are |
- * hierarchically nested within the queried division. For example, if querying |
- * ocd-division/country:us/district:dc, this would also return all DC's wards |
- * and ANCs. |
+ * [roles] - A list of office roles to filter by. Only offices fulfilling one |
+ * of these roles will be returned. Divisions that don't contain a matching |
+ * office will not be returned. |
* |
* Completes with a [RepresentativeInfoResponse]. |
* |
@@ -215,7 +217,7 @@ class RepresentativesResourceApi { |
* If the used [http.Client] completes with an error when making a REST call, |
* this method will complete with the same error. |
*/ |
- async.Future<RepresentativeInfoResponse> representativeInfoQuery(RepresentativeInfoRequest request, {core.bool includeOffices, core.String ocdId, core.bool recursive}) { |
+ async.Future<RepresentativeInfoResponse> representativeInfoByAddress({core.String address, core.bool includeOffices, core.List<core.String> levels, core.List<core.String> roles}) { |
var _url = null; |
var _queryParams = new core.Map(); |
var _uploadMedia = null; |
@@ -223,30 +225,93 @@ class RepresentativesResourceApi { |
var _downloadOptions = common.DownloadOptions.Metadata; |
var _body = null; |
- if (request != null) { |
- _body = convert.JSON.encode((request).toJson()); |
+ if (address != null) { |
+ _queryParams["address"] = [address]; |
} |
if (includeOffices != null) { |
_queryParams["includeOffices"] = ["${includeOffices}"]; |
} |
- if (ocdId != null) { |
- _queryParams["ocdId"] = [ocdId]; |
+ if (levels != null) { |
+ _queryParams["levels"] = levels; |
+ } |
+ if (roles != null) { |
+ _queryParams["roles"] = roles; |
+ } |
+ |
+ |
+ _url = 'representatives'; |
+ |
+ var _response = _requester.request(_url, |
+ "GET", |
+ body: _body, |
+ queryParams: _queryParams, |
+ uploadOptions: _uploadOptions, |
+ uploadMedia: _uploadMedia, |
+ downloadOptions: _downloadOptions); |
+ return _response.then((data) => new RepresentativeInfoResponse.fromJson(data)); |
+ } |
+ |
+ /** |
+ * Looks up representative information for a single geographic division. |
+ * |
+ * Request parameters: |
+ * |
+ * [ocdId] - The Open Civic Data division identifier of the division to look |
+ * up. |
+ * |
+ * [levels] - A list of office levels to filter by. Only offices that serve at |
+ * least one of these levels will be returned. Divisions that don't contain a |
+ * matching office will not be returned. |
+ * |
+ * [recursive] - If true, information about all divisions contained in the |
+ * division requested will be included as well. For example, if querying |
+ * ocd-division/country:us/district:dc, this would also return all DC's wards |
+ * and ANCs. |
+ * |
+ * [roles] - A list of office roles to filter by. Only offices fulfilling one |
+ * of these roles will be returned. Divisions that don't contain a matching |
+ * office will not be returned. |
+ * |
+ * Completes with a [RepresentativeInfoData]. |
+ * |
+ * Completes with a [common.ApiRequestError] if the API endpoint returned an |
+ * error. |
+ * |
+ * If the used [http.Client] completes with an error when making a REST call, |
+ * this method will complete with the same error. |
+ */ |
+ async.Future<RepresentativeInfoData> representativeInfoByDivision(core.String ocdId, {core.List<core.String> levels, core.bool recursive, core.List<core.String> roles}) { |
+ var _url = null; |
+ var _queryParams = new core.Map(); |
+ var _uploadMedia = null; |
+ var _uploadOptions = null; |
+ var _downloadOptions = common.DownloadOptions.Metadata; |
+ var _body = null; |
+ |
+ if (ocdId == null) { |
+ throw new core.ArgumentError("Parameter ocdId is required."); |
+ } |
+ if (levels != null) { |
+ _queryParams["levels"] = levels; |
} |
if (recursive != null) { |
_queryParams["recursive"] = ["${recursive}"]; |
} |
+ if (roles != null) { |
+ _queryParams["roles"] = roles; |
+ } |
- _url = 'representatives/lookup'; |
+ _url = 'representatives/' + common_internal.Escaper.ecapeVariable('$ocdId'); |
var _response = _requester.request(_url, |
- "POST", |
+ "GET", |
body: _body, |
queryParams: _queryParams, |
uploadOptions: _uploadOptions, |
uploadMedia: _uploadMedia, |
downloadOptions: _downloadOptions); |
- return _response.then((data) => new RepresentativeInfoResponse.fromJson(data)); |
+ return _response.then((data) => new RepresentativeInfoData.fromJson(data)); |
} |
} |
@@ -629,10 +694,13 @@ class Contest { |
core.String id; |
/** |
- * The level of office for this contest. One of: federal, state, county, city, |
- * other |
+ * The levels of government of the office for this contest. There may be more |
+ * than one in cases where a jurisdiction effectively acts at two different |
+ * levels of government; for example, the mayor of the District of Columbia |
+ * acts at "locality" level, but also effectively at both |
+ * "administrative-area-2" and "administrative-area-1". |
*/ |
- core.String level; |
+ core.List<core.String> level; |
/** |
* The number of candidates that will be elected to office in this contest. |
@@ -666,6 +734,9 @@ class Contest { |
*/ |
core.String referendumUrl; |
+ /** The roles which this office fulfills. */ |
+ core.List<core.String> roles; |
+ |
/** |
* A list of sources for this contest. If multiple sources are listed, the |
* data has been aggregated from those sources. |
@@ -728,6 +799,9 @@ class Contest { |
if (_json.containsKey("referendumUrl")) { |
referendumUrl = _json["referendumUrl"]; |
} |
+ if (_json.containsKey("roles")) { |
+ roles = _json["roles"]; |
+ } |
if (_json.containsKey("sources")) { |
sources = _json["sources"].map((value) => new Source.fromJson(value)).toList(); |
} |
@@ -780,6 +854,9 @@ class Contest { |
if (referendumUrl != null) { |
_json["referendumUrl"] = referendumUrl; |
} |
+ if (roles != null) { |
+ _json["roles"] = roles; |
+ } |
if (sources != null) { |
_json["sources"] = sources.map((value) => (value).toJson()).toList(); |
} |
@@ -805,12 +882,6 @@ class DivisionSearchResponse { |
/** Not documented yet. */ |
core.List<DivisionSearchResult> results; |
- /** |
- * The result of the request. One of: success, addressUnparseable, |
- * noAddressParameter, internalLookupFailure |
- */ |
- core.String status; |
- |
DivisionSearchResponse(); |
@@ -821,9 +892,6 @@ class DivisionSearchResponse { |
if (_json.containsKey("results")) { |
results = _json["results"].map((value) => new DivisionSearchResult.fromJson(value)).toList(); |
} |
- if (_json.containsKey("status")) { |
- status = _json["status"]; |
- } |
} |
core.Map toJson() { |
@@ -834,9 +902,6 @@ class DivisionSearchResponse { |
if (results != null) { |
_json["results"] = results.map((value) => (value).toJson()).toList(); |
} |
- if (status != null) { |
- _json["status"] = status; |
- } |
return _json; |
} |
} |
@@ -1103,19 +1168,11 @@ class GeographicDivision { |
core.String name; |
/** |
- * List of keys in the offices object, one for each office elected from this |
+ * List of indices in the offices array, one for each office elected from this |
* division. Will only be present if includeOffices was true (or absent) in |
* the request. |
*/ |
- core.List<core.String> officeIds; |
- |
- /** |
- * The geographic scope of the division. If unspecified, the division's |
- * geography is not known. One of: national, statewide, congressional, |
- * stateUpper, stateLower, countywide, judicial, schoolBoard, cityWide, |
- * township, countyCouncil, cityCouncil, ward, special |
- */ |
- core.String scope; |
+ core.List<core.int> officeIndices; |
GeographicDivision(); |
@@ -1127,11 +1184,8 @@ class GeographicDivision { |
if (_json.containsKey("name")) { |
name = _json["name"]; |
} |
- if (_json.containsKey("officeIds")) { |
- officeIds = _json["officeIds"]; |
- } |
- if (_json.containsKey("scope")) { |
- scope = _json["scope"]; |
+ if (_json.containsKey("officeIndices")) { |
+ officeIndices = _json["officeIndices"]; |
} |
} |
@@ -1143,11 +1197,8 @@ class GeographicDivision { |
if (name != null) { |
_json["name"] = name; |
} |
- if (officeIds != null) { |
- _json["officeIds"] = officeIds; |
- } |
- if (scope != null) { |
- _json["scope"] = scope; |
+ if (officeIndices != null) { |
+ _json["officeIndices"] = officeIndices; |
} |
return _json; |
} |
@@ -1160,19 +1211,30 @@ class Office { |
core.String divisionId; |
/** |
- * The level of this elected office. One of: federal, state, county, city, |
- * other |
+ * The levels of government of which this office is part. There may be more |
+ * than one in cases where a jurisdiction effectively acts at two different |
+ * levels of government; for example, the mayor of the District of Columbia |
+ * acts at "locality" level, but also effectively at both |
+ * "administrative-area-2" and "administrative-area-1". |
*/ |
- core.String level; |
+ core.List<core.String> levels; |
/** The human-readable name of the office. */ |
core.String name; |
/** |
- * List of keys in the officials object of people who presently hold this |
+ * List of indices in the officials array of people who presently hold this |
* office. |
*/ |
- core.List<core.String> officialIds; |
+ core.List<core.int> officialIndices; |
+ |
+ /** |
+ * The roles which this office fulfills. Roles are not meant to be exhaustive, |
+ * or to exactly specify the entire set of responsibilities of a given office, |
+ * but are meant to be rough categories that are useful for general selection |
+ * from or sorting of a list of offices. |
+ */ |
+ core.List<core.String> roles; |
/** |
* A list of sources for this office. If multiple sources are listed, the data |
@@ -1187,14 +1249,17 @@ class Office { |
if (_json.containsKey("divisionId")) { |
divisionId = _json["divisionId"]; |
} |
- if (_json.containsKey("level")) { |
- level = _json["level"]; |
+ if (_json.containsKey("levels")) { |
+ levels = _json["levels"]; |
} |
if (_json.containsKey("name")) { |
name = _json["name"]; |
} |
- if (_json.containsKey("officialIds")) { |
- officialIds = _json["officialIds"]; |
+ if (_json.containsKey("officialIndices")) { |
+ officialIndices = _json["officialIndices"]; |
+ } |
+ if (_json.containsKey("roles")) { |
+ roles = _json["roles"]; |
} |
if (_json.containsKey("sources")) { |
sources = _json["sources"].map((value) => new Source.fromJson(value)).toList(); |
@@ -1206,14 +1271,17 @@ class Office { |
if (divisionId != null) { |
_json["divisionId"] = divisionId; |
} |
- if (level != null) { |
- _json["level"] = level; |
+ if (levels != null) { |
+ _json["levels"] = levels; |
} |
if (name != null) { |
_json["name"] = name; |
} |
- if (officialIds != null) { |
- _json["officialIds"] = officialIds; |
+ if (officialIndices != null) { |
+ _json["officialIndices"] = officialIndices; |
+ } |
+ if (roles != null) { |
+ _json["roles"] = roles; |
} |
if (sources != null) { |
_json["sources"] = sources.map((value) => (value).toJson()).toList(); |
@@ -1428,30 +1496,48 @@ class PollingLocation { |
} |
-/** |
- * A request for political geography and representative information for an |
- * address. |
- */ |
-class RepresentativeInfoRequest { |
+/** Not documented yet. */ |
+class RepresentativeInfoData { |
+ /** Political geographic divisions that contain the requested address. */ |
+ core.Map<core.String, GeographicDivision> divisions; |
+ |
+ /** |
+ * Elected offices referenced by the divisions listed above. Will only be |
+ * present if includeOffices was true in the request. |
+ */ |
+ core.List<Office> offices; |
+ |
/** |
- * The address to look up. May only be specified if the field ocdId is not |
- * given in the URL. |
+ * Officials holding the offices listed above. Will only be present if |
+ * includeOffices was true in the request. |
*/ |
- core.String address; |
+ core.List<Official> officials; |
- RepresentativeInfoRequest(); |
+ RepresentativeInfoData(); |
- RepresentativeInfoRequest.fromJson(core.Map _json) { |
- if (_json.containsKey("address")) { |
- address = _json["address"]; |
+ RepresentativeInfoData.fromJson(core.Map _json) { |
+ if (_json.containsKey("divisions")) { |
+ divisions = common_internal.mapMap(_json["divisions"], (item) => new GeographicDivision.fromJson(item)); |
+ } |
+ if (_json.containsKey("offices")) { |
+ offices = _json["offices"].map((value) => new Office.fromJson(value)).toList(); |
+ } |
+ if (_json.containsKey("officials")) { |
+ officials = _json["officials"].map((value) => new Official.fromJson(value)).toList(); |
} |
} |
core.Map toJson() { |
var _json = new core.Map(); |
- if (address != null) { |
- _json["address"] = address; |
+ if (divisions != null) { |
+ _json["divisions"] = common_internal.mapMap(divisions, (item) => (item).toJson()); |
+ } |
+ if (offices != null) { |
+ _json["offices"] = offices.map((value) => (value).toJson()).toList(); |
+ } |
+ if (officials != null) { |
+ _json["officials"] = officials.map((value) => (value).toJson()).toList(); |
} |
return _json; |
} |
@@ -1476,21 +1562,13 @@ class RepresentativeInfoResponse { |
* Elected offices referenced by the divisions listed above. Will only be |
* present if includeOffices was true in the request. |
*/ |
- core.Map<core.String, Office> offices; |
+ core.List<Office> offices; |
/** |
* Officials holding the offices listed above. Will only be present if |
* includeOffices was true in the request. |
*/ |
- core.Map<core.String, Official> officials; |
- |
- /** |
- * The result of the request. One of: success, noStreetSegmentFound, |
- * addressUnparseable, noAddressParameter, multipleStreetSegmentsFound, |
- * electionOver, electionUnknown, internalLookupFailure, |
- * RequestedBothAddressAndOcdId |
- */ |
- core.String status; |
+ core.List<Official> officials; |
RepresentativeInfoResponse(); |
@@ -1506,13 +1584,10 @@ class RepresentativeInfoResponse { |
normalizedInput = new SimpleAddressType.fromJson(_json["normalizedInput"]); |
} |
if (_json.containsKey("offices")) { |
- offices = common_internal.mapMap(_json["offices"], (item) => new Office.fromJson(item)); |
+ offices = _json["offices"].map((value) => new Office.fromJson(value)).toList(); |
} |
if (_json.containsKey("officials")) { |
- officials = common_internal.mapMap(_json["officials"], (item) => new Official.fromJson(item)); |
- } |
- if (_json.containsKey("status")) { |
- status = _json["status"]; |
+ officials = _json["officials"].map((value) => new Official.fromJson(value)).toList(); |
} |
} |
@@ -1528,13 +1603,10 @@ class RepresentativeInfoResponse { |
_json["normalizedInput"] = (normalizedInput).toJson(); |
} |
if (offices != null) { |
- _json["offices"] = common_internal.mapMap(offices, (item) => (item).toJson()); |
+ _json["offices"] = offices.map((value) => (value).toJson()).toList(); |
} |
if (officials != null) { |
- _json["officials"] = common_internal.mapMap(officials, (item) => (item).toJson()); |
- } |
- if (status != null) { |
- _json["status"] = status; |
+ _json["officials"] = officials.map((value) => (value).toJson()).toList(); |
} |
return _json; |
} |
@@ -1654,30 +1726,6 @@ class Source { |
} |
-/** A request for information about a voter. */ |
-class VoterInfoRequest { |
- /** The registered address of the voter to look up. */ |
- core.String address; |
- |
- |
- VoterInfoRequest(); |
- |
- VoterInfoRequest.fromJson(core.Map _json) { |
- if (_json.containsKey("address")) { |
- address = _json["address"]; |
- } |
- } |
- |
- core.Map toJson() { |
- var _json = new core.Map(); |
- if (address != null) { |
- _json["address"] = address; |
- } |
- return _json; |
- } |
-} |
- |
- |
/** The result of a voter info lookup query. */ |
class VoterInfoResponse { |
/** Contests that will appear on the voter's ballot */ |
@@ -1701,6 +1749,13 @@ class VoterInfoResponse { |
SimpleAddressType normalizedInput; |
/** |
+ * If no election ID was specified in the query, and there was more than one |
+ * election with data for the given voter, this will contain information about |
+ * the other elections that could apply. |
+ */ |
+ core.List<Election> otherElections; |
+ |
+ /** |
* Locations where the voter is eligible to vote on election day. For states |
* with mail-in voting only, these locations will be nearby drop box |
* locations. Drop box locations are free to the voter and may be used instead |
@@ -1708,19 +1763,15 @@ class VoterInfoResponse { |
*/ |
core.List<PollingLocation> pollingLocations; |
+ /** Not documented yet. */ |
+ core.String precinctId; |
+ |
/** |
* Local Election Information for the state that the voter votes in. For the |
* US, there will only be one element in this array. |
*/ |
core.List<AdministrationRegion> state; |
- /** |
- * The result of the request. One of: success, noStreetSegmentFound, |
- * addressUnparseable, noAddressParameter, multipleStreetSegmentsFound, |
- * electionOver, electionUnknown, internalLookupFailure |
- */ |
- core.String status; |
- |
VoterInfoResponse(); |
@@ -1740,15 +1791,18 @@ class VoterInfoResponse { |
if (_json.containsKey("normalizedInput")) { |
normalizedInput = new SimpleAddressType.fromJson(_json["normalizedInput"]); |
} |
+ if (_json.containsKey("otherElections")) { |
+ otherElections = _json["otherElections"].map((value) => new Election.fromJson(value)).toList(); |
+ } |
if (_json.containsKey("pollingLocations")) { |
pollingLocations = _json["pollingLocations"].map((value) => new PollingLocation.fromJson(value)).toList(); |
} |
+ if (_json.containsKey("precinctId")) { |
+ precinctId = _json["precinctId"]; |
+ } |
if (_json.containsKey("state")) { |
state = _json["state"].map((value) => new AdministrationRegion.fromJson(value)).toList(); |
} |
- if (_json.containsKey("status")) { |
- status = _json["status"]; |
- } |
} |
core.Map toJson() { |
@@ -1768,15 +1822,18 @@ class VoterInfoResponse { |
if (normalizedInput != null) { |
_json["normalizedInput"] = (normalizedInput).toJson(); |
} |
+ if (otherElections != null) { |
+ _json["otherElections"] = otherElections.map((value) => (value).toJson()).toList(); |
+ } |
if (pollingLocations != null) { |
_json["pollingLocations"] = pollingLocations.map((value) => (value).toJson()).toList(); |
} |
+ if (precinctId != null) { |
+ _json["precinctId"] = precinctId; |
+ } |
if (state != null) { |
_json["state"] = state.map((value) => (value).toJson()).toList(); |
} |
- if (status != null) { |
- _json["status"] = status; |
- } |
return _json; |
} |
} |