~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/google.golang.org/api/civicinfo/v1/civicinfo-gen.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Package civicinfo provides access to the Google Civic Information API.
 
2
//
 
3
// See https://developers.google.com/civic-information
 
4
//
 
5
// Usage example:
 
6
//
 
7
//   import "google.golang.org/api/civicinfo/v1"
 
8
//   ...
 
9
//   civicinfoService, err := civicinfo.New(oauthHttpClient)
 
10
package civicinfo
 
11
 
 
12
import (
 
13
        "bytes"
 
14
        "encoding/json"
 
15
        "errors"
 
16
        "fmt"
 
17
        "google.golang.org/api/googleapi"
 
18
        "io"
 
19
        "net/http"
 
20
        "net/url"
 
21
        "strconv"
 
22
        "strings"
 
23
)
 
24
 
 
25
// Always reference these packages, just in case the auto-generated code
 
26
// below doesn't.
 
27
var _ = bytes.NewBuffer
 
28
var _ = strconv.Itoa
 
29
var _ = fmt.Sprintf
 
30
var _ = json.NewDecoder
 
31
var _ = io.Copy
 
32
var _ = url.Parse
 
33
var _ = googleapi.Version
 
34
var _ = errors.New
 
35
var _ = strings.Replace
 
36
 
 
37
const apiId = "civicinfo:v1"
 
38
const apiName = "civicinfo"
 
39
const apiVersion = "v1"
 
40
const basePath = "https://www.googleapis.com/civicinfo/v1/"
 
41
 
 
42
func New(client *http.Client) (*Service, error) {
 
43
        if client == nil {
 
44
                return nil, errors.New("client is nil")
 
45
        }
 
46
        s := &Service{client: client, BasePath: basePath}
 
47
        s.Divisions = NewDivisionsService(s)
 
48
        s.Elections = NewElectionsService(s)
 
49
        s.Representatives = NewRepresentativesService(s)
 
50
        return s, nil
 
51
}
 
52
 
 
53
type Service struct {
 
54
        client   *http.Client
 
55
        BasePath string // API endpoint base URL
 
56
 
 
57
        Divisions *DivisionsService
 
58
 
 
59
        Elections *ElectionsService
 
60
 
 
61
        Representatives *RepresentativesService
 
62
}
 
63
 
 
64
func NewDivisionsService(s *Service) *DivisionsService {
 
65
        rs := &DivisionsService{s: s}
 
66
        return rs
 
67
}
 
68
 
 
69
type DivisionsService struct {
 
70
        s *Service
 
71
}
 
72
 
 
73
func NewElectionsService(s *Service) *ElectionsService {
 
74
        rs := &ElectionsService{s: s}
 
75
        return rs
 
76
}
 
77
 
 
78
type ElectionsService struct {
 
79
        s *Service
 
80
}
 
81
 
 
82
func NewRepresentativesService(s *Service) *RepresentativesService {
 
83
        rs := &RepresentativesService{s: s}
 
84
        return rs
 
85
}
 
86
 
 
87
type RepresentativesService struct {
 
88
        s *Service
 
89
}
 
90
 
 
91
type AdministrationRegion struct {
 
92
        // ElectionAdministrationBody: The election administration body for this
 
93
        // area.
 
94
        ElectionAdministrationBody *AdministrativeBody `json:"electionAdministrationBody,omitempty"`
 
95
 
 
96
        // Id: An ID for this object. IDs may change in future requests and
 
97
        // should not be cached. Access to this field requires special access
 
98
        // that can be requested from the Request more link on the Quotas page.
 
99
        Id string `json:"id,omitempty"`
 
100
 
 
101
        // Local_jurisdiction: The city or county that provides election
 
102
        // information for this voter. This object can have the same elements as
 
103
        // state.
 
104
        Local_jurisdiction *AdministrationRegion `json:"local_jurisdiction,omitempty"`
 
105
 
 
106
        // Name: The name of the jurisdiction.
 
107
        Name string `json:"name,omitempty"`
 
108
 
 
109
        // Sources: A list of sources for this area. If multiple sources are
 
110
        // listed the data has been aggregated from those sources.
 
111
        Sources []*Source `json:"sources,omitempty"`
 
112
}
 
113
 
 
114
type AdministrativeBody struct {
 
115
        // AbsenteeVotingInfoUrl: A URL provided by this administrative body for
 
116
        // information on absentee voting.
 
117
        AbsenteeVotingInfoUrl string `json:"absenteeVotingInfoUrl,omitempty"`
 
118
 
 
119
        // BallotInfoUrl: A URL provided by this administrative body to give
 
120
        // contest information to the voter.
 
121
        BallotInfoUrl string `json:"ballotInfoUrl,omitempty"`
 
122
 
 
123
        // CorrespondenceAddress: The mailing address of this administrative
 
124
        // body.
 
125
        CorrespondenceAddress *SimpleAddressType `json:"correspondenceAddress,omitempty"`
 
126
 
 
127
        // ElectionInfoUrl: A URL provided by this administrative body for
 
128
        // looking up general election information.
 
129
        ElectionInfoUrl string `json:"electionInfoUrl,omitempty"`
 
130
 
 
131
        // ElectionOfficials: The election officials for this election
 
132
        // administrative body.
 
133
        ElectionOfficials []*ElectionOfficial `json:"electionOfficials,omitempty"`
 
134
 
 
135
        // ElectionRegistrationConfirmationUrl: A URL provided by this
 
136
        // administrative body for confirming that the voter is registered to
 
137
        // vote.
 
138
        ElectionRegistrationConfirmationUrl string `json:"electionRegistrationConfirmationUrl,omitempty"`
 
139
 
 
140
        // ElectionRegistrationUrl: A URL provided by this administrative body
 
141
        // for looking up how to register to vote.
 
142
        ElectionRegistrationUrl string `json:"electionRegistrationUrl,omitempty"`
 
143
 
 
144
        // ElectionRulesUrl: A URL provided by this administrative body
 
145
        // describing election rules to the voter.
 
146
        ElectionRulesUrl string `json:"electionRulesUrl,omitempty"`
 
147
 
 
148
        // HoursOfOperation: A description of the hours of operation for this
 
149
        // administrative body.
 
150
        HoursOfOperation string `json:"hoursOfOperation,omitempty"`
 
151
 
 
152
        // Name: The name of this election administrative body.
 
153
        Name string `json:"name,omitempty"`
 
154
 
 
155
        // PhysicalAddress: The physical address of this administrative body.
 
156
        PhysicalAddress *SimpleAddressType `json:"physicalAddress,omitempty"`
 
157
 
 
158
        // Voter_services: A description of the services this administrative
 
159
        // body may provide.
 
160
        Voter_services []string `json:"voter_services,omitempty"`
 
161
 
 
162
        // VotingLocationFinderUrl: A URL provided by this administrative body
 
163
        // for looking up where to vote.
 
164
        VotingLocationFinderUrl string `json:"votingLocationFinderUrl,omitempty"`
 
165
}
 
166
 
 
167
type Candidate struct {
 
168
        // CandidateUrl: The URL for the candidate's campaign web site.
 
169
        CandidateUrl string `json:"candidateUrl,omitempty"`
 
170
 
 
171
        // Channels: A list of known (social) media channels for this candidate.
 
172
        Channels []*Channel `json:"channels,omitempty"`
 
173
 
 
174
        // Email: The email address for the candidate's campaign.
 
175
        Email string `json:"email,omitempty"`
 
176
 
 
177
        // Name: The candidate's name.
 
178
        Name string `json:"name,omitempty"`
 
179
 
 
180
        // OrderOnBallot: The order the candidate appears on the ballot for this
 
181
        // contest.
 
182
        OrderOnBallot int64 `json:"orderOnBallot,omitempty,string"`
 
183
 
 
184
        // Party: The full name of the party the candidate is a member of.
 
185
        Party string `json:"party,omitempty"`
 
186
 
 
187
        // Phone: The voice phone number for the candidate's campaign office.
 
188
        Phone string `json:"phone,omitempty"`
 
189
 
 
190
        // PhotoUrl: A URL for a photo of the candidate.
 
191
        PhotoUrl string `json:"photoUrl,omitempty"`
 
192
}
 
193
 
 
194
type Channel struct {
 
195
        // Id: The unique public identifier for the candidate's channel.
 
196
        Id string `json:"id,omitempty"`
 
197
 
 
198
        // Type: The type of channel. The following is a list of types of
 
199
        // channels, but is not exhaustive. More channel types may be added at a
 
200
        // later time. One of: GooglePlus, YouTube, Facebook, Twitter
 
201
        Type string `json:"type,omitempty"`
 
202
}
 
203
 
 
204
type Contest struct {
 
205
        // BallotPlacement: A number specifying the position of this contest on
 
206
        // the voter's ballot.
 
207
        BallotPlacement int64 `json:"ballotPlacement,omitempty,string"`
 
208
 
 
209
        // Candidates: The candidate choices for this contest.
 
210
        Candidates []*Candidate `json:"candidates,omitempty"`
 
211
 
 
212
        // District: Information about the electoral district that this contest
 
213
        // is in.
 
214
        District *ElectoralDistrict `json:"district,omitempty"`
 
215
 
 
216
        // ElectorateSpecifications: A description of any additional eligibility
 
217
        // requirements for voting in this contest.
 
218
        ElectorateSpecifications string `json:"electorateSpecifications,omitempty"`
 
219
 
 
220
        // Id: An ID for this object. IDs may change in future requests and
 
221
        // should not be cached. Access to this field requires special access
 
222
        // that can be requested from the Request more link on the Quotas page.
 
223
        Id string `json:"id,omitempty"`
 
224
 
 
225
        // Level: The level of office for this contest. One of: federal, state,
 
226
        // county, city, other
 
227
        Level string `json:"level,omitempty"`
 
228
 
 
229
        // NumberElected: The number of candidates that will be elected to
 
230
        // office in this contest.
 
231
        NumberElected int64 `json:"numberElected,omitempty,string"`
 
232
 
 
233
        // NumberVotingFor: The number of candidates that a voter may vote for
 
234
        // in this contest.
 
235
        NumberVotingFor int64 `json:"numberVotingFor,omitempty,string"`
 
236
 
 
237
        // Office: The name of the office for this contest.
 
238
        Office string `json:"office,omitempty"`
 
239
 
 
240
        // PrimaryParty: If this is a partisan election, the name of the party
 
241
        // it is for.
 
242
        PrimaryParty string `json:"primaryParty,omitempty"`
 
243
 
 
244
        // ReferendumSubtitle: A brief description of the referendum. This field
 
245
        // is only populated for contests of type 'Referendum'.
 
246
        ReferendumSubtitle string `json:"referendumSubtitle,omitempty"`
 
247
 
 
248
        // ReferendumTitle: The title of the referendum (e.g. 'Proposition 42').
 
249
        // This field is only populated for contests of type 'Referendum'.
 
250
        ReferendumTitle string `json:"referendumTitle,omitempty"`
 
251
 
 
252
        // ReferendumUrl: A link to the referendum. This field is only populated
 
253
        // for contests of type 'Referendum'.
 
254
        ReferendumUrl string `json:"referendumUrl,omitempty"`
 
255
 
 
256
        // Sources: A list of sources for this contest. If multiple sources are
 
257
        // listed, the data has been aggregated from those sources.
 
258
        Sources []*Source `json:"sources,omitempty"`
 
259
 
 
260
        // Special: "Yes" or "No" depending on whether this a contest being held
 
261
        // outside the normal election cycle.
 
262
        Special string `json:"special,omitempty"`
 
263
 
 
264
        // Type: The type of contest. Usually this will be 'General', 'Primary',
 
265
        // or 'Run-off' for contests with candidates. For referenda this will be
 
266
        // 'Referendum'.
 
267
        Type string `json:"type,omitempty"`
 
268
}
 
269
 
 
270
type DivisionSearchResponse struct {
 
271
        // Kind: Identifies what kind of resource this is. Value: the fixed
 
272
        // string "civicinfo#divisionSearchResponse".
 
273
        Kind string `json:"kind,omitempty"`
 
274
 
 
275
        Results []*DivisionSearchResult `json:"results,omitempty"`
 
276
 
 
277
        // Status: The result of the request. One of: success,
 
278
        // addressUnparseable, noAddressParameter, internalLookupFailure
 
279
        Status string `json:"status,omitempty"`
 
280
}
 
281
 
 
282
type DivisionSearchResult struct {
 
283
        // Aliases: Other Open Civic Data identifiers that refer to the same
 
284
        // division -- for example, those that refer to other political
 
285
        // divisions whose boundaries are defined to be coterminous with this
 
286
        // one. For example, ocd-division/country:us/state:wy will include an
 
287
        // alias of ocd-division/country:us/state:wy/cd:1, since Wyoming has
 
288
        // only one Congressional district.
 
289
        Aliases []string `json:"aliases,omitempty"`
 
290
 
 
291
        // Name: The name of the division.
 
292
        Name string `json:"name,omitempty"`
 
293
 
 
294
        // OcdId: The unique Open Civic Data identifier for this division.
 
295
        OcdId string `json:"ocdId,omitempty"`
 
296
}
 
297
 
 
298
type Election struct {
 
299
        // ElectionDay: Day of the election in YYYY-MM-DD format.
 
300
        ElectionDay string `json:"electionDay,omitempty"`
 
301
 
 
302
        // Id: The unique ID of this election.
 
303
        Id int64 `json:"id,omitempty,string"`
 
304
 
 
305
        // Name: A displayable name for the election.
 
306
        Name string `json:"name,omitempty"`
 
307
}
 
308
 
 
309
type ElectionOfficial struct {
 
310
        // EmailAddress: The email address of the election official.
 
311
        EmailAddress string `json:"emailAddress,omitempty"`
 
312
 
 
313
        // FaxNumber: The fax number of the election official.
 
314
        FaxNumber string `json:"faxNumber,omitempty"`
 
315
 
 
316
        // Name: The full name of the election official.
 
317
        Name string `json:"name,omitempty"`
 
318
 
 
319
        // OfficePhoneNumber: The office phone number of the election official.
 
320
        OfficePhoneNumber string `json:"officePhoneNumber,omitempty"`
 
321
 
 
322
        // Title: The title of the election official.
 
323
        Title string `json:"title,omitempty"`
 
324
}
 
325
 
 
326
type ElectionsQueryResponse struct {
 
327
        // Elections: A list of available elections
 
328
        Elections []*Election `json:"elections,omitempty"`
 
329
 
 
330
        // Kind: Identifies what kind of resource this is. Value: the fixed
 
331
        // string "civicinfo#electionsQueryResponse".
 
332
        Kind string `json:"kind,omitempty"`
 
333
}
 
334
 
 
335
type ElectoralDistrict struct {
 
336
        // Id: An identifier for this district, relative to its scope. For
 
337
        // example, the 34th State Senate district would have id "34" and a
 
338
        // scope of stateUpper.
 
339
        Id string `json:"id,omitempty"`
 
340
 
 
341
        // Name: The name of the district.
 
342
        Name string `json:"name,omitempty"`
 
343
 
 
344
        // Scope: The geographic scope of this district. If unspecified the
 
345
        // district's geography is not known. One of: national, statewide,
 
346
        // congressional, stateUpper, stateLower, countywide, judicial,
 
347
        // schoolBoard, cityWide, township, countyCouncil, cityCouncil, ward,
 
348
        // special
 
349
        Scope string `json:"scope,omitempty"`
 
350
}
 
351
 
 
352
type GeographicDivision struct {
 
353
        // AlsoKnownAs: Any other valid OCD IDs that refer to the same
 
354
        // division.
 
355
        //
 
356
        // Because OCD IDs are meant to be human-readable and at
 
357
        // least somewhat predictable, there are occasionally several
 
358
        // identifiers for a single division. These identifiers are defined to
 
359
        // be equivalent to one another, and one is always indicated as the
 
360
        // primary identifier. The primary identifier will be returned in ocd_id
 
361
        // above, and any other equivalent valid identifiers will be returned in
 
362
        // this list.
 
363
        //
 
364
        // For example, if this division's OCD ID is
 
365
        // ocd-division/country:us/district:dc, this will contain
 
366
        // ocd-division/country:us/state:dc.
 
367
        AlsoKnownAs []string `json:"alsoKnownAs,omitempty"`
 
368
 
 
369
        // Name: The name of the division.
 
370
        Name string `json:"name,omitempty"`
 
371
 
 
372
        // OfficeIds: List of keys in the offices object, one for each office
 
373
        // elected from this division. Will only be present if includeOffices
 
374
        // was true (or absent) in the request.
 
375
        OfficeIds []string `json:"officeIds,omitempty"`
 
376
 
 
377
        // Scope: The geographic scope of the division. If unspecified, the
 
378
        // division's geography is not known. One of: national, statewide,
 
379
        // congressional, stateUpper, stateLower, countywide, judicial,
 
380
        // schoolBoard, cityWide, township, countyCouncil, cityCouncil, ward,
 
381
        // special
 
382
        Scope string `json:"scope,omitempty"`
 
383
}
 
384
 
 
385
type Office struct {
 
386
        // DivisionId: The OCD ID of the division with which this office is
 
387
        // associated.
 
388
        DivisionId string `json:"divisionId,omitempty"`
 
389
 
 
390
        // Level: The level of this elected office. One of: federal, state,
 
391
        // county, city, other
 
392
        Level string `json:"level,omitempty"`
 
393
 
 
394
        // Name: The human-readable name of the office.
 
395
        Name string `json:"name,omitempty"`
 
396
 
 
397
        // OfficialIds: List of keys in the officials object of people who
 
398
        // presently hold this office.
 
399
        OfficialIds []string `json:"officialIds,omitempty"`
 
400
 
 
401
        // Sources: A list of sources for this office. If multiple sources are
 
402
        // listed, the data has been aggregated from those sources.
 
403
        Sources []*Source `json:"sources,omitempty"`
 
404
}
 
405
 
 
406
type Official struct {
 
407
        // Address: Addresses at which to contact the official.
 
408
        Address []*SimpleAddressType `json:"address,omitempty"`
 
409
 
 
410
        // Channels: A list of known (social) media channels for this official.
 
411
        Channels []*Channel `json:"channels,omitempty"`
 
412
 
 
413
        // Emails: The direct email addresses for the official.
 
414
        Emails []string `json:"emails,omitempty"`
 
415
 
 
416
        // Name: The official's name.
 
417
        Name string `json:"name,omitempty"`
 
418
 
 
419
        // Party: The full name of the party the official belongs to.
 
420
        Party string `json:"party,omitempty"`
 
421
 
 
422
        // Phones: The official's public contact phone numbers.
 
423
        Phones []string `json:"phones,omitempty"`
 
424
 
 
425
        // PhotoUrl: A URL for a photo of the official.
 
426
        PhotoUrl string `json:"photoUrl,omitempty"`
 
427
 
 
428
        // Urls: The official's public website URLs.
 
429
        Urls []string `json:"urls,omitempty"`
 
430
}
 
431
 
 
432
type PollingLocation struct {
 
433
        // Address: The address of the location.
 
434
        Address *SimpleAddressType `json:"address,omitempty"`
 
435
 
 
436
        // EndDate: The last date that this early vote site or drop off location
 
437
        // may be used. This field is not populated for polling locations.
 
438
        EndDate string `json:"endDate,omitempty"`
 
439
 
 
440
        // Id: An ID for this object. IDs may change in future requests and
 
441
        // should not be cached. Access to this field requires special access
 
442
        // that can be requested from the Request more link on the Quotas page.
 
443
        Id string `json:"id,omitempty"`
 
444
 
 
445
        // Name: The name of the early vote site or drop off location. This
 
446
        // field is not populated for polling locations.
 
447
        Name string `json:"name,omitempty"`
 
448
 
 
449
        // Notes: Notes about this location (e.g. accessibility ramp or entrance
 
450
        // to use).
 
451
        Notes string `json:"notes,omitempty"`
 
452
 
 
453
        // PollingHours: A description of when this location is open.
 
454
        PollingHours string `json:"pollingHours,omitempty"`
 
455
 
 
456
        // Sources: A list of sources for this location. If multiple sources are
 
457
        // listed the data has been aggregated from those sources.
 
458
        Sources []*Source `json:"sources,omitempty"`
 
459
 
 
460
        // StartDate: The first date that this early vote site or drop off
 
461
        // location may be used. This field is not populated for polling
 
462
        // locations.
 
463
        StartDate string `json:"startDate,omitempty"`
 
464
 
 
465
        // VoterServices: The services provided by this early vote site or drop
 
466
        // off location. This field is not populated for polling locations.
 
467
        VoterServices string `json:"voterServices,omitempty"`
 
468
}
 
469
 
 
470
type RepresentativeInfoRequest struct {
 
471
        // Address: The address to look up. May only be specified if the field
 
472
        // ocdId is not given in the URL.
 
473
        Address string `json:"address,omitempty"`
 
474
}
 
475
 
 
476
type RepresentativeInfoResponse struct {
 
477
        // Divisions: Political geographic divisions that contain the requested
 
478
        // address.
 
479
        Divisions map[string]GeographicDivision `json:"divisions,omitempty"`
 
480
 
 
481
        // Kind: Identifies what kind of resource this is. Value: the fixed
 
482
        // string "civicinfo#representativeInfoResponse".
 
483
        Kind string `json:"kind,omitempty"`
 
484
 
 
485
        // NormalizedInput: The normalized version of the requested address
 
486
        NormalizedInput *SimpleAddressType `json:"normalizedInput,omitempty"`
 
487
 
 
488
        // Offices: Elected offices referenced by the divisions listed above.
 
489
        // Will only be present if includeOffices was true in the request.
 
490
        Offices map[string]Office `json:"offices,omitempty"`
 
491
 
 
492
        // Officials: Officials holding the offices listed above. Will only be
 
493
        // present if includeOffices was true in the request.
 
494
        Officials map[string]Official `json:"officials,omitempty"`
 
495
 
 
496
        // Status: The result of the request. One of: success,
 
497
        // noStreetSegmentFound, addressUnparseable, noAddressParameter,
 
498
        // multipleStreetSegmentsFound, electionOver, electionUnknown,
 
499
        // internalLookupFailure, RequestedBothAddressAndOcdId
 
500
        Status string `json:"status,omitempty"`
 
501
}
 
502
 
 
503
type SimpleAddressType struct {
 
504
        // City: The city or town for the address.
 
505
        City string `json:"city,omitempty"`
 
506
 
 
507
        // Line1: The street name and number of this address.
 
508
        Line1 string `json:"line1,omitempty"`
 
509
 
 
510
        // Line2: The second line the address, if needed.
 
511
        Line2 string `json:"line2,omitempty"`
 
512
 
 
513
        // Line3: The third line of the address, if needed.
 
514
        Line3 string `json:"line3,omitempty"`
 
515
 
 
516
        // LocationName: The name of the location.
 
517
        LocationName string `json:"locationName,omitempty"`
 
518
 
 
519
        // State: The US two letter state abbreviation of the address.
 
520
        State string `json:"state,omitempty"`
 
521
 
 
522
        // Zip: The US Postal Zip Code of the address.
 
523
        Zip string `json:"zip,omitempty"`
 
524
}
 
525
 
 
526
type Source struct {
 
527
        // Name: The name of the data source.
 
528
        Name string `json:"name,omitempty"`
 
529
 
 
530
        // Official: Whether this data comes from an official government source.
 
531
        Official bool `json:"official,omitempty"`
 
532
}
 
533
 
 
534
type VoterInfoRequest struct {
 
535
        // Address: The registered address of the voter to look up.
 
536
        Address string `json:"address,omitempty"`
 
537
}
 
538
 
 
539
type VoterInfoResponse struct {
 
540
        // Contests: Contests that will appear on the voter's ballot.
 
541
        Contests []*Contest `json:"contests,omitempty"`
 
542
 
 
543
        // DropOffLocations: Locations where a voter is eligible to drop off a
 
544
        // completed ballot. The voter must have received and completed a ballot
 
545
        // prior to arriving at the location. The location may not have ballots
 
546
        // available on the premises. These locations could be open on or before
 
547
        // election day as indicated in the pollingHours field.
 
548
        DropOffLocations []*PollingLocation `json:"dropOffLocations,omitempty"`
 
549
 
 
550
        // EarlyVoteSites: Locations where the voter is eligible to vote early,
 
551
        // prior to election day.
 
552
        EarlyVoteSites []*PollingLocation `json:"earlyVoteSites,omitempty"`
 
553
 
 
554
        // Election: The election that was queried.
 
555
        Election *Election `json:"election,omitempty"`
 
556
 
 
557
        // Kind: Identifies what kind of resource this is. Value: the fixed
 
558
        // string "civicinfo#voterInfoResponse".
 
559
        Kind string `json:"kind,omitempty"`
 
560
 
 
561
        // NormalizedInput: The normalized version of the requested address
 
562
        NormalizedInput *SimpleAddressType `json:"normalizedInput,omitempty"`
 
563
 
 
564
        // PollingLocations: Locations where the voter is eligible to vote on
 
565
        // election day.
 
566
        PollingLocations []*PollingLocation `json:"pollingLocations,omitempty"`
 
567
 
 
568
        PrecinctId string `json:"precinctId,omitempty"`
 
569
 
 
570
        // State: Local Election Information for the state that the voter votes
 
571
        // in. For the US, there will only be one element in this array.
 
572
        State []*AdministrationRegion `json:"state,omitempty"`
 
573
 
 
574
        // Status: The result of the request. One of: success,
 
575
        // noStreetSegmentFound, addressUnparseable, noAddressParameter,
 
576
        // multipleStreetSegmentsFound, electionOver, electionUnknown,
 
577
        // internalLookupFailure
 
578
        Status string `json:"status,omitempty"`
 
579
}
 
580
 
 
581
// method id "civicinfo.divisions.search":
 
582
 
 
583
type DivisionsSearchCall struct {
 
584
        s    *Service
 
585
        opt_ map[string]interface{}
 
586
}
 
587
 
 
588
// Search: Searches for political divisions by their natural name or OCD
 
589
// ID.
 
590
func (r *DivisionsService) Search() *DivisionsSearchCall {
 
591
        c := &DivisionsSearchCall{s: r.s, opt_: make(map[string]interface{})}
 
592
        return c
 
593
}
 
594
 
 
595
// Query sets the optional parameter "query": The search query. Queries
 
596
// can cover any parts of a OCD ID or a human readable division name.
 
597
// All words given in the query are treated as required patterns. In
 
598
// addition to that, most query operators of the Apache Lucene library
 
599
// are supported. See
 
600
// http://lucene.apache.org/core/2_9_4/queryparsersyntax.html
 
601
func (c *DivisionsSearchCall) Query(query string) *DivisionsSearchCall {
 
602
        c.opt_["query"] = query
 
603
        return c
 
604
}
 
605
 
 
606
// Fields allows partial responses to be retrieved.
 
607
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
608
// for more information.
 
609
func (c *DivisionsSearchCall) Fields(s ...googleapi.Field) *DivisionsSearchCall {
 
610
        c.opt_["fields"] = googleapi.CombineFields(s)
 
611
        return c
 
612
}
 
613
 
 
614
func (c *DivisionsSearchCall) Do() (*DivisionSearchResponse, error) {
 
615
        var body io.Reader = nil
 
616
        params := make(url.Values)
 
617
        params.Set("alt", "json")
 
618
        if v, ok := c.opt_["query"]; ok {
 
619
                params.Set("query", fmt.Sprintf("%v", v))
 
620
        }
 
621
        if v, ok := c.opt_["fields"]; ok {
 
622
                params.Set("fields", fmt.Sprintf("%v", v))
 
623
        }
 
624
        urls := googleapi.ResolveRelative(c.s.BasePath, "representatives/division_search")
 
625
        urls += "?" + params.Encode()
 
626
        req, _ := http.NewRequest("GET", urls, body)
 
627
        googleapi.SetOpaque(req.URL)
 
628
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
629
        res, err := c.s.client.Do(req)
 
630
        if err != nil {
 
631
                return nil, err
 
632
        }
 
633
        defer googleapi.CloseBody(res)
 
634
        if err := googleapi.CheckResponse(res); err != nil {
 
635
                return nil, err
 
636
        }
 
637
        var ret *DivisionSearchResponse
 
638
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
639
                return nil, err
 
640
        }
 
641
        return ret, nil
 
642
        // {
 
643
        //   "description": "Searches for political divisions by their natural name or OCD ID.",
 
644
        //   "httpMethod": "GET",
 
645
        //   "id": "civicinfo.divisions.search",
 
646
        //   "parameters": {
 
647
        //     "query": {
 
648
        //       "description": "The search query. Queries can cover any parts of a OCD ID or a human readable division name. All words given in the query are treated as required patterns. In addition to that, most query operators of the Apache Lucene library are supported. See http://lucene.apache.org/core/2_9_4/queryparsersyntax.html",
 
649
        //       "location": "query",
 
650
        //       "type": "string"
 
651
        //     }
 
652
        //   },
 
653
        //   "path": "representatives/division_search",
 
654
        //   "response": {
 
655
        //     "$ref": "DivisionSearchResponse"
 
656
        //   }
 
657
        // }
 
658
 
 
659
}
 
660
 
 
661
// method id "civicinfo.elections.electionQuery":
 
662
 
 
663
type ElectionsElectionQueryCall struct {
 
664
        s    *Service
 
665
        opt_ map[string]interface{}
 
666
}
 
667
 
 
668
// ElectionQuery: List of available elections to query.
 
669
func (r *ElectionsService) ElectionQuery() *ElectionsElectionQueryCall {
 
670
        c := &ElectionsElectionQueryCall{s: r.s, opt_: make(map[string]interface{})}
 
671
        return c
 
672
}
 
673
 
 
674
// Fields allows partial responses to be retrieved.
 
675
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
676
// for more information.
 
677
func (c *ElectionsElectionQueryCall) Fields(s ...googleapi.Field) *ElectionsElectionQueryCall {
 
678
        c.opt_["fields"] = googleapi.CombineFields(s)
 
679
        return c
 
680
}
 
681
 
 
682
func (c *ElectionsElectionQueryCall) Do() (*ElectionsQueryResponse, error) {
 
683
        var body io.Reader = nil
 
684
        params := make(url.Values)
 
685
        params.Set("alt", "json")
 
686
        if v, ok := c.opt_["fields"]; ok {
 
687
                params.Set("fields", fmt.Sprintf("%v", v))
 
688
        }
 
689
        urls := googleapi.ResolveRelative(c.s.BasePath, "elections")
 
690
        urls += "?" + params.Encode()
 
691
        req, _ := http.NewRequest("GET", urls, body)
 
692
        googleapi.SetOpaque(req.URL)
 
693
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
694
        res, err := c.s.client.Do(req)
 
695
        if err != nil {
 
696
                return nil, err
 
697
        }
 
698
        defer googleapi.CloseBody(res)
 
699
        if err := googleapi.CheckResponse(res); err != nil {
 
700
                return nil, err
 
701
        }
 
702
        var ret *ElectionsQueryResponse
 
703
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
704
                return nil, err
 
705
        }
 
706
        return ret, nil
 
707
        // {
 
708
        //   "description": "List of available elections to query.",
 
709
        //   "httpMethod": "GET",
 
710
        //   "id": "civicinfo.elections.electionQuery",
 
711
        //   "path": "elections",
 
712
        //   "response": {
 
713
        //     "$ref": "ElectionsQueryResponse"
 
714
        //   }
 
715
        // }
 
716
 
 
717
}
 
718
 
 
719
// method id "civicinfo.elections.voterInfoQuery":
 
720
 
 
721
type ElectionsVoterInfoQueryCall struct {
 
722
        s                *Service
 
723
        electionId       int64
 
724
        voterinforequest *VoterInfoRequest
 
725
        opt_             map[string]interface{}
 
726
}
 
727
 
 
728
// VoterInfoQuery: Looks up information relevant to a voter based on the
 
729
// voter's registered address.
 
730
func (r *ElectionsService) VoterInfoQuery(electionId int64, voterinforequest *VoterInfoRequest) *ElectionsVoterInfoQueryCall {
 
731
        c := &ElectionsVoterInfoQueryCall{s: r.s, opt_: make(map[string]interface{})}
 
732
        c.electionId = electionId
 
733
        c.voterinforequest = voterinforequest
 
734
        return c
 
735
}
 
736
 
 
737
// OfficialOnly sets the optional parameter "officialOnly": If set to
 
738
// true, only data from official state sources will be returned.
 
739
func (c *ElectionsVoterInfoQueryCall) OfficialOnly(officialOnly bool) *ElectionsVoterInfoQueryCall {
 
740
        c.opt_["officialOnly"] = officialOnly
 
741
        return c
 
742
}
 
743
 
 
744
// Fields allows partial responses to be retrieved.
 
745
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
746
// for more information.
 
747
func (c *ElectionsVoterInfoQueryCall) Fields(s ...googleapi.Field) *ElectionsVoterInfoQueryCall {
 
748
        c.opt_["fields"] = googleapi.CombineFields(s)
 
749
        return c
 
750
}
 
751
 
 
752
func (c *ElectionsVoterInfoQueryCall) Do() (*VoterInfoResponse, error) {
 
753
        var body io.Reader = nil
 
754
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.voterinforequest)
 
755
        if err != nil {
 
756
                return nil, err
 
757
        }
 
758
        ctype := "application/json"
 
759
        params := make(url.Values)
 
760
        params.Set("alt", "json")
 
761
        if v, ok := c.opt_["officialOnly"]; ok {
 
762
                params.Set("officialOnly", fmt.Sprintf("%v", v))
 
763
        }
 
764
        if v, ok := c.opt_["fields"]; ok {
 
765
                params.Set("fields", fmt.Sprintf("%v", v))
 
766
        }
 
767
        urls := googleapi.ResolveRelative(c.s.BasePath, "voterinfo/{electionId}/lookup")
 
768
        urls += "?" + params.Encode()
 
769
        req, _ := http.NewRequest("POST", urls, body)
 
770
        googleapi.Expand(req.URL, map[string]string{
 
771
                "electionId": strconv.FormatInt(c.electionId, 10),
 
772
        })
 
773
        req.Header.Set("Content-Type", ctype)
 
774
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
775
        res, err := c.s.client.Do(req)
 
776
        if err != nil {
 
777
                return nil, err
 
778
        }
 
779
        defer googleapi.CloseBody(res)
 
780
        if err := googleapi.CheckResponse(res); err != nil {
 
781
                return nil, err
 
782
        }
 
783
        var ret *VoterInfoResponse
 
784
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
785
                return nil, err
 
786
        }
 
787
        return ret, nil
 
788
        // {
 
789
        //   "description": "Looks up information relevant to a voter based on the voter's registered address.",
 
790
        //   "httpMethod": "POST",
 
791
        //   "id": "civicinfo.elections.voterInfoQuery",
 
792
        //   "parameterOrder": [
 
793
        //     "electionId"
 
794
        //   ],
 
795
        //   "parameters": {
 
796
        //     "electionId": {
 
797
        //       "description": "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",
 
798
        //       "format": "int64",
 
799
        //       "location": "path",
 
800
        //       "required": true,
 
801
        //       "type": "string"
 
802
        //     },
 
803
        //     "officialOnly": {
 
804
        //       "default": "false",
 
805
        //       "description": "If set to true, only data from official state sources will be returned.",
 
806
        //       "location": "query",
 
807
        //       "type": "boolean"
 
808
        //     }
 
809
        //   },
 
810
        //   "path": "voterinfo/{electionId}/lookup",
 
811
        //   "request": {
 
812
        //     "$ref": "VoterInfoRequest"
 
813
        //   },
 
814
        //   "response": {
 
815
        //     "$ref": "VoterInfoResponse"
 
816
        //   }
 
817
        // }
 
818
 
 
819
}
 
820
 
 
821
// method id "civicinfo.representatives.representativeInfoQuery":
 
822
 
 
823
type RepresentativesRepresentativeInfoQueryCall struct {
 
824
        s                         *Service
 
825
        representativeinforequest *RepresentativeInfoRequest
 
826
        opt_                      map[string]interface{}
 
827
}
 
828
 
 
829
// RepresentativeInfoQuery: Looks up political geography and
 
830
// representative information based on an address or Open Civic Data
 
831
// division identifier.
 
832
func (r *RepresentativesService) RepresentativeInfoQuery(representativeinforequest *RepresentativeInfoRequest) *RepresentativesRepresentativeInfoQueryCall {
 
833
        c := &RepresentativesRepresentativeInfoQueryCall{s: r.s, opt_: make(map[string]interface{})}
 
834
        c.representativeinforequest = representativeinforequest
 
835
        return c
 
836
}
 
837
 
 
838
// IncludeOffices sets the optional parameter "includeOffices": Whether
 
839
// to return information about offices and officials. If false, only the
 
840
// top-level district information will be returned.
 
841
func (c *RepresentativesRepresentativeInfoQueryCall) IncludeOffices(includeOffices bool) *RepresentativesRepresentativeInfoQueryCall {
 
842
        c.opt_["includeOffices"] = includeOffices
 
843
        return c
 
844
}
 
845
 
 
846
// OcdId sets the optional parameter "ocdId": The division to look up.
 
847
// May only be specified if the address field is not given in the
 
848
// request body.
 
849
func (c *RepresentativesRepresentativeInfoQueryCall) OcdId(ocdId string) *RepresentativesRepresentativeInfoQueryCall {
 
850
        c.opt_["ocdId"] = ocdId
 
851
        return c
 
852
}
 
853
 
 
854
// Recursive sets the optional parameter "recursive": When ocd_id is
 
855
// supplied, return all divisions which are hierarchically nested within
 
856
// the queried division. For example, if querying
 
857
// ocd-division/country:us/district:dc, this would also return all DC's
 
858
// wards and ANCs.
 
859
func (c *RepresentativesRepresentativeInfoQueryCall) Recursive(recursive bool) *RepresentativesRepresentativeInfoQueryCall {
 
860
        c.opt_["recursive"] = recursive
 
861
        return c
 
862
}
 
863
 
 
864
// Fields allows partial responses to be retrieved.
 
865
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
 
866
// for more information.
 
867
func (c *RepresentativesRepresentativeInfoQueryCall) Fields(s ...googleapi.Field) *RepresentativesRepresentativeInfoQueryCall {
 
868
        c.opt_["fields"] = googleapi.CombineFields(s)
 
869
        return c
 
870
}
 
871
 
 
872
func (c *RepresentativesRepresentativeInfoQueryCall) Do() (*RepresentativeInfoResponse, error) {
 
873
        var body io.Reader = nil
 
874
        body, err := googleapi.WithoutDataWrapper.JSONReader(c.representativeinforequest)
 
875
        if err != nil {
 
876
                return nil, err
 
877
        }
 
878
        ctype := "application/json"
 
879
        params := make(url.Values)
 
880
        params.Set("alt", "json")
 
881
        if v, ok := c.opt_["includeOffices"]; ok {
 
882
                params.Set("includeOffices", fmt.Sprintf("%v", v))
 
883
        }
 
884
        if v, ok := c.opt_["ocdId"]; ok {
 
885
                params.Set("ocdId", fmt.Sprintf("%v", v))
 
886
        }
 
887
        if v, ok := c.opt_["recursive"]; ok {
 
888
                params.Set("recursive", fmt.Sprintf("%v", v))
 
889
        }
 
890
        if v, ok := c.opt_["fields"]; ok {
 
891
                params.Set("fields", fmt.Sprintf("%v", v))
 
892
        }
 
893
        urls := googleapi.ResolveRelative(c.s.BasePath, "representatives/lookup")
 
894
        urls += "?" + params.Encode()
 
895
        req, _ := http.NewRequest("POST", urls, body)
 
896
        googleapi.SetOpaque(req.URL)
 
897
        req.Header.Set("Content-Type", ctype)
 
898
        req.Header.Set("User-Agent", "google-api-go-client/0.5")
 
899
        res, err := c.s.client.Do(req)
 
900
        if err != nil {
 
901
                return nil, err
 
902
        }
 
903
        defer googleapi.CloseBody(res)
 
904
        if err := googleapi.CheckResponse(res); err != nil {
 
905
                return nil, err
 
906
        }
 
907
        var ret *RepresentativeInfoResponse
 
908
        if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
 
909
                return nil, err
 
910
        }
 
911
        return ret, nil
 
912
        // {
 
913
        //   "description": "Looks up political geography and representative information based on an address or Open Civic Data division identifier.",
 
914
        //   "httpMethod": "POST",
 
915
        //   "id": "civicinfo.representatives.representativeInfoQuery",
 
916
        //   "parameters": {
 
917
        //     "includeOffices": {
 
918
        //       "default": "true",
 
919
        //       "description": "Whether to return information about offices and officials. If false, only the top-level district information will be returned.",
 
920
        //       "location": "query",
 
921
        //       "type": "boolean"
 
922
        //     },
 
923
        //     "ocdId": {
 
924
        //       "description": "The division to look up. May only be specified if the address field is not given in the request body.",
 
925
        //       "location": "query",
 
926
        //       "type": "string"
 
927
        //     },
 
928
        //     "recursive": {
 
929
        //       "default": "false",
 
930
        //       "description": "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.",
 
931
        //       "location": "query",
 
932
        //       "type": "boolean"
 
933
        //     }
 
934
        //   },
 
935
        //   "path": "representatives/lookup",
 
936
        //   "request": {
 
937
        //     "$ref": "RepresentativeInfoRequest"
 
938
        //   },
 
939
        //   "response": {
 
940
        //     "$ref": "RepresentativeInfoResponse"
 
941
        //   }
 
942
        // }
 
943
 
 
944
}