Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1432)

Side by Side Diff: generated/googleapis/lib/civicinfo/v2.dart

Issue 612053002: Api roll 2: 2014-09-29 (Closed) Base URL: git@github.com:dart-lang/googleapis.git@master
Patch Set: Addressed more review comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 library googleapis.civicinfo.v1; 1 library googleapis.civicinfo.v2;
2 2
3 import "dart:core" as core; 3 import "dart:core" as core;
4 import "dart:collection" as collection; 4 import "dart:collection" as collection;
5 import "dart:async" as async; 5 import "dart:async" as async;
6 import "dart:convert" as convert; 6 import "dart:convert" as convert;
7 7
8 import "package:crypto/crypto.dart" as crypto; 8 import "package:crypto/crypto.dart" as crypto;
9 import 'package:http/http.dart' as http; 9 import 'package:http/http.dart' as http;
10 import '../src/common_internal.dart' as common_internal; 10 import '../src/common_internal.dart' as common_internal;
11 import '../common/common.dart' as common; 11 import '../common/common.dart' as common;
12 12
13 export '../common/common.dart' show ApiRequestError; 13 export '../common/common.dart' show ApiRequestError;
14 export '../common/common.dart' show DetailedApiRequestError; 14 export '../common/common.dart' show DetailedApiRequestError;
15 15
16 /** An API for accessing civic information. */ 16 /** An API for accessing civic information. */
17 class CivicinfoApi { 17 class CivicinfoApi {
18 18
19 final common_internal.ApiRequester _requester; 19 final common_internal.ApiRequester _requester;
20 20
21 DivisionsResourceApi get divisions => new DivisionsResourceApi(_requester); 21 DivisionsResourceApi get divisions => new DivisionsResourceApi(_requester);
22 ElectionsResourceApi get elections => new ElectionsResourceApi(_requester); 22 ElectionsResourceApi get elections => new ElectionsResourceApi(_requester);
23 RepresentativesResourceApi get representatives => new RepresentativesResourceA pi(_requester); 23 RepresentativesResourceApi get representatives => new RepresentativesResourceA pi(_requester);
24 24
25 CivicinfoApi(http.Client client) : 25 CivicinfoApi(http.Client client) :
26 _requester = new common_internal.ApiRequester(client, "https://www.googlea pis.com/", "civicinfo/v1/"); 26 _requester = new common_internal.ApiRequester(client, "https://www.googlea pis.com/", "civicinfo/v2/");
27 } 27 }
28 28
29 29
30 /** Not documented yet. */ 30 /** Not documented yet. */
31 class DivisionsResourceApi { 31 class DivisionsResourceApi {
32 final common_internal.ApiRequester _requester; 32 final common_internal.ApiRequester _requester;
33 33
34 DivisionsResourceApi(common_internal.ApiRequester client) : 34 DivisionsResourceApi(common_internal.ApiRequester client) :
35 _requester = client; 35 _requester = client;
36 36
(...skipping 22 matching lines...) Expand all
59 var _uploadMedia = null; 59 var _uploadMedia = null;
60 var _uploadOptions = null; 60 var _uploadOptions = null;
61 var _downloadOptions = common.DownloadOptions.Metadata; 61 var _downloadOptions = common.DownloadOptions.Metadata;
62 var _body = null; 62 var _body = null;
63 63
64 if (query != null) { 64 if (query != null) {
65 _queryParams["query"] = [query]; 65 _queryParams["query"] = [query];
66 } 66 }
67 67
68 68
69 _url = 'representatives/division_search'; 69 _url = 'divisions';
70 70
71 var _response = _requester.request(_url, 71 var _response = _requester.request(_url,
72 "GET", 72 "GET",
73 body: _body, 73 body: _body,
74 queryParams: _queryParams, 74 queryParams: _queryParams,
75 uploadOptions: _uploadOptions, 75 uploadOptions: _uploadOptions,
76 uploadMedia: _uploadMedia, 76 uploadMedia: _uploadMedia,
77 downloadOptions: _downloadOptions); 77 downloadOptions: _downloadOptions);
78 return _response.then((data) => new DivisionSearchResponse.fromJson(data)); 78 return _response.then((data) => new DivisionSearchResponse.fromJson(data));
79 } 79 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 uploadOptions: _uploadOptions, 120 uploadOptions: _uploadOptions,
121 uploadMedia: _uploadMedia, 121 uploadMedia: _uploadMedia,
122 downloadOptions: _downloadOptions); 122 downloadOptions: _downloadOptions);
123 return _response.then((data) => new ElectionsQueryResponse.fromJson(data)); 123 return _response.then((data) => new ElectionsQueryResponse.fromJson(data));
124 } 124 }
125 125
126 /** 126 /**
127 * Looks up information relevant to a voter based on the voter's registered 127 * Looks up information relevant to a voter based on the voter's registered
128 * address. 128 * address.
129 * 129 *
130 * [request] - The metadata request object. 130 * Request parameters:
131 * 131 *
132 * Request parameters: 132 * [address] - The registered address of the voter to look up.
133 * 133 *
134 * [electionId] - The unique ID of the election to look up. A list of election 134 * [electionId] - The unique ID of the election to look up. A list of election
135 * IDs can be obtained at 135 * IDs can be obtained at
136 * https://www.googleapis.com/civicinfo/{version}/elections 136 * https://www.googleapis.com/civicinfo/{version}/elections
137 * 137 *
138 * [officialOnly] - If set to true, only data from official state sources will 138 * [officialOnly] - If set to true, only data from official state sources will
139 * be returned. 139 * be returned.
140 * 140 *
141 * Completes with a [VoterInfoResponse]. 141 * Completes with a [VoterInfoResponse].
142 * 142 *
143 * Completes with a [common.ApiRequestError] if the API endpoint returned an 143 * Completes with a [common.ApiRequestError] if the API endpoint returned an
144 * error. 144 * error.
145 * 145 *
146 * If the used [http.Client] completes with an error when making a REST call, 146 * If the used [http.Client] completes with an error when making a REST call,
147 * this method will complete with the same error. 147 * this method will complete with the same error.
148 */ 148 */
149 async.Future<VoterInfoResponse> voterInfoQuery(VoterInfoRequest request, core. String electionId, {core.bool officialOnly}) { 149 async.Future<VoterInfoResponse> voterInfoQuery(core.String address, {core.Stri ng electionId, core.bool officialOnly}) {
150 var _url = null; 150 var _url = null;
151 var _queryParams = new core.Map(); 151 var _queryParams = new core.Map();
152 var _uploadMedia = null; 152 var _uploadMedia = null;
153 var _uploadOptions = null; 153 var _uploadOptions = null;
154 var _downloadOptions = common.DownloadOptions.Metadata; 154 var _downloadOptions = common.DownloadOptions.Metadata;
155 var _body = null; 155 var _body = null;
156 156
157 if (request != null) { 157 if (address == null) {
158 _body = convert.JSON.encode((request).toJson()); 158 throw new core.ArgumentError("Parameter address is required.");
159 } 159 }
160 if (electionId == null) { 160 _queryParams["address"] = [address];
161 throw new core.ArgumentError("Parameter electionId is required."); 161 if (electionId != null) {
162 _queryParams["electionId"] = [electionId];
162 } 163 }
163 if (officialOnly != null) { 164 if (officialOnly != null) {
164 _queryParams["officialOnly"] = ["${officialOnly}"]; 165 _queryParams["officialOnly"] = ["${officialOnly}"];
165 } 166 }
166 167
167 168
168 _url = 'voterinfo/' + common_internal.Escaper.ecapeVariable('$electionId') + '/lookup'; 169 _url = 'voterinfo';
169 170
170 var _response = _requester.request(_url, 171 var _response = _requester.request(_url,
171 "POST", 172 "GET",
172 body: _body, 173 body: _body,
173 queryParams: _queryParams, 174 queryParams: _queryParams,
174 uploadOptions: _uploadOptions, 175 uploadOptions: _uploadOptions,
175 uploadMedia: _uploadMedia, 176 uploadMedia: _uploadMedia,
176 downloadOptions: _downloadOptions); 177 downloadOptions: _downloadOptions);
177 return _response.then((data) => new VoterInfoResponse.fromJson(data)); 178 return _response.then((data) => new VoterInfoResponse.fromJson(data));
178 } 179 }
179 180
180 } 181 }
181 182
182 183
183 /** Not documented yet. */ 184 /** Not documented yet. */
184 class RepresentativesResourceApi { 185 class RepresentativesResourceApi {
185 final common_internal.ApiRequester _requester; 186 final common_internal.ApiRequester _requester;
186 187
187 RepresentativesResourceApi(common_internal.ApiRequester client) : 188 RepresentativesResourceApi(common_internal.ApiRequester client) :
188 _requester = client; 189 _requester = client;
189 190
190 /** 191 /**
191 * Looks up political geography and representative information based on an 192 * Looks up political geography and representative information for a single
192 * address or Open Civic Data division identifier. 193 * address.
193 *
194 * [request] - The metadata request object.
195 * 194 *
196 * Request parameters: 195 * Request parameters:
197 * 196 *
197 * [address] - The address to look up. May only be specified if the field
198 * ocdId is not given in the URL.
199 *
198 * [includeOffices] - Whether to return information about offices and 200 * [includeOffices] - Whether to return information about offices and
199 * officials. If false, only the top-level district information will be 201 * officials. If false, only the top-level district information will be
200 * returned. 202 * returned.
201 * 203 *
202 * [ocdId] - The division to look up. May only be specified if the address 204 * [levels] - A list of office levels to filter by. Only offices that serve at
203 * field is not given in the request body. 205 * least one of these levels will be returned. Divisions that don't contain a
206 * matching office will not be returned.
204 * 207 *
205 * [recursive] - When ocd_id is supplied, return all divisions which are 208 * [roles] - A list of office roles to filter by. Only offices fulfilling one
206 * hierarchically nested within the queried division. For example, if querying 209 * of these roles will be returned. Divisions that don't contain a matching
207 * ocd-division/country:us/district:dc, this would also return all DC's wards 210 * office will not be returned.
208 * and ANCs.
209 * 211 *
210 * Completes with a [RepresentativeInfoResponse]. 212 * Completes with a [RepresentativeInfoResponse].
211 * 213 *
212 * Completes with a [common.ApiRequestError] if the API endpoint returned an 214 * Completes with a [common.ApiRequestError] if the API endpoint returned an
213 * error. 215 * error.
214 * 216 *
215 * If the used [http.Client] completes with an error when making a REST call, 217 * If the used [http.Client] completes with an error when making a REST call,
216 * this method will complete with the same error. 218 * this method will complete with the same error.
217 */ 219 */
218 async.Future<RepresentativeInfoResponse> representativeInfoQuery(Representativ eInfoRequest request, {core.bool includeOffices, core.String ocdId, core.bool re cursive}) { 220 async.Future<RepresentativeInfoResponse> representativeInfoByAddress({core.Str ing address, core.bool includeOffices, core.List<core.String> levels, core.List< core.String> roles}) {
219 var _url = null; 221 var _url = null;
220 var _queryParams = new core.Map(); 222 var _queryParams = new core.Map();
221 var _uploadMedia = null; 223 var _uploadMedia = null;
222 var _uploadOptions = null; 224 var _uploadOptions = null;
223 var _downloadOptions = common.DownloadOptions.Metadata; 225 var _downloadOptions = common.DownloadOptions.Metadata;
224 var _body = null; 226 var _body = null;
225 227
226 if (request != null) { 228 if (address != null) {
227 _body = convert.JSON.encode((request).toJson()); 229 _queryParams["address"] = [address];
228 } 230 }
229 if (includeOffices != null) { 231 if (includeOffices != null) {
230 _queryParams["includeOffices"] = ["${includeOffices}"]; 232 _queryParams["includeOffices"] = ["${includeOffices}"];
231 } 233 }
232 if (ocdId != null) { 234 if (levels != null) {
233 _queryParams["ocdId"] = [ocdId]; 235 _queryParams["levels"] = levels;
234 } 236 }
235 if (recursive != null) { 237 if (roles != null) {
236 _queryParams["recursive"] = ["${recursive}"]; 238 _queryParams["roles"] = roles;
237 } 239 }
238 240
239 241
240 _url = 'representatives/lookup'; 242 _url = 'representatives';
241 243
242 var _response = _requester.request(_url, 244 var _response = _requester.request(_url,
243 "POST", 245 "GET",
244 body: _body, 246 body: _body,
245 queryParams: _queryParams, 247 queryParams: _queryParams,
246 uploadOptions: _uploadOptions, 248 uploadOptions: _uploadOptions,
247 uploadMedia: _uploadMedia, 249 uploadMedia: _uploadMedia,
248 downloadOptions: _downloadOptions); 250 downloadOptions: _downloadOptions);
249 return _response.then((data) => new RepresentativeInfoResponse.fromJson(data )); 251 return _response.then((data) => new RepresentativeInfoResponse.fromJson(data ));
250 } 252 }
251 253
254 /**
255 * Looks up representative information for a single geographic division.
256 *
257 * Request parameters:
258 *
259 * [ocdId] - The Open Civic Data division identifier of the division to look
260 * up.
261 *
262 * [levels] - A list of office levels to filter by. Only offices that serve at
263 * least one of these levels will be returned. Divisions that don't contain a
264 * matching office will not be returned.
265 *
266 * [recursive] - If true, information about all divisions contained in the
267 * division requested will be included as well. For example, if querying
268 * ocd-division/country:us/district:dc, this would also return all DC's wards
269 * and ANCs.
270 *
271 * [roles] - A list of office roles to filter by. Only offices fulfilling one
272 * of these roles will be returned. Divisions that don't contain a matching
273 * office will not be returned.
274 *
275 * Completes with a [RepresentativeInfoData].
276 *
277 * Completes with a [common.ApiRequestError] if the API endpoint returned an
278 * error.
279 *
280 * If the used [http.Client] completes with an error when making a REST call,
281 * this method will complete with the same error.
282 */
283 async.Future<RepresentativeInfoData> representativeInfoByDivision(core.String ocdId, {core.List<core.String> levels, core.bool recursive, core.List<core.Strin g> roles}) {
284 var _url = null;
285 var _queryParams = new core.Map();
286 var _uploadMedia = null;
287 var _uploadOptions = null;
288 var _downloadOptions = common.DownloadOptions.Metadata;
289 var _body = null;
290
291 if (ocdId == null) {
292 throw new core.ArgumentError("Parameter ocdId is required.");
293 }
294 if (levels != null) {
295 _queryParams["levels"] = levels;
296 }
297 if (recursive != null) {
298 _queryParams["recursive"] = ["${recursive}"];
299 }
300 if (roles != null) {
301 _queryParams["roles"] = roles;
302 }
303
304
305 _url = 'representatives/' + common_internal.Escaper.ecapeVariable('$ocdId');
306
307 var _response = _requester.request(_url,
308 "GET",
309 body: _body,
310 queryParams: _queryParams,
311 uploadOptions: _uploadOptions,
312 uploadMedia: _uploadMedia,
313 downloadOptions: _downloadOptions);
314 return _response.then((data) => new RepresentativeInfoData.fromJson(data));
315 }
316
252 } 317 }
253 318
254 319
255 320
256 /** Describes information about a regional election administrative area. */ 321 /** Describes information about a regional election administrative area. */
257 class AdministrationRegion { 322 class AdministrationRegion {
258 /** The election administration body for this area. */ 323 /** The election administration body for this area. */
259 AdministrativeBody electionAdministrationBody; 324 AdministrativeBody electionAdministrationBody;
260 325
261 /** 326 /**
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 core.String electorateSpecifications; 687 core.String electorateSpecifications;
623 688
624 /** 689 /**
625 * An ID for this object. IDs may change in future requests and should not be 690 * 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 691 * cached. Access to this field requires special access that can be requested
627 * from the Request more link on the Quotas page. 692 * from the Request more link on the Quotas page.
628 */ 693 */
629 core.String id; 694 core.String id;
630 695
631 /** 696 /**
632 * The level of office for this contest. One of: federal, state, county, city, 697 * The levels of government of the office for this contest. There may be more
633 * other 698 * than one in cases where a jurisdiction effectively acts at two different
699 * levels of government; for example, the mayor of the District of Columbia
700 * acts at "locality" level, but also effectively at both
701 * "administrative-area-2" and "administrative-area-1".
634 */ 702 */
635 core.String level; 703 core.List<core.String> level;
636 704
637 /** 705 /**
638 * The number of candidates that will be elected to office in this contest. 706 * The number of candidates that will be elected to office in this contest.
639 */ 707 */
640 core.String numberElected; 708 core.String numberElected;
641 709
642 /** The number of candidates that a voter may vote for in this contest. */ 710 /** The number of candidates that a voter may vote for in this contest. */
643 core.String numberVotingFor; 711 core.String numberVotingFor;
644 712
645 /** The name of the office for this contest. */ 713 /** The name of the office for this contest. */
(...skipping 13 matching lines...) Expand all
659 * populated for contests of type 'Referendum'. 727 * populated for contests of type 'Referendum'.
660 */ 728 */
661 core.String referendumTitle; 729 core.String referendumTitle;
662 730
663 /** 731 /**
664 * A link to the referendum. This field is only populated for contests of type 732 * A link to the referendum. This field is only populated for contests of type
665 * 'Referendum'. 733 * 'Referendum'.
666 */ 734 */
667 core.String referendumUrl; 735 core.String referendumUrl;
668 736
737 /** The roles which this office fulfills. */
738 core.List<core.String> roles;
739
669 /** 740 /**
670 * A list of sources for this contest. If multiple sources are listed, the 741 * A list of sources for this contest. If multiple sources are listed, the
671 * data has been aggregated from those sources. 742 * data has been aggregated from those sources.
672 */ 743 */
673 core.List<Source> sources; 744 core.List<Source> sources;
674 745
675 /** 746 /**
676 * "Yes" or "No" depending on whether this a contest being held outside the 747 * "Yes" or "No" depending on whether this a contest being held outside the
677 * normal election cycle. 748 * normal election cycle.
678 */ 749 */
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 } 792 }
722 if (_json.containsKey("referendumSubtitle")) { 793 if (_json.containsKey("referendumSubtitle")) {
723 referendumSubtitle = _json["referendumSubtitle"]; 794 referendumSubtitle = _json["referendumSubtitle"];
724 } 795 }
725 if (_json.containsKey("referendumTitle")) { 796 if (_json.containsKey("referendumTitle")) {
726 referendumTitle = _json["referendumTitle"]; 797 referendumTitle = _json["referendumTitle"];
727 } 798 }
728 if (_json.containsKey("referendumUrl")) { 799 if (_json.containsKey("referendumUrl")) {
729 referendumUrl = _json["referendumUrl"]; 800 referendumUrl = _json["referendumUrl"];
730 } 801 }
802 if (_json.containsKey("roles")) {
803 roles = _json["roles"];
804 }
731 if (_json.containsKey("sources")) { 805 if (_json.containsKey("sources")) {
732 sources = _json["sources"].map((value) => new Source.fromJson(value)).toLi st(); 806 sources = _json["sources"].map((value) => new Source.fromJson(value)).toLi st();
733 } 807 }
734 if (_json.containsKey("special")) { 808 if (_json.containsKey("special")) {
735 special = _json["special"]; 809 special = _json["special"];
736 } 810 }
737 if (_json.containsKey("type")) { 811 if (_json.containsKey("type")) {
738 type = _json["type"]; 812 type = _json["type"];
739 } 813 }
740 } 814 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 } 847 }
774 if (referendumSubtitle != null) { 848 if (referendumSubtitle != null) {
775 _json["referendumSubtitle"] = referendumSubtitle; 849 _json["referendumSubtitle"] = referendumSubtitle;
776 } 850 }
777 if (referendumTitle != null) { 851 if (referendumTitle != null) {
778 _json["referendumTitle"] = referendumTitle; 852 _json["referendumTitle"] = referendumTitle;
779 } 853 }
780 if (referendumUrl != null) { 854 if (referendumUrl != null) {
781 _json["referendumUrl"] = referendumUrl; 855 _json["referendumUrl"] = referendumUrl;
782 } 856 }
857 if (roles != null) {
858 _json["roles"] = roles;
859 }
783 if (sources != null) { 860 if (sources != null) {
784 _json["sources"] = sources.map((value) => (value).toJson()).toList(); 861 _json["sources"] = sources.map((value) => (value).toJson()).toList();
785 } 862 }
786 if (special != null) { 863 if (special != null) {
787 _json["special"] = special; 864 _json["special"] = special;
788 } 865 }
789 if (type != null) { 866 if (type != null) {
790 _json["type"] = type; 867 _json["type"] = type;
791 } 868 }
792 return _json; 869 return _json;
793 } 870 }
794 } 871 }
795 872
796 873
797 /** The result of a division search query. */ 874 /** The result of a division search query. */
798 class DivisionSearchResponse { 875 class DivisionSearchResponse {
799 /** 876 /**
800 * Identifies what kind of resource this is. Value: the fixed string 877 * Identifies what kind of resource this is. Value: the fixed string
801 * "civicinfo#divisionSearchResponse". 878 * "civicinfo#divisionSearchResponse".
802 */ 879 */
803 core.String kind; 880 core.String kind;
804 881
805 /** Not documented yet. */ 882 /** Not documented yet. */
806 core.List<DivisionSearchResult> results; 883 core.List<DivisionSearchResult> results;
807 884
808 /**
809 * The result of the request. One of: success, addressUnparseable,
810 * noAddressParameter, internalLookupFailure
811 */
812 core.String status;
813
814 885
815 DivisionSearchResponse(); 886 DivisionSearchResponse();
816 887
817 DivisionSearchResponse.fromJson(core.Map _json) { 888 DivisionSearchResponse.fromJson(core.Map _json) {
818 if (_json.containsKey("kind")) { 889 if (_json.containsKey("kind")) {
819 kind = _json["kind"]; 890 kind = _json["kind"];
820 } 891 }
821 if (_json.containsKey("results")) { 892 if (_json.containsKey("results")) {
822 results = _json["results"].map((value) => new DivisionSearchResult.fromJso n(value)).toList(); 893 results = _json["results"].map((value) => new DivisionSearchResult.fromJso n(value)).toList();
823 } 894 }
824 if (_json.containsKey("status")) {
825 status = _json["status"];
826 }
827 } 895 }
828 896
829 core.Map toJson() { 897 core.Map toJson() {
830 var _json = new core.Map(); 898 var _json = new core.Map();
831 if (kind != null) { 899 if (kind != null) {
832 _json["kind"] = kind; 900 _json["kind"] = kind;
833 } 901 }
834 if (results != null) { 902 if (results != null) {
835 _json["results"] = results.map((value) => (value).toJson()).toList(); 903 _json["results"] = results.map((value) => (value).toJson()).toList();
836 } 904 }
837 if (status != null) {
838 _json["status"] = status;
839 }
840 return _json; 905 return _json;
841 } 906 }
842 } 907 }
843 908
844 909
845 /** 910 /**
846 * Represents a political geographic division that matches the requested query. 911 * Represents a political geographic division that matches the requested query.
847 */ 912 */
848 class DivisionSearchResult { 913 class DivisionSearchResult {
849 /** 914 /**
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 * For example, if this division's OCD ID is 1161 * For example, if this division's OCD ID is
1097 * ocd-division/country:us/district:dc, this will contain 1162 * ocd-division/country:us/district:dc, this will contain
1098 * ocd-division/country:us/state:dc. 1163 * ocd-division/country:us/state:dc.
1099 */ 1164 */
1100 core.List<core.String> alsoKnownAs; 1165 core.List<core.String> alsoKnownAs;
1101 1166
1102 /** The name of the division. */ 1167 /** The name of the division. */
1103 core.String name; 1168 core.String name;
1104 1169
1105 /** 1170 /**
1106 * List of keys in the offices object, one for each office elected from this 1171 * List of indices in the offices array, one for each office elected from this
1107 * division. Will only be present if includeOffices was true (or absent) in 1172 * division. Will only be present if includeOffices was true (or absent) in
1108 * the request. 1173 * the request.
1109 */ 1174 */
1110 core.List<core.String> officeIds; 1175 core.List<core.int> officeIndices;
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 1176
1120 1177
1121 GeographicDivision(); 1178 GeographicDivision();
1122 1179
1123 GeographicDivision.fromJson(core.Map _json) { 1180 GeographicDivision.fromJson(core.Map _json) {
1124 if (_json.containsKey("alsoKnownAs")) { 1181 if (_json.containsKey("alsoKnownAs")) {
1125 alsoKnownAs = _json["alsoKnownAs"]; 1182 alsoKnownAs = _json["alsoKnownAs"];
1126 } 1183 }
1127 if (_json.containsKey("name")) { 1184 if (_json.containsKey("name")) {
1128 name = _json["name"]; 1185 name = _json["name"];
1129 } 1186 }
1130 if (_json.containsKey("officeIds")) { 1187 if (_json.containsKey("officeIndices")) {
1131 officeIds = _json["officeIds"]; 1188 officeIndices = _json["officeIndices"];
1132 }
1133 if (_json.containsKey("scope")) {
1134 scope = _json["scope"];
1135 } 1189 }
1136 } 1190 }
1137 1191
1138 core.Map toJson() { 1192 core.Map toJson() {
1139 var _json = new core.Map(); 1193 var _json = new core.Map();
1140 if (alsoKnownAs != null) { 1194 if (alsoKnownAs != null) {
1141 _json["alsoKnownAs"] = alsoKnownAs; 1195 _json["alsoKnownAs"] = alsoKnownAs;
1142 } 1196 }
1143 if (name != null) { 1197 if (name != null) {
1144 _json["name"] = name; 1198 _json["name"] = name;
1145 } 1199 }
1146 if (officeIds != null) { 1200 if (officeIndices != null) {
1147 _json["officeIds"] = officeIds; 1201 _json["officeIndices"] = officeIndices;
1148 }
1149 if (scope != null) {
1150 _json["scope"] = scope;
1151 } 1202 }
1152 return _json; 1203 return _json;
1153 } 1204 }
1154 } 1205 }
1155 1206
1156 1207
1157 /** Information about an Office held by one or more Officials. */ 1208 /** Information about an Office held by one or more Officials. */
1158 class Office { 1209 class Office {
1159 /** The OCD ID of the division with which this office is associated. */ 1210 /** The OCD ID of the division with which this office is associated. */
1160 core.String divisionId; 1211 core.String divisionId;
1161 1212
1162 /** 1213 /**
1163 * The level of this elected office. One of: federal, state, county, city, 1214 * The levels of government of which this office is part. There may be more
1164 * other 1215 * than one in cases where a jurisdiction effectively acts at two different
1216 * levels of government; for example, the mayor of the District of Columbia
1217 * acts at "locality" level, but also effectively at both
1218 * "administrative-area-2" and "administrative-area-1".
1165 */ 1219 */
1166 core.String level; 1220 core.List<core.String> levels;
1167 1221
1168 /** The human-readable name of the office. */ 1222 /** The human-readable name of the office. */
1169 core.String name; 1223 core.String name;
1170 1224
1171 /** 1225 /**
1172 * List of keys in the officials object of people who presently hold this 1226 * List of indices in the officials array of people who presently hold this
1173 * office. 1227 * office.
1174 */ 1228 */
1175 core.List<core.String> officialIds; 1229 core.List<core.int> officialIndices;
1230
1231 /**
1232 * The roles which this office fulfills. Roles are not meant to be exhaustive,
1233 * or to exactly specify the entire set of responsibilities of a given office,
1234 * but are meant to be rough categories that are useful for general selection
1235 * from or sorting of a list of offices.
1236 */
1237 core.List<core.String> roles;
1176 1238
1177 /** 1239 /**
1178 * A list of sources for this office. If multiple sources are listed, the data 1240 * A list of sources for this office. If multiple sources are listed, the data
1179 * has been aggregated from those sources. 1241 * has been aggregated from those sources.
1180 */ 1242 */
1181 core.List<Source> sources; 1243 core.List<Source> sources;
1182 1244
1183 1245
1184 Office(); 1246 Office();
1185 1247
1186 Office.fromJson(core.Map _json) { 1248 Office.fromJson(core.Map _json) {
1187 if (_json.containsKey("divisionId")) { 1249 if (_json.containsKey("divisionId")) {
1188 divisionId = _json["divisionId"]; 1250 divisionId = _json["divisionId"];
1189 } 1251 }
1190 if (_json.containsKey("level")) { 1252 if (_json.containsKey("levels")) {
1191 level = _json["level"]; 1253 levels = _json["levels"];
1192 } 1254 }
1193 if (_json.containsKey("name")) { 1255 if (_json.containsKey("name")) {
1194 name = _json["name"]; 1256 name = _json["name"];
1195 } 1257 }
1196 if (_json.containsKey("officialIds")) { 1258 if (_json.containsKey("officialIndices")) {
1197 officialIds = _json["officialIds"]; 1259 officialIndices = _json["officialIndices"];
1260 }
1261 if (_json.containsKey("roles")) {
1262 roles = _json["roles"];
1198 } 1263 }
1199 if (_json.containsKey("sources")) { 1264 if (_json.containsKey("sources")) {
1200 sources = _json["sources"].map((value) => new Source.fromJson(value)).toLi st(); 1265 sources = _json["sources"].map((value) => new Source.fromJson(value)).toLi st();
1201 } 1266 }
1202 } 1267 }
1203 1268
1204 core.Map toJson() { 1269 core.Map toJson() {
1205 var _json = new core.Map(); 1270 var _json = new core.Map();
1206 if (divisionId != null) { 1271 if (divisionId != null) {
1207 _json["divisionId"] = divisionId; 1272 _json["divisionId"] = divisionId;
1208 } 1273 }
1209 if (level != null) { 1274 if (levels != null) {
1210 _json["level"] = level; 1275 _json["levels"] = levels;
1211 } 1276 }
1212 if (name != null) { 1277 if (name != null) {
1213 _json["name"] = name; 1278 _json["name"] = name;
1214 } 1279 }
1215 if (officialIds != null) { 1280 if (officialIndices != null) {
1216 _json["officialIds"] = officialIds; 1281 _json["officialIndices"] = officialIndices;
1282 }
1283 if (roles != null) {
1284 _json["roles"] = roles;
1217 } 1285 }
1218 if (sources != null) { 1286 if (sources != null) {
1219 _json["sources"] = sources.map((value) => (value).toJson()).toList(); 1287 _json["sources"] = sources.map((value) => (value).toJson()).toList();
1220 } 1288 }
1221 return _json; 1289 return _json;
1222 } 1290 }
1223 } 1291 }
1224 1292
1225 1293
1226 /** Information about a person holding an elected office. */ 1294 /** Information about a person holding an elected office. */
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 _json["startDate"] = startDate; 1489 _json["startDate"] = startDate;
1422 } 1490 }
1423 if (voterServices != null) { 1491 if (voterServices != null) {
1424 _json["voterServices"] = voterServices; 1492 _json["voterServices"] = voterServices;
1425 } 1493 }
1426 return _json; 1494 return _json;
1427 } 1495 }
1428 } 1496 }
1429 1497
1430 1498
1431 /** 1499 /** Not documented yet. */
1432 * A request for political geography and representative information for an 1500 class RepresentativeInfoData {
1433 * address. 1501 /** Political geographic divisions that contain the requested address. */
1434 */ 1502 core.Map<core.String, GeographicDivision> divisions;
1435 class RepresentativeInfoRequest { 1503
1436 /** 1504 /**
1437 * The address to look up. May only be specified if the field ocdId is not 1505 * Elected offices referenced by the divisions listed above. Will only be
1438 * given in the URL. 1506 * present if includeOffices was true in the request.
1439 */ 1507 */
1440 core.String address; 1508 core.List<Office> offices;
1509
1510 /**
1511 * Officials holding the offices listed above. Will only be present if
1512 * includeOffices was true in the request.
1513 */
1514 core.List<Official> officials;
1441 1515
1442 1516
1443 RepresentativeInfoRequest(); 1517 RepresentativeInfoData();
1444 1518
1445 RepresentativeInfoRequest.fromJson(core.Map _json) { 1519 RepresentativeInfoData.fromJson(core.Map _json) {
1446 if (_json.containsKey("address")) { 1520 if (_json.containsKey("divisions")) {
1447 address = _json["address"]; 1521 divisions = common_internal.mapMap(_json["divisions"], (item) => new Geogr aphicDivision.fromJson(item));
1522 }
1523 if (_json.containsKey("offices")) {
1524 offices = _json["offices"].map((value) => new Office.fromJson(value)).toLi st();
1525 }
1526 if (_json.containsKey("officials")) {
1527 officials = _json["officials"].map((value) => new Official.fromJson(value) ).toList();
1448 } 1528 }
1449 } 1529 }
1450 1530
1451 core.Map toJson() { 1531 core.Map toJson() {
1452 var _json = new core.Map(); 1532 var _json = new core.Map();
1453 if (address != null) { 1533 if (divisions != null) {
1454 _json["address"] = address; 1534 _json["divisions"] = common_internal.mapMap(divisions, (item) => (item).to Json());
1535 }
1536 if (offices != null) {
1537 _json["offices"] = offices.map((value) => (value).toJson()).toList();
1538 }
1539 if (officials != null) {
1540 _json["officials"] = officials.map((value) => (value).toJson()).toList();
1455 } 1541 }
1456 return _json; 1542 return _json;
1457 } 1543 }
1458 } 1544 }
1459 1545
1460 1546
1461 /** The result of a representative info lookup query. */ 1547 /** The result of a representative info lookup query. */
1462 class RepresentativeInfoResponse { 1548 class RepresentativeInfoResponse {
1463 /** Political geographic divisions that contain the requested address. */ 1549 /** Political geographic divisions that contain the requested address. */
1464 core.Map<core.String, GeographicDivision> divisions; 1550 core.Map<core.String, GeographicDivision> divisions;
1465 1551
1466 /** 1552 /**
1467 * Identifies what kind of resource this is. Value: the fixed string 1553 * Identifies what kind of resource this is. Value: the fixed string
1468 * "civicinfo#representativeInfoResponse". 1554 * "civicinfo#representativeInfoResponse".
1469 */ 1555 */
1470 core.String kind; 1556 core.String kind;
1471 1557
1472 /** The normalized version of the requested address */ 1558 /** The normalized version of the requested address */
1473 SimpleAddressType normalizedInput; 1559 SimpleAddressType normalizedInput;
1474 1560
1475 /** 1561 /**
1476 * Elected offices referenced by the divisions listed above. Will only be 1562 * Elected offices referenced by the divisions listed above. Will only be
1477 * present if includeOffices was true in the request. 1563 * present if includeOffices was true in the request.
1478 */ 1564 */
1479 core.Map<core.String, Office> offices; 1565 core.List<Office> offices;
1480 1566
1481 /** 1567 /**
1482 * Officials holding the offices listed above. Will only be present if 1568 * Officials holding the offices listed above. Will only be present if
1483 * includeOffices was true in the request. 1569 * includeOffices was true in the request.
1484 */ 1570 */
1485 core.Map<core.String, Official> officials; 1571 core.List<Official> officials;
1486
1487 /**
1488 * The result of the request. One of: success, noStreetSegmentFound,
1489 * addressUnparseable, noAddressParameter, multipleStreetSegmentsFound,
1490 * electionOver, electionUnknown, internalLookupFailure,
1491 * RequestedBothAddressAndOcdId
1492 */
1493 core.String status;
1494 1572
1495 1573
1496 RepresentativeInfoResponse(); 1574 RepresentativeInfoResponse();
1497 1575
1498 RepresentativeInfoResponse.fromJson(core.Map _json) { 1576 RepresentativeInfoResponse.fromJson(core.Map _json) {
1499 if (_json.containsKey("divisions")) { 1577 if (_json.containsKey("divisions")) {
1500 divisions = common_internal.mapMap(_json["divisions"], (item) => new Geogr aphicDivision.fromJson(item)); 1578 divisions = common_internal.mapMap(_json["divisions"], (item) => new Geogr aphicDivision.fromJson(item));
1501 } 1579 }
1502 if (_json.containsKey("kind")) { 1580 if (_json.containsKey("kind")) {
1503 kind = _json["kind"]; 1581 kind = _json["kind"];
1504 } 1582 }
1505 if (_json.containsKey("normalizedInput")) { 1583 if (_json.containsKey("normalizedInput")) {
1506 normalizedInput = new SimpleAddressType.fromJson(_json["normalizedInput"]) ; 1584 normalizedInput = new SimpleAddressType.fromJson(_json["normalizedInput"]) ;
1507 } 1585 }
1508 if (_json.containsKey("offices")) { 1586 if (_json.containsKey("offices")) {
1509 offices = common_internal.mapMap(_json["offices"], (item) => new Office.fr omJson(item)); 1587 offices = _json["offices"].map((value) => new Office.fromJson(value)).toLi st();
1510 } 1588 }
1511 if (_json.containsKey("officials")) { 1589 if (_json.containsKey("officials")) {
1512 officials = common_internal.mapMap(_json["officials"], (item) => new Offic ial.fromJson(item)); 1590 officials = _json["officials"].map((value) => new Official.fromJson(value) ).toList();
1513 }
1514 if (_json.containsKey("status")) {
1515 status = _json["status"];
1516 } 1591 }
1517 } 1592 }
1518 1593
1519 core.Map toJson() { 1594 core.Map toJson() {
1520 var _json = new core.Map(); 1595 var _json = new core.Map();
1521 if (divisions != null) { 1596 if (divisions != null) {
1522 _json["divisions"] = common_internal.mapMap(divisions, (item) => (item).to Json()); 1597 _json["divisions"] = common_internal.mapMap(divisions, (item) => (item).to Json());
1523 } 1598 }
1524 if (kind != null) { 1599 if (kind != null) {
1525 _json["kind"] = kind; 1600 _json["kind"] = kind;
1526 } 1601 }
1527 if (normalizedInput != null) { 1602 if (normalizedInput != null) {
1528 _json["normalizedInput"] = (normalizedInput).toJson(); 1603 _json["normalizedInput"] = (normalizedInput).toJson();
1529 } 1604 }
1530 if (offices != null) { 1605 if (offices != null) {
1531 _json["offices"] = common_internal.mapMap(offices, (item) => (item).toJson ()); 1606 _json["offices"] = offices.map((value) => (value).toJson()).toList();
1532 } 1607 }
1533 if (officials != null) { 1608 if (officials != null) {
1534 _json["officials"] = common_internal.mapMap(officials, (item) => (item).to Json()); 1609 _json["officials"] = officials.map((value) => (value).toJson()).toList();
1535 }
1536 if (status != null) {
1537 _json["status"] = status;
1538 } 1610 }
1539 return _json; 1611 return _json;
1540 } 1612 }
1541 } 1613 }
1542 1614
1543 1615
1544 /** A simple representation of an address. */ 1616 /** A simple representation of an address. */
1545 class SimpleAddressType { 1617 class SimpleAddressType {
1546 /** The city or town for the address. */ 1618 /** The city or town for the address. */
1547 core.String city; 1619 core.String city;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 _json["name"] = name; 1719 _json["name"] = name;
1648 } 1720 }
1649 if (official != null) { 1721 if (official != null) {
1650 _json["official"] = official; 1722 _json["official"] = official;
1651 } 1723 }
1652 return _json; 1724 return _json;
1653 } 1725 }
1654 } 1726 }
1655 1727
1656 1728
1657 /** A request for information about a voter. */
1658 class VoterInfoRequest {
1659 /** The registered address of the voter to look up. */
1660 core.String address;
1661
1662
1663 VoterInfoRequest();
1664
1665 VoterInfoRequest.fromJson(core.Map _json) {
1666 if (_json.containsKey("address")) {
1667 address = _json["address"];
1668 }
1669 }
1670
1671 core.Map toJson() {
1672 var _json = new core.Map();
1673 if (address != null) {
1674 _json["address"] = address;
1675 }
1676 return _json;
1677 }
1678 }
1679
1680
1681 /** The result of a voter info lookup query. */ 1729 /** The result of a voter info lookup query. */
1682 class VoterInfoResponse { 1730 class VoterInfoResponse {
1683 /** Contests that will appear on the voter's ballot */ 1731 /** Contests that will appear on the voter's ballot */
1684 core.List<Contest> contests; 1732 core.List<Contest> contests;
1685 1733
1686 /** 1734 /**
1687 * Locations where the voter is eligible to vote early, prior to election day 1735 * Locations where the voter is eligible to vote early, prior to election day
1688 */ 1736 */
1689 core.List<PollingLocation> earlyVoteSites; 1737 core.List<PollingLocation> earlyVoteSites;
1690 1738
1691 /** The election that was queried. */ 1739 /** The election that was queried. */
1692 Election election; 1740 Election election;
1693 1741
1694 /** 1742 /**
1695 * Identifies what kind of resource this is. Value: the fixed string 1743 * Identifies what kind of resource this is. Value: the fixed string
1696 * "civicinfo#voterInfoResponse". 1744 * "civicinfo#voterInfoResponse".
1697 */ 1745 */
1698 core.String kind; 1746 core.String kind;
1699 1747
1700 /** The normalized version of the requested address */ 1748 /** The normalized version of the requested address */
1701 SimpleAddressType normalizedInput; 1749 SimpleAddressType normalizedInput;
1702 1750
1703 /** 1751 /**
1752 * If no election ID was specified in the query, and there was more than one
1753 * election with data for the given voter, this will contain information about
1754 * the other elections that could apply.
1755 */
1756 core.List<Election> otherElections;
1757
1758 /**
1704 * Locations where the voter is eligible to vote on election day. For states 1759 * Locations where the voter is eligible to vote on election day. For states
1705 * with mail-in voting only, these locations will be nearby drop box 1760 * with mail-in voting only, these locations will be nearby drop box
1706 * locations. Drop box locations are free to the voter and may be used instead 1761 * locations. Drop box locations are free to the voter and may be used instead
1707 * of placing the ballot in the mail. 1762 * of placing the ballot in the mail.
1708 */ 1763 */
1709 core.List<PollingLocation> pollingLocations; 1764 core.List<PollingLocation> pollingLocations;
1710 1765
1766 /** Not documented yet. */
1767 core.String precinctId;
1768
1711 /** 1769 /**
1712 * Local Election Information for the state that the voter votes in. For the 1770 * Local Election Information for the state that the voter votes in. For the
1713 * US, there will only be one element in this array. 1771 * US, there will only be one element in this array.
1714 */ 1772 */
1715 core.List<AdministrationRegion> state; 1773 core.List<AdministrationRegion> state;
1716 1774
1717 /**
1718 * The result of the request. One of: success, noStreetSegmentFound,
1719 * addressUnparseable, noAddressParameter, multipleStreetSegmentsFound,
1720 * electionOver, electionUnknown, internalLookupFailure
1721 */
1722 core.String status;
1723
1724 1775
1725 VoterInfoResponse(); 1776 VoterInfoResponse();
1726 1777
1727 VoterInfoResponse.fromJson(core.Map _json) { 1778 VoterInfoResponse.fromJson(core.Map _json) {
1728 if (_json.containsKey("contests")) { 1779 if (_json.containsKey("contests")) {
1729 contests = _json["contests"].map((value) => new Contest.fromJson(value)).t oList(); 1780 contests = _json["contests"].map((value) => new Contest.fromJson(value)).t oList();
1730 } 1781 }
1731 if (_json.containsKey("earlyVoteSites")) { 1782 if (_json.containsKey("earlyVoteSites")) {
1732 earlyVoteSites = _json["earlyVoteSites"].map((value) => new PollingLocatio n.fromJson(value)).toList(); 1783 earlyVoteSites = _json["earlyVoteSites"].map((value) => new PollingLocatio n.fromJson(value)).toList();
1733 } 1784 }
1734 if (_json.containsKey("election")) { 1785 if (_json.containsKey("election")) {
1735 election = new Election.fromJson(_json["election"]); 1786 election = new Election.fromJson(_json["election"]);
1736 } 1787 }
1737 if (_json.containsKey("kind")) { 1788 if (_json.containsKey("kind")) {
1738 kind = _json["kind"]; 1789 kind = _json["kind"];
1739 } 1790 }
1740 if (_json.containsKey("normalizedInput")) { 1791 if (_json.containsKey("normalizedInput")) {
1741 normalizedInput = new SimpleAddressType.fromJson(_json["normalizedInput"]) ; 1792 normalizedInput = new SimpleAddressType.fromJson(_json["normalizedInput"]) ;
1742 } 1793 }
1794 if (_json.containsKey("otherElections")) {
1795 otherElections = _json["otherElections"].map((value) => new Election.fromJ son(value)).toList();
1796 }
1743 if (_json.containsKey("pollingLocations")) { 1797 if (_json.containsKey("pollingLocations")) {
1744 pollingLocations = _json["pollingLocations"].map((value) => new PollingLoc ation.fromJson(value)).toList(); 1798 pollingLocations = _json["pollingLocations"].map((value) => new PollingLoc ation.fromJson(value)).toList();
1745 } 1799 }
1800 if (_json.containsKey("precinctId")) {
1801 precinctId = _json["precinctId"];
1802 }
1746 if (_json.containsKey("state")) { 1803 if (_json.containsKey("state")) {
1747 state = _json["state"].map((value) => new AdministrationRegion.fromJson(va lue)).toList(); 1804 state = _json["state"].map((value) => new AdministrationRegion.fromJson(va lue)).toList();
1748 } 1805 }
1749 if (_json.containsKey("status")) {
1750 status = _json["status"];
1751 }
1752 } 1806 }
1753 1807
1754 core.Map toJson() { 1808 core.Map toJson() {
1755 var _json = new core.Map(); 1809 var _json = new core.Map();
1756 if (contests != null) { 1810 if (contests != null) {
1757 _json["contests"] = contests.map((value) => (value).toJson()).toList(); 1811 _json["contests"] = contests.map((value) => (value).toJson()).toList();
1758 } 1812 }
1759 if (earlyVoteSites != null) { 1813 if (earlyVoteSites != null) {
1760 _json["earlyVoteSites"] = earlyVoteSites.map((value) => (value).toJson()). toList(); 1814 _json["earlyVoteSites"] = earlyVoteSites.map((value) => (value).toJson()). toList();
1761 } 1815 }
1762 if (election != null) { 1816 if (election != null) {
1763 _json["election"] = (election).toJson(); 1817 _json["election"] = (election).toJson();
1764 } 1818 }
1765 if (kind != null) { 1819 if (kind != null) {
1766 _json["kind"] = kind; 1820 _json["kind"] = kind;
1767 } 1821 }
1768 if (normalizedInput != null) { 1822 if (normalizedInput != null) {
1769 _json["normalizedInput"] = (normalizedInput).toJson(); 1823 _json["normalizedInput"] = (normalizedInput).toJson();
1770 } 1824 }
1825 if (otherElections != null) {
1826 _json["otherElections"] = otherElections.map((value) => (value).toJson()). toList();
1827 }
1771 if (pollingLocations != null) { 1828 if (pollingLocations != null) {
1772 _json["pollingLocations"] = pollingLocations.map((value) => (value).toJson ()).toList(); 1829 _json["pollingLocations"] = pollingLocations.map((value) => (value).toJson ()).toList();
1773 } 1830 }
1831 if (precinctId != null) {
1832 _json["precinctId"] = precinctId;
1833 }
1774 if (state != null) { 1834 if (state != null) {
1775 _json["state"] = state.map((value) => (value).toJson()).toList(); 1835 _json["state"] = state.map((value) => (value).toJson()).toList();
1776 } 1836 }
1777 if (status != null) {
1778 _json["status"] = status;
1779 }
1780 return _json; 1837 return _json;
1781 } 1838 }
1782 } 1839 }
1783 1840
1784 1841
OLDNEW
« no previous file with comments | « generated/googleapis/lib/civicinfo/v1.dart ('k') | generated/googleapis/lib/src/common_internal.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698