You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2382 lines
92 KiB

  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/v2"
  8. // ...
  9. // civicinfoService, err := civicinfo.New(oauthHttpClient)
  10. package civicinfo // import "google.golang.org/api/civicinfo/v2"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "civicinfo:v2"
  41. const apiName = "civicinfo"
  42. const apiVersion = "v2"
  43. const basePath = "https://www.googleapis.com/civicinfo/v2/"
  44. func New(client *http.Client) (*Service, error) {
  45. if client == nil {
  46. return nil, errors.New("client is nil")
  47. }
  48. s := &Service{client: client, BasePath: basePath}
  49. s.Divisions = NewDivisionsService(s)
  50. s.Elections = NewElectionsService(s)
  51. s.Representatives = NewRepresentativesService(s)
  52. return s, nil
  53. }
  54. type Service struct {
  55. client *http.Client
  56. BasePath string // API endpoint base URL
  57. UserAgent string // optional additional User-Agent fragment
  58. Divisions *DivisionsService
  59. Elections *ElectionsService
  60. Representatives *RepresentativesService
  61. }
  62. func (s *Service) userAgent() string {
  63. if s.UserAgent == "" {
  64. return googleapi.UserAgent
  65. }
  66. return googleapi.UserAgent + " " + s.UserAgent
  67. }
  68. func NewDivisionsService(s *Service) *DivisionsService {
  69. rs := &DivisionsService{s: s}
  70. return rs
  71. }
  72. type DivisionsService struct {
  73. s *Service
  74. }
  75. func NewElectionsService(s *Service) *ElectionsService {
  76. rs := &ElectionsService{s: s}
  77. return rs
  78. }
  79. type ElectionsService struct {
  80. s *Service
  81. }
  82. func NewRepresentativesService(s *Service) *RepresentativesService {
  83. rs := &RepresentativesService{s: s}
  84. return rs
  85. }
  86. type RepresentativesService struct {
  87. s *Service
  88. }
  89. // AdministrationRegion: Describes information about a regional election
  90. // administrative area.
  91. type AdministrationRegion struct {
  92. // ElectionAdministrationBody: The election administration body for this
  93. // area.
  94. ElectionAdministrationBody *AdministrativeBody `json:"electionAdministrationBody,omitempty"`
  95. // Id: An ID for this object. IDs may change in future requests and
  96. // should not be cached. Access to this field requires special access
  97. // that can be requested from the Request more link on the Quotas page.
  98. Id string `json:"id,omitempty"`
  99. // LocalJurisdiction: The city or county that provides election
  100. // information for this voter. This object can have the same elements as
  101. // state.
  102. LocalJurisdiction *AdministrationRegion `json:"local_jurisdiction,omitempty"`
  103. // Name: The name of the jurisdiction.
  104. Name string `json:"name,omitempty"`
  105. // Sources: A list of sources for this area. If multiple sources are
  106. // listed the data has been aggregated from those sources.
  107. Sources []*Source `json:"sources,omitempty"`
  108. // ForceSendFields is a list of field names (e.g.
  109. // "ElectionAdministrationBody") to unconditionally include in API
  110. // requests. By default, fields with empty values are omitted from API
  111. // requests. However, any non-pointer, non-interface field appearing in
  112. // ForceSendFields will be sent to the server regardless of whether the
  113. // field is empty or not. This may be used to include empty fields in
  114. // Patch requests.
  115. ForceSendFields []string `json:"-"`
  116. // NullFields is a list of field names (e.g.
  117. // "ElectionAdministrationBody") to include in API requests with the
  118. // JSON null value. By default, fields with empty values are omitted
  119. // from API requests. However, any field with an empty value appearing
  120. // in NullFields will be sent to the server as null. It is an error if a
  121. // field in this list has a non-empty value. This may be used to include
  122. // null fields in Patch requests.
  123. NullFields []string `json:"-"`
  124. }
  125. func (s *AdministrationRegion) MarshalJSON() ([]byte, error) {
  126. type NoMethod AdministrationRegion
  127. raw := NoMethod(*s)
  128. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  129. }
  130. // AdministrativeBody: Information about an election administrative body
  131. // (e.g. County Board of Elections).
  132. type AdministrativeBody struct {
  133. // AbsenteeVotingInfoUrl: A URL provided by this administrative body for
  134. // information on absentee voting.
  135. AbsenteeVotingInfoUrl string `json:"absenteeVotingInfoUrl,omitempty"`
  136. AddressLines []string `json:"addressLines,omitempty"`
  137. // BallotInfoUrl: A URL provided by this administrative body to give
  138. // contest information to the voter.
  139. BallotInfoUrl string `json:"ballotInfoUrl,omitempty"`
  140. // CorrespondenceAddress: The mailing address of this administrative
  141. // body.
  142. CorrespondenceAddress *SimpleAddressType `json:"correspondenceAddress,omitempty"`
  143. // ElectionInfoUrl: A URL provided by this administrative body for
  144. // looking up general election information.
  145. ElectionInfoUrl string `json:"electionInfoUrl,omitempty"`
  146. // ElectionOfficials: The election officials for this election
  147. // administrative body.
  148. ElectionOfficials []*ElectionOfficial `json:"electionOfficials,omitempty"`
  149. // ElectionRegistrationConfirmationUrl: A URL provided by this
  150. // administrative body for confirming that the voter is registered to
  151. // vote.
  152. ElectionRegistrationConfirmationUrl string `json:"electionRegistrationConfirmationUrl,omitempty"`
  153. // ElectionRegistrationUrl: A URL provided by this administrative body
  154. // for looking up how to register to vote.
  155. ElectionRegistrationUrl string `json:"electionRegistrationUrl,omitempty"`
  156. // ElectionRulesUrl: A URL provided by this administrative body
  157. // describing election rules to the voter.
  158. ElectionRulesUrl string `json:"electionRulesUrl,omitempty"`
  159. // HoursOfOperation: A description of the hours of operation for this
  160. // administrative body.
  161. HoursOfOperation string `json:"hoursOfOperation,omitempty"`
  162. // Name: The name of this election administrative body.
  163. Name string `json:"name,omitempty"`
  164. // PhysicalAddress: The physical address of this administrative body.
  165. PhysicalAddress *SimpleAddressType `json:"physicalAddress,omitempty"`
  166. // VoterServices: A description of the services this administrative body
  167. // may provide.
  168. VoterServices []string `json:"voter_services,omitempty"`
  169. // VotingLocationFinderUrl: A URL provided by this administrative body
  170. // for looking up where to vote.
  171. VotingLocationFinderUrl string `json:"votingLocationFinderUrl,omitempty"`
  172. // ForceSendFields is a list of field names (e.g.
  173. // "AbsenteeVotingInfoUrl") to unconditionally include in API requests.
  174. // By default, fields with empty values are omitted from API requests.
  175. // However, any non-pointer, non-interface field appearing in
  176. // ForceSendFields will be sent to the server regardless of whether the
  177. // field is empty or not. This may be used to include empty fields in
  178. // Patch requests.
  179. ForceSendFields []string `json:"-"`
  180. // NullFields is a list of field names (e.g. "AbsenteeVotingInfoUrl") to
  181. // include in API requests with the JSON null value. By default, fields
  182. // with empty values are omitted from API requests. However, any field
  183. // with an empty value appearing in NullFields will be sent to the
  184. // server as null. It is an error if a field in this list has a
  185. // non-empty value. This may be used to include null fields in Patch
  186. // requests.
  187. NullFields []string `json:"-"`
  188. }
  189. func (s *AdministrativeBody) MarshalJSON() ([]byte, error) {
  190. type NoMethod AdministrativeBody
  191. raw := NoMethod(*s)
  192. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  193. }
  194. // Candidate: Information about a candidate running for elected office.
  195. type Candidate struct {
  196. // CandidateUrl: The URL for the candidate's campaign web site.
  197. CandidateUrl string `json:"candidateUrl,omitempty"`
  198. // Channels: A list of known (social) media channels for this candidate.
  199. Channels []*Channel `json:"channels,omitempty"`
  200. // Email: The email address for the candidate's campaign.
  201. Email string `json:"email,omitempty"`
  202. // Name: The candidate's name. If this is a joint ticket it will
  203. // indicate the name of the candidate at the top of a ticket followed by
  204. // a / and that name of candidate at the bottom of the ticket. e.g.
  205. // "Mitt Romney / Paul Ryan"
  206. Name string `json:"name,omitempty"`
  207. // OrderOnBallot: The order the candidate appears on the ballot for this
  208. // contest.
  209. OrderOnBallot int64 `json:"orderOnBallot,omitempty,string"`
  210. // Party: The full name of the party the candidate is a member of.
  211. Party string `json:"party,omitempty"`
  212. // Phone: The voice phone number for the candidate's campaign office.
  213. Phone string `json:"phone,omitempty"`
  214. // PhotoUrl: A URL for a photo of the candidate.
  215. PhotoUrl string `json:"photoUrl,omitempty"`
  216. // ForceSendFields is a list of field names (e.g. "CandidateUrl") to
  217. // unconditionally include in API requests. By default, fields with
  218. // empty values are omitted from API requests. However, any non-pointer,
  219. // non-interface field appearing in ForceSendFields will be sent to the
  220. // server regardless of whether the field is empty or not. This may be
  221. // used to include empty fields in Patch requests.
  222. ForceSendFields []string `json:"-"`
  223. // NullFields is a list of field names (e.g. "CandidateUrl") to include
  224. // in API requests with the JSON null value. By default, fields with
  225. // empty values are omitted from API requests. However, any field with
  226. // an empty value appearing in NullFields will be sent to the server as
  227. // null. It is an error if a field in this list has a non-empty value.
  228. // This may be used to include null fields in Patch requests.
  229. NullFields []string `json:"-"`
  230. }
  231. func (s *Candidate) MarshalJSON() ([]byte, error) {
  232. type NoMethod Candidate
  233. raw := NoMethod(*s)
  234. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  235. }
  236. // Channel: A social media or web channel for a candidate.
  237. type Channel struct {
  238. // Id: The unique public identifier for the candidate's channel.
  239. Id string `json:"id,omitempty"`
  240. // Type: The type of channel. The following is a list of types of
  241. // channels, but is not exhaustive. More channel types may be added at a
  242. // later time. One of: GooglePlus, YouTube, Facebook, Twitter
  243. Type string `json:"type,omitempty"`
  244. // ForceSendFields is a list of field names (e.g. "Id") to
  245. // unconditionally include in API requests. By default, fields with
  246. // empty values are omitted from API requests. However, any non-pointer,
  247. // non-interface field appearing in ForceSendFields will be sent to the
  248. // server regardless of whether the field is empty or not. This may be
  249. // used to include empty fields in Patch requests.
  250. ForceSendFields []string `json:"-"`
  251. // NullFields is a list of field names (e.g. "Id") to include in API
  252. // requests with the JSON null value. By default, fields with empty
  253. // values are omitted from API requests. However, any field with an
  254. // empty value appearing in NullFields will be sent to the server as
  255. // null. It is an error if a field in this list has a non-empty value.
  256. // This may be used to include null fields in Patch requests.
  257. NullFields []string `json:"-"`
  258. }
  259. func (s *Channel) MarshalJSON() ([]byte, error) {
  260. type NoMethod Channel
  261. raw := NoMethod(*s)
  262. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  263. }
  264. // Contest: Information about a contest that appears on a voter's
  265. // ballot.
  266. type Contest struct {
  267. // BallotPlacement: A number specifying the position of this contest on
  268. // the voter's ballot.
  269. BallotPlacement int64 `json:"ballotPlacement,omitempty,string"`
  270. // Candidates: The candidate choices for this contest.
  271. Candidates []*Candidate `json:"candidates,omitempty"`
  272. // District: Information about the electoral district that this contest
  273. // is in.
  274. District *ElectoralDistrict `json:"district,omitempty"`
  275. // ElectorateSpecifications: A description of any additional eligibility
  276. // requirements for voting in this contest.
  277. ElectorateSpecifications string `json:"electorateSpecifications,omitempty"`
  278. // Id: An ID for this object. IDs may change in future requests and
  279. // should not be cached. Access to this field requires special access
  280. // that can be requested from the Request more link on the Quotas page.
  281. Id string `json:"id,omitempty"`
  282. // Level: The levels of government of the office for this contest. There
  283. // may be more than one in cases where a jurisdiction effectively acts
  284. // at two different levels of government; for example, the mayor of the
  285. // District of Columbia acts at "locality" level, but also effectively
  286. // at both "administrative-area-2" and "administrative-area-1".
  287. Level []string `json:"level,omitempty"`
  288. // NumberElected: The number of candidates that will be elected to
  289. // office in this contest.
  290. NumberElected int64 `json:"numberElected,omitempty,string"`
  291. // NumberVotingFor: The number of candidates that a voter may vote for
  292. // in this contest.
  293. NumberVotingFor int64 `json:"numberVotingFor,omitempty,string"`
  294. // Office: The name of the office for this contest.
  295. Office string `json:"office,omitempty"`
  296. // PrimaryParty: If this is a partisan election, the name of the party
  297. // it is for.
  298. PrimaryParty string `json:"primaryParty,omitempty"`
  299. // ReferendumBallotResponses: The set of ballot responses for the
  300. // referendum. A ballot response represents a line on the ballot. Common
  301. // examples might include "yes" or "no" for referenda. This field is
  302. // only populated for contests of type 'Referendum'.
  303. ReferendumBallotResponses []string `json:"referendumBallotResponses,omitempty"`
  304. // ReferendumBrief: Specifies a short summary of the referendum that is
  305. // typically on the ballot below the title but above the text. This
  306. // field is only populated for contests of type 'Referendum'.
  307. ReferendumBrief string `json:"referendumBrief,omitempty"`
  308. // ReferendumConStatement: A statement in opposition to the referendum.
  309. // It does not necessarily appear on the ballot. This field is only
  310. // populated for contests of type 'Referendum'.
  311. ReferendumConStatement string `json:"referendumConStatement,omitempty"`
  312. // ReferendumEffectOfAbstain: Specifies what effect abstaining (not
  313. // voting) on the proposition will have (i.e. whether abstaining is
  314. // considered a vote against it). This field is only populated for
  315. // contests of type 'Referendum'.
  316. ReferendumEffectOfAbstain string `json:"referendumEffectOfAbstain,omitempty"`
  317. // ReferendumPassageThreshold: The threshold of votes that the
  318. // referendum needs in order to pass, e.g. "two-thirds". This field is
  319. // only populated for contests of type 'Referendum'.
  320. ReferendumPassageThreshold string `json:"referendumPassageThreshold,omitempty"`
  321. // ReferendumProStatement: A statement in favor of the referendum. It
  322. // does not necessarily appear on the ballot. This field is only
  323. // populated for contests of type 'Referendum'.
  324. ReferendumProStatement string `json:"referendumProStatement,omitempty"`
  325. // ReferendumSubtitle: A brief description of the referendum. This field
  326. // is only populated for contests of type 'Referendum'.
  327. ReferendumSubtitle string `json:"referendumSubtitle,omitempty"`
  328. // ReferendumText: The full text of the referendum. This field is only
  329. // populated for contests of type 'Referendum'.
  330. ReferendumText string `json:"referendumText,omitempty"`
  331. // ReferendumTitle: The title of the referendum (e.g. 'Proposition 42').
  332. // This field is only populated for contests of type 'Referendum'.
  333. ReferendumTitle string `json:"referendumTitle,omitempty"`
  334. // ReferendumUrl: A link to the referendum. This field is only populated
  335. // for contests of type 'Referendum'.
  336. ReferendumUrl string `json:"referendumUrl,omitempty"`
  337. // Roles: The roles which this office fulfills.
  338. Roles []string `json:"roles,omitempty"`
  339. // Sources: A list of sources for this contest. If multiple sources are
  340. // listed, the data has been aggregated from those sources.
  341. Sources []*Source `json:"sources,omitempty"`
  342. // Special: "Yes" or "No" depending on whether this a contest being held
  343. // outside the normal election cycle.
  344. Special string `json:"special,omitempty"`
  345. // Type: The type of contest. Usually this will be 'General', 'Primary',
  346. // or 'Run-off' for contests with candidates. For referenda this will be
  347. // 'Referendum'. For Retention contests this will typically be
  348. // 'Retention'.
  349. Type string `json:"type,omitempty"`
  350. // ForceSendFields is a list of field names (e.g. "BallotPlacement") to
  351. // unconditionally include in API requests. By default, fields with
  352. // empty values are omitted from API requests. However, any non-pointer,
  353. // non-interface field appearing in ForceSendFields will be sent to the
  354. // server regardless of whether the field is empty or not. This may be
  355. // used to include empty fields in Patch requests.
  356. ForceSendFields []string `json:"-"`
  357. // NullFields is a list of field names (e.g. "BallotPlacement") to
  358. // include in API requests with the JSON null value. By default, fields
  359. // with empty values are omitted from API requests. However, any field
  360. // with an empty value appearing in NullFields will be sent to the
  361. // server as null. It is an error if a field in this list has a
  362. // non-empty value. This may be used to include null fields in Patch
  363. // requests.
  364. NullFields []string `json:"-"`
  365. }
  366. func (s *Contest) MarshalJSON() ([]byte, error) {
  367. type NoMethod Contest
  368. raw := NoMethod(*s)
  369. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  370. }
  371. type ContextParams struct {
  372. ClientProfile string `json:"clientProfile,omitempty"`
  373. // ForceSendFields is a list of field names (e.g. "ClientProfile") to
  374. // unconditionally include in API requests. By default, fields with
  375. // empty values are omitted from API requests. However, any non-pointer,
  376. // non-interface field appearing in ForceSendFields will be sent to the
  377. // server regardless of whether the field is empty or not. This may be
  378. // used to include empty fields in Patch requests.
  379. ForceSendFields []string `json:"-"`
  380. // NullFields is a list of field names (e.g. "ClientProfile") to include
  381. // in API requests with the JSON null value. By default, fields with
  382. // empty values are omitted from API requests. However, any field with
  383. // an empty value appearing in NullFields will be sent to the server as
  384. // null. It is an error if a field in this list has a non-empty value.
  385. // This may be used to include null fields in Patch requests.
  386. NullFields []string `json:"-"`
  387. }
  388. func (s *ContextParams) MarshalJSON() ([]byte, error) {
  389. type NoMethod ContextParams
  390. raw := NoMethod(*s)
  391. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  392. }
  393. // DivisionRepresentativeInfoRequest: A request to look up
  394. // representative information for a single division.
  395. type DivisionRepresentativeInfoRequest struct {
  396. ContextParams *ContextParams `json:"contextParams,omitempty"`
  397. // ForceSendFields is a list of field names (e.g. "ContextParams") to
  398. // unconditionally include in API requests. By default, fields with
  399. // empty values are omitted from API requests. However, any non-pointer,
  400. // non-interface field appearing in ForceSendFields will be sent to the
  401. // server regardless of whether the field is empty or not. This may be
  402. // used to include empty fields in Patch requests.
  403. ForceSendFields []string `json:"-"`
  404. // NullFields is a list of field names (e.g. "ContextParams") to include
  405. // in API requests with the JSON null value. By default, fields with
  406. // empty values are omitted from API requests. However, any field with
  407. // an empty value appearing in NullFields will be sent to the server as
  408. // null. It is an error if a field in this list has a non-empty value.
  409. // This may be used to include null fields in Patch requests.
  410. NullFields []string `json:"-"`
  411. }
  412. func (s *DivisionRepresentativeInfoRequest) MarshalJSON() ([]byte, error) {
  413. type NoMethod DivisionRepresentativeInfoRequest
  414. raw := NoMethod(*s)
  415. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  416. }
  417. // DivisionSearchRequest: A search request for political geographies.
  418. type DivisionSearchRequest struct {
  419. ContextParams *ContextParams `json:"contextParams,omitempty"`
  420. // ForceSendFields is a list of field names (e.g. "ContextParams") to
  421. // unconditionally include in API requests. By default, fields with
  422. // empty values are omitted from API requests. However, any non-pointer,
  423. // non-interface field appearing in ForceSendFields will be sent to the
  424. // server regardless of whether the field is empty or not. This may be
  425. // used to include empty fields in Patch requests.
  426. ForceSendFields []string `json:"-"`
  427. // NullFields is a list of field names (e.g. "ContextParams") to include
  428. // in API requests with the JSON null value. By default, fields with
  429. // empty values are omitted from API requests. However, any field with
  430. // an empty value appearing in NullFields will be sent to the server as
  431. // null. It is an error if a field in this list has a non-empty value.
  432. // This may be used to include null fields in Patch requests.
  433. NullFields []string `json:"-"`
  434. }
  435. func (s *DivisionSearchRequest) MarshalJSON() ([]byte, error) {
  436. type NoMethod DivisionSearchRequest
  437. raw := NoMethod(*s)
  438. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  439. }
  440. // DivisionSearchResponse: The result of a division search query.
  441. type DivisionSearchResponse struct {
  442. // Kind: Identifies what kind of resource this is. Value: the fixed
  443. // string "civicinfo#divisionSearchResponse".
  444. Kind string `json:"kind,omitempty"`
  445. Results []*DivisionSearchResult `json:"results,omitempty"`
  446. // ServerResponse contains the HTTP response code and headers from the
  447. // server.
  448. googleapi.ServerResponse `json:"-"`
  449. // ForceSendFields is a list of field names (e.g. "Kind") to
  450. // unconditionally include in API requests. By default, fields with
  451. // empty values are omitted from API requests. However, any non-pointer,
  452. // non-interface field appearing in ForceSendFields will be sent to the
  453. // server regardless of whether the field is empty or not. This may be
  454. // used to include empty fields in Patch requests.
  455. ForceSendFields []string `json:"-"`
  456. // NullFields is a list of field names (e.g. "Kind") to include in API
  457. // requests with the JSON null value. By default, fields with empty
  458. // values are omitted from API requests. However, any field with an
  459. // empty value appearing in NullFields will be sent to the server as
  460. // null. It is an error if a field in this list has a non-empty value.
  461. // This may be used to include null fields in Patch requests.
  462. NullFields []string `json:"-"`
  463. }
  464. func (s *DivisionSearchResponse) MarshalJSON() ([]byte, error) {
  465. type NoMethod DivisionSearchResponse
  466. raw := NoMethod(*s)
  467. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  468. }
  469. // DivisionSearchResult: Represents a political geographic division that
  470. // matches the requested query.
  471. type DivisionSearchResult struct {
  472. // Aliases: Other Open Civic Data identifiers that refer to the same
  473. // division -- for example, those that refer to other political
  474. // divisions whose boundaries are defined to be coterminous with this
  475. // one. For example, ocd-division/country:us/state:wy will include an
  476. // alias of ocd-division/country:us/state:wy/cd:1, since Wyoming has
  477. // only one Congressional district.
  478. Aliases []string `json:"aliases,omitempty"`
  479. // Name: The name of the division.
  480. Name string `json:"name,omitempty"`
  481. // OcdId: The unique Open Civic Data identifier for this division.
  482. OcdId string `json:"ocdId,omitempty"`
  483. // ForceSendFields is a list of field names (e.g. "Aliases") to
  484. // unconditionally include in API requests. By default, fields with
  485. // empty values are omitted from API requests. However, any non-pointer,
  486. // non-interface field appearing in ForceSendFields will be sent to the
  487. // server regardless of whether the field is empty or not. This may be
  488. // used to include empty fields in Patch requests.
  489. ForceSendFields []string `json:"-"`
  490. // NullFields is a list of field names (e.g. "Aliases") to include in
  491. // API requests with the JSON null value. By default, fields with empty
  492. // values are omitted from API requests. However, any field with an
  493. // empty value appearing in NullFields will be sent to the server as
  494. // null. It is an error if a field in this list has a non-empty value.
  495. // This may be used to include null fields in Patch requests.
  496. NullFields []string `json:"-"`
  497. }
  498. func (s *DivisionSearchResult) MarshalJSON() ([]byte, error) {
  499. type NoMethod DivisionSearchResult
  500. raw := NoMethod(*s)
  501. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  502. }
  503. // Election: Information about the election that was queried.
  504. type Election struct {
  505. // ElectionDay: Day of the election in YYYY-MM-DD format.
  506. ElectionDay string `json:"electionDay,omitempty"`
  507. // Id: The unique ID of this election.
  508. Id int64 `json:"id,omitempty,string"`
  509. // Name: A displayable name for the election.
  510. Name string `json:"name,omitempty"`
  511. // OcdDivisionId: The political division of the election. Represented as
  512. // an OCD Division ID. Voters within these political jurisdictions are
  513. // covered by this election. This is typically a state such as
  514. // ocd-division/country:us/state:ca or for the midterms or general
  515. // election the entire US (i.e. ocd-division/country:us).
  516. OcdDivisionId string `json:"ocdDivisionId,omitempty"`
  517. // ForceSendFields is a list of field names (e.g. "ElectionDay") to
  518. // unconditionally include in API requests. By default, fields with
  519. // empty values are omitted from API requests. However, any non-pointer,
  520. // non-interface field appearing in ForceSendFields will be sent to the
  521. // server regardless of whether the field is empty or not. This may be
  522. // used to include empty fields in Patch requests.
  523. ForceSendFields []string `json:"-"`
  524. // NullFields is a list of field names (e.g. "ElectionDay") to include
  525. // in API requests with the JSON null value. By default, fields with
  526. // empty values are omitted from API requests. However, any field with
  527. // an empty value appearing in NullFields will be sent to the server as
  528. // null. It is an error if a field in this list has a non-empty value.
  529. // This may be used to include null fields in Patch requests.
  530. NullFields []string `json:"-"`
  531. }
  532. func (s *Election) MarshalJSON() ([]byte, error) {
  533. type NoMethod Election
  534. raw := NoMethod(*s)
  535. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  536. }
  537. // ElectionOfficial: Information about individual election officials.
  538. type ElectionOfficial struct {
  539. // EmailAddress: The email address of the election official.
  540. EmailAddress string `json:"emailAddress,omitempty"`
  541. // FaxNumber: The fax number of the election official.
  542. FaxNumber string `json:"faxNumber,omitempty"`
  543. // Name: The full name of the election official.
  544. Name string `json:"name,omitempty"`
  545. // OfficePhoneNumber: The office phone number of the election official.
  546. OfficePhoneNumber string `json:"officePhoneNumber,omitempty"`
  547. // Title: The title of the election official.
  548. Title string `json:"title,omitempty"`
  549. // ForceSendFields is a list of field names (e.g. "EmailAddress") to
  550. // unconditionally include in API requests. By default, fields with
  551. // empty values are omitted from API requests. However, any non-pointer,
  552. // non-interface field appearing in ForceSendFields will be sent to the
  553. // server regardless of whether the field is empty or not. This may be
  554. // used to include empty fields in Patch requests.
  555. ForceSendFields []string `json:"-"`
  556. // NullFields is a list of field names (e.g. "EmailAddress") to include
  557. // in API requests with the JSON null value. By default, fields with
  558. // empty values are omitted from API requests. However, any field with
  559. // an empty value appearing in NullFields will be sent to the server as
  560. // null. It is an error if a field in this list has a non-empty value.
  561. // This may be used to include null fields in Patch requests.
  562. NullFields []string `json:"-"`
  563. }
  564. func (s *ElectionOfficial) MarshalJSON() ([]byte, error) {
  565. type NoMethod ElectionOfficial
  566. raw := NoMethod(*s)
  567. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  568. }
  569. type ElectionsQueryRequest struct {
  570. ContextParams *ContextParams `json:"contextParams,omitempty"`
  571. // ForceSendFields is a list of field names (e.g. "ContextParams") to
  572. // unconditionally include in API requests. By default, fields with
  573. // empty values are omitted from API requests. However, any non-pointer,
  574. // non-interface field appearing in ForceSendFields will be sent to the
  575. // server regardless of whether the field is empty or not. This may be
  576. // used to include empty fields in Patch requests.
  577. ForceSendFields []string `json:"-"`
  578. // NullFields is a list of field names (e.g. "ContextParams") to include
  579. // in API requests with the JSON null value. By default, fields with
  580. // empty values are omitted from API requests. However, any field with
  581. // an empty value appearing in NullFields will be sent to the server as
  582. // null. It is an error if a field in this list has a non-empty value.
  583. // This may be used to include null fields in Patch requests.
  584. NullFields []string `json:"-"`
  585. }
  586. func (s *ElectionsQueryRequest) MarshalJSON() ([]byte, error) {
  587. type NoMethod ElectionsQueryRequest
  588. raw := NoMethod(*s)
  589. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  590. }
  591. // ElectionsQueryResponse: The list of elections available for this
  592. // version of the API.
  593. type ElectionsQueryResponse struct {
  594. // Elections: A list of available elections
  595. Elections []*Election `json:"elections,omitempty"`
  596. // Kind: Identifies what kind of resource this is. Value: the fixed
  597. // string "civicinfo#electionsQueryResponse".
  598. Kind string `json:"kind,omitempty"`
  599. // ServerResponse contains the HTTP response code and headers from the
  600. // server.
  601. googleapi.ServerResponse `json:"-"`
  602. // ForceSendFields is a list of field names (e.g. "Elections") to
  603. // unconditionally include in API requests. By default, fields with
  604. // empty values are omitted from API requests. However, any non-pointer,
  605. // non-interface field appearing in ForceSendFields will be sent to the
  606. // server regardless of whether the field is empty or not. This may be
  607. // used to include empty fields in Patch requests.
  608. ForceSendFields []string `json:"-"`
  609. // NullFields is a list of field names (e.g. "Elections") to include in
  610. // API requests with the JSON null value. By default, fields with empty
  611. // values are omitted from API requests. However, any field with an
  612. // empty value appearing in NullFields will be sent to the server as
  613. // null. It is an error if a field in this list has a non-empty value.
  614. // This may be used to include null fields in Patch requests.
  615. NullFields []string `json:"-"`
  616. }
  617. func (s *ElectionsQueryResponse) MarshalJSON() ([]byte, error) {
  618. type NoMethod ElectionsQueryResponse
  619. raw := NoMethod(*s)
  620. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  621. }
  622. // ElectoralDistrict: Describes the geographic scope of a contest.
  623. type ElectoralDistrict struct {
  624. // Id: An identifier for this district, relative to its scope. For
  625. // example, the 34th State Senate district would have id "34" and a
  626. // scope of stateUpper.
  627. Id string `json:"id,omitempty"`
  628. KgForeignKey string `json:"kgForeignKey,omitempty"`
  629. // Name: The name of the district.
  630. Name string `json:"name,omitempty"`
  631. // Scope: The geographic scope of this district. If unspecified the
  632. // district's geography is not known. One of: national, statewide,
  633. // congressional, stateUpper, stateLower, countywide, judicial,
  634. // schoolBoard, cityWide, township, countyCouncil, cityCouncil, ward,
  635. // special
  636. Scope string `json:"scope,omitempty"`
  637. // ForceSendFields is a list of field names (e.g. "Id") to
  638. // unconditionally include in API requests. By default, fields with
  639. // empty values are omitted from API requests. However, any non-pointer,
  640. // non-interface field appearing in ForceSendFields will be sent to the
  641. // server regardless of whether the field is empty or not. This may be
  642. // used to include empty fields in Patch requests.
  643. ForceSendFields []string `json:"-"`
  644. // NullFields is a list of field names (e.g. "Id") to include in API
  645. // requests with the JSON null value. By default, fields with empty
  646. // values are omitted from API requests. However, any field with an
  647. // empty value appearing in NullFields will be sent to the server as
  648. // null. It is an error if a field in this list has a non-empty value.
  649. // This may be used to include null fields in Patch requests.
  650. NullFields []string `json:"-"`
  651. }
  652. func (s *ElectoralDistrict) MarshalJSON() ([]byte, error) {
  653. type NoMethod ElectoralDistrict
  654. raw := NoMethod(*s)
  655. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  656. }
  657. // GeographicDivision: Describes a political geography.
  658. type GeographicDivision struct {
  659. // AlsoKnownAs: Any other valid OCD IDs that refer to the same
  660. // division.
  661. //
  662. // Because OCD IDs are meant to be human-readable and at least somewhat
  663. // predictable, there are occasionally several identifiers for a single
  664. // division. These identifiers are defined to be equivalent to one
  665. // another, and one is always indicated as the primary identifier. The
  666. // primary identifier will be returned in ocd_id above, and any other
  667. // equivalent valid identifiers will be returned in this list.
  668. //
  669. // For example, if this division's OCD ID is
  670. // ocd-division/country:us/district:dc, this will contain
  671. // ocd-division/country:us/state:dc.
  672. AlsoKnownAs []string `json:"alsoKnownAs,omitempty"`
  673. // Name: The name of the division.
  674. Name string `json:"name,omitempty"`
  675. // OfficeIndices: List of indices in the offices array, one for each
  676. // office elected from this division. Will only be present if
  677. // includeOffices was true (or absent) in the request.
  678. OfficeIndices []int64 `json:"officeIndices,omitempty"`
  679. // ForceSendFields is a list of field names (e.g. "AlsoKnownAs") to
  680. // unconditionally include in API requests. By default, fields with
  681. // empty values are omitted from API requests. However, any non-pointer,
  682. // non-interface field appearing in ForceSendFields will be sent to the
  683. // server regardless of whether the field is empty or not. This may be
  684. // used to include empty fields in Patch requests.
  685. ForceSendFields []string `json:"-"`
  686. // NullFields is a list of field names (e.g. "AlsoKnownAs") to include
  687. // in API requests with the JSON null value. By default, fields with
  688. // empty values are omitted from API requests. However, any field with
  689. // an empty value appearing in NullFields will be sent to the server as
  690. // null. It is an error if a field in this list has a non-empty value.
  691. // This may be used to include null fields in Patch requests.
  692. NullFields []string `json:"-"`
  693. }
  694. func (s *GeographicDivision) MarshalJSON() ([]byte, error) {
  695. type NoMethod GeographicDivision
  696. raw := NoMethod(*s)
  697. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  698. }
  699. // Office: Information about an Office held by one or more Officials.
  700. type Office struct {
  701. // DivisionId: The OCD ID of the division with which this office is
  702. // associated.
  703. DivisionId string `json:"divisionId,omitempty"`
  704. // Levels: The levels of government of which this office is part. There
  705. // may be more than one in cases where a jurisdiction effectively acts
  706. // at two different levels of government; for example, the mayor of the
  707. // District of Columbia acts at "locality" level, but also effectively
  708. // at both "administrative-area-2" and "administrative-area-1".
  709. Levels []string `json:"levels,omitempty"`
  710. // Name: The human-readable name of the office.
  711. Name string `json:"name,omitempty"`
  712. // OfficialIndices: List of indices in the officials array of people who
  713. // presently hold this office.
  714. OfficialIndices []int64 `json:"officialIndices,omitempty"`
  715. // Roles: The roles which this office fulfills. Roles are not meant to
  716. // be exhaustive, or to exactly specify the entire set of
  717. // responsibilities of a given office, but are meant to be rough
  718. // categories that are useful for general selection from or sorting of a
  719. // list of offices.
  720. Roles []string `json:"roles,omitempty"`
  721. // Sources: A list of sources for this office. If multiple sources are
  722. // listed, the data has been aggregated from those sources.
  723. Sources []*Source `json:"sources,omitempty"`
  724. // ForceSendFields is a list of field names (e.g. "DivisionId") to
  725. // unconditionally include in API requests. By default, fields with
  726. // empty values are omitted from API requests. However, any non-pointer,
  727. // non-interface field appearing in ForceSendFields will be sent to the
  728. // server regardless of whether the field is empty or not. This may be
  729. // used to include empty fields in Patch requests.
  730. ForceSendFields []string `json:"-"`
  731. // NullFields is a list of field names (e.g. "DivisionId") to include in
  732. // API requests with the JSON null value. By default, fields with empty
  733. // values are omitted from API requests. However, any field with an
  734. // empty value appearing in NullFields will be sent to the server as
  735. // null. It is an error if a field in this list has a non-empty value.
  736. // This may be used to include null fields in Patch requests.
  737. NullFields []string `json:"-"`
  738. }
  739. func (s *Office) MarshalJSON() ([]byte, error) {
  740. type NoMethod Office
  741. raw := NoMethod(*s)
  742. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  743. }
  744. // Official: Information about a person holding an elected office.
  745. type Official struct {
  746. // Address: Addresses at which to contact the official.
  747. Address []*SimpleAddressType `json:"address,omitempty"`
  748. // Channels: A list of known (social) media channels for this official.
  749. Channels []*Channel `json:"channels,omitempty"`
  750. // Emails: The direct email addresses for the official.
  751. Emails []string `json:"emails,omitempty"`
  752. // Name: The official's name.
  753. Name string `json:"name,omitempty"`
  754. // Party: The full name of the party the official belongs to.
  755. Party string `json:"party,omitempty"`
  756. // Phones: The official's public contact phone numbers.
  757. Phones []string `json:"phones,omitempty"`
  758. // PhotoUrl: A URL for a photo of the official.
  759. PhotoUrl string `json:"photoUrl,omitempty"`
  760. // Urls: The official's public website URLs.
  761. Urls []string `json:"urls,omitempty"`
  762. // ForceSendFields is a list of field names (e.g. "Address") to
  763. // unconditionally include in API requests. By default, fields with
  764. // empty values are omitted from API requests. However, any non-pointer,
  765. // non-interface field appearing in ForceSendFields will be sent to the
  766. // server regardless of whether the field is empty or not. This may be
  767. // used to include empty fields in Patch requests.
  768. ForceSendFields []string `json:"-"`
  769. // NullFields is a list of field names (e.g. "Address") to include in
  770. // API requests with the JSON null value. By default, fields with empty
  771. // values are omitted from API requests. However, any field with an
  772. // empty value appearing in NullFields will be sent to the server as
  773. // null. It is an error if a field in this list has a non-empty value.
  774. // This may be used to include null fields in Patch requests.
  775. NullFields []string `json:"-"`
  776. }
  777. func (s *Official) MarshalJSON() ([]byte, error) {
  778. type NoMethod Official
  779. raw := NoMethod(*s)
  780. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  781. }
  782. // PollingLocation: A location where a voter can vote. This may be an
  783. // early vote site, an election day voting location, or a drop off
  784. // location for a completed ballot.
  785. type PollingLocation struct {
  786. // Address: The address of the location.
  787. Address *SimpleAddressType `json:"address,omitempty"`
  788. // EndDate: The last date that this early vote site or drop off location
  789. // may be used. This field is not populated for polling locations.
  790. EndDate string `json:"endDate,omitempty"`
  791. // Id: An ID for this object. IDs may change in future requests and
  792. // should not be cached. Access to this field requires special access
  793. // that can be requested from the Request more link on the Quotas page.
  794. Id string `json:"id,omitempty"`
  795. // Name: The name of the early vote site or drop off location. This
  796. // field is not populated for polling locations.
  797. Name string `json:"name,omitempty"`
  798. // Notes: Notes about this location (e.g. accessibility ramp or entrance
  799. // to use).
  800. Notes string `json:"notes,omitempty"`
  801. // PollingHours: A description of when this location is open.
  802. PollingHours string `json:"pollingHours,omitempty"`
  803. // Sources: A list of sources for this location. If multiple sources are
  804. // listed the data has been aggregated from those sources.
  805. Sources []*Source `json:"sources,omitempty"`
  806. // StartDate: The first date that this early vote site or drop off
  807. // location may be used. This field is not populated for polling
  808. // locations.
  809. StartDate string `json:"startDate,omitempty"`
  810. // VoterServices: The services provided by this early vote site or drop
  811. // off location. This field is not populated for polling locations.
  812. VoterServices string `json:"voterServices,omitempty"`
  813. // ForceSendFields is a list of field names (e.g. "Address") to
  814. // unconditionally include in API requests. By default, fields with
  815. // empty values are omitted from API requests. However, any non-pointer,
  816. // non-interface field appearing in ForceSendFields will be sent to the
  817. // server regardless of whether the field is empty or not. This may be
  818. // used to include empty fields in Patch requests.
  819. ForceSendFields []string `json:"-"`
  820. // NullFields is a list of field names (e.g. "Address") to include in
  821. // API requests with the JSON null value. By default, fields with empty
  822. // values are omitted from API requests. However, any field with an
  823. // empty value appearing in NullFields will be sent to the server as
  824. // null. It is an error if a field in this list has a non-empty value.
  825. // This may be used to include null fields in Patch requests.
  826. NullFields []string `json:"-"`
  827. }
  828. func (s *PollingLocation) MarshalJSON() ([]byte, error) {
  829. type NoMethod PollingLocation
  830. raw := NoMethod(*s)
  831. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  832. }
  833. type PostalAddress struct {
  834. AddressLines []string `json:"addressLines,omitempty"`
  835. AdministrativeAreaName string `json:"administrativeAreaName,omitempty"`
  836. CountryName string `json:"countryName,omitempty"`
  837. CountryNameCode string `json:"countryNameCode,omitempty"`
  838. DependentLocalityName string `json:"dependentLocalityName,omitempty"`
  839. DependentThoroughfareLeadingType string `json:"dependentThoroughfareLeadingType,omitempty"`
  840. DependentThoroughfareName string `json:"dependentThoroughfareName,omitempty"`
  841. DependentThoroughfarePostDirection string `json:"dependentThoroughfarePostDirection,omitempty"`
  842. DependentThoroughfarePreDirection string `json:"dependentThoroughfarePreDirection,omitempty"`
  843. DependentThoroughfareTrailingType string `json:"dependentThoroughfareTrailingType,omitempty"`
  844. DependentThoroughfaresConnector string `json:"dependentThoroughfaresConnector,omitempty"`
  845. DependentThoroughfaresIndicator string `json:"dependentThoroughfaresIndicator,omitempty"`
  846. DependentThoroughfaresType string `json:"dependentThoroughfaresType,omitempty"`
  847. FirmName string `json:"firmName,omitempty"`
  848. IsDisputed bool `json:"isDisputed,omitempty"`
  849. LanguageCode string `json:"languageCode,omitempty"`
  850. LocalityName string `json:"localityName,omitempty"`
  851. PostBoxNumber string `json:"postBoxNumber,omitempty"`
  852. PostalCodeNumber string `json:"postalCodeNumber,omitempty"`
  853. PostalCodeNumberExtension string `json:"postalCodeNumberExtension,omitempty"`
  854. PremiseName string `json:"premiseName,omitempty"`
  855. RecipientName string `json:"recipientName,omitempty"`
  856. SortingCode string `json:"sortingCode,omitempty"`
  857. SubAdministrativeAreaName string `json:"subAdministrativeAreaName,omitempty"`
  858. SubPremiseName string `json:"subPremiseName,omitempty"`
  859. ThoroughfareLeadingType string `json:"thoroughfareLeadingType,omitempty"`
  860. ThoroughfareName string `json:"thoroughfareName,omitempty"`
  861. ThoroughfareNumber string `json:"thoroughfareNumber,omitempty"`
  862. ThoroughfarePostDirection string `json:"thoroughfarePostDirection,omitempty"`
  863. ThoroughfarePreDirection string `json:"thoroughfarePreDirection,omitempty"`
  864. ThoroughfareTrailingType string `json:"thoroughfareTrailingType,omitempty"`
  865. // ForceSendFields is a list of field names (e.g. "AddressLines") to
  866. // unconditionally include in API requests. By default, fields with
  867. // empty values are omitted from API requests. However, any non-pointer,
  868. // non-interface field appearing in ForceSendFields will be sent to the
  869. // server regardless of whether the field is empty or not. This may be
  870. // used to include empty fields in Patch requests.
  871. ForceSendFields []string `json:"-"`
  872. // NullFields is a list of field names (e.g. "AddressLines") to include
  873. // in API requests with the JSON null value. By default, fields with
  874. // empty values are omitted from API requests. However, any field with
  875. // an empty value appearing in NullFields will be sent to the server as
  876. // null. It is an error if a field in this list has a non-empty value.
  877. // This may be used to include null fields in Patch requests.
  878. NullFields []string `json:"-"`
  879. }
  880. func (s *PostalAddress) MarshalJSON() ([]byte, error) {
  881. type NoMethod PostalAddress
  882. raw := NoMethod(*s)
  883. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  884. }
  885. type RepresentativeInfoData struct {
  886. // Divisions: Political geographic divisions that contain the requested
  887. // address.
  888. Divisions map[string]GeographicDivision `json:"divisions,omitempty"`
  889. // Offices: Elected offices referenced by the divisions listed above.
  890. // Will only be present if includeOffices was true in the request.
  891. Offices []*Office `json:"offices,omitempty"`
  892. // Officials: Officials holding the offices listed above. Will only be
  893. // present if includeOffices was true in the request.
  894. Officials []*Official `json:"officials,omitempty"`
  895. // ServerResponse contains the HTTP response code and headers from the
  896. // server.
  897. googleapi.ServerResponse `json:"-"`
  898. // ForceSendFields is a list of field names (e.g. "Divisions") to
  899. // unconditionally include in API requests. By default, fields with
  900. // empty values are omitted from API requests. However, any non-pointer,
  901. // non-interface field appearing in ForceSendFields will be sent to the
  902. // server regardless of whether the field is empty or not. This may be
  903. // used to include empty fields in Patch requests.
  904. ForceSendFields []string `json:"-"`
  905. // NullFields is a list of field names (e.g. "Divisions") to include in
  906. // API requests with the JSON null value. By default, fields with empty
  907. // values are omitted from API requests. However, any field with an
  908. // empty value appearing in NullFields will be sent to the server as
  909. // null. It is an error if a field in this list has a non-empty value.
  910. // This may be used to include null fields in Patch requests.
  911. NullFields []string `json:"-"`
  912. }
  913. func (s *RepresentativeInfoData) MarshalJSON() ([]byte, error) {
  914. type NoMethod RepresentativeInfoData
  915. raw := NoMethod(*s)
  916. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  917. }
  918. // RepresentativeInfoRequest: A request for political geography and
  919. // representative information for an address.
  920. type RepresentativeInfoRequest struct {
  921. ContextParams *ContextParams `json:"contextParams,omitempty"`
  922. // ForceSendFields is a list of field names (e.g. "ContextParams") to
  923. // unconditionally include in API requests. By default, fields with
  924. // empty values are omitted from API requests. However, any non-pointer,
  925. // non-interface field appearing in ForceSendFields will be sent to the
  926. // server regardless of whether the field is empty or not. This may be
  927. // used to include empty fields in Patch requests.
  928. ForceSendFields []string `json:"-"`
  929. // NullFields is a list of field names (e.g. "ContextParams") to include
  930. // in API requests with the JSON null value. By default, fields with
  931. // empty values are omitted from API requests. However, any field with
  932. // an empty value appearing in NullFields will be sent to the server as
  933. // null. It is an error if a field in this list has a non-empty value.
  934. // This may be used to include null fields in Patch requests.
  935. NullFields []string `json:"-"`
  936. }
  937. func (s *RepresentativeInfoRequest) MarshalJSON() ([]byte, error) {
  938. type NoMethod RepresentativeInfoRequest
  939. raw := NoMethod(*s)
  940. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  941. }
  942. // RepresentativeInfoResponse: The result of a representative info
  943. // lookup query.
  944. type RepresentativeInfoResponse struct {
  945. // Divisions: Political geographic divisions that contain the requested
  946. // address.
  947. Divisions map[string]GeographicDivision `json:"divisions,omitempty"`
  948. // Kind: Identifies what kind of resource this is. Value: the fixed
  949. // string "civicinfo#representativeInfoResponse".
  950. Kind string `json:"kind,omitempty"`
  951. // NormalizedInput: The normalized version of the requested address
  952. NormalizedInput *SimpleAddressType `json:"normalizedInput,omitempty"`
  953. // Offices: Elected offices referenced by the divisions listed above.
  954. // Will only be present if includeOffices was true in the request.
  955. Offices []*Office `json:"offices,omitempty"`
  956. // Officials: Officials holding the offices listed above. Will only be
  957. // present if includeOffices was true in the request.
  958. Officials []*Official `json:"officials,omitempty"`
  959. // ServerResponse contains the HTTP response code and headers from the
  960. // server.
  961. googleapi.ServerResponse `json:"-"`
  962. // ForceSendFields is a list of field names (e.g. "Divisions") to
  963. // unconditionally include in API requests. By default, fields with
  964. // empty values are omitted from API requests. However, any non-pointer,
  965. // non-interface field appearing in ForceSendFields will be sent to the
  966. // server regardless of whether the field is empty or not. This may be
  967. // used to include empty fields in Patch requests.
  968. ForceSendFields []string `json:"-"`
  969. // NullFields is a list of field names (e.g. "Divisions") to include in
  970. // API requests with the JSON null value. By default, fields with empty
  971. // values are omitted from API requests. However, any field with an
  972. // empty value appearing in NullFields will be sent to the server as
  973. // null. It is an error if a field in this list has a non-empty value.
  974. // This may be used to include null fields in Patch requests.
  975. NullFields []string `json:"-"`
  976. }
  977. func (s *RepresentativeInfoResponse) MarshalJSON() ([]byte, error) {
  978. type NoMethod RepresentativeInfoResponse
  979. raw := NoMethod(*s)
  980. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  981. }
  982. // SimpleAddressType: A simple representation of an address.
  983. type SimpleAddressType struct {
  984. // City: The city or town for the address.
  985. City string `json:"city,omitempty"`
  986. // Line1: The street name and number of this address.
  987. Line1 string `json:"line1,omitempty"`
  988. // Line2: The second line the address, if needed.
  989. Line2 string `json:"line2,omitempty"`
  990. // Line3: The third line of the address, if needed.
  991. Line3 string `json:"line3,omitempty"`
  992. // LocationName: The name of the location.
  993. LocationName string `json:"locationName,omitempty"`
  994. // State: The US two letter state abbreviation of the address.
  995. State string `json:"state,omitempty"`
  996. // Zip: The US Postal Zip Code of the address.
  997. Zip string `json:"zip,omitempty"`
  998. // ForceSendFields is a list of field names (e.g. "City") to
  999. // unconditionally include in API requests. By default, fields with
  1000. // empty values are omitted from API requests. However, any non-pointer,
  1001. // non-interface field appearing in ForceSendFields will be sent to the
  1002. // server regardless of whether the field is empty or not. This may be
  1003. // used to include empty fields in Patch requests.
  1004. ForceSendFields []string `json:"-"`
  1005. // NullFields is a list of field names (e.g. "City") to include in API
  1006. // requests with the JSON null value. By default, fields with empty
  1007. // values are omitted from API requests. However, any field with an
  1008. // empty value appearing in NullFields will be sent to the server as
  1009. // null. It is an error if a field in this list has a non-empty value.
  1010. // This may be used to include null fields in Patch requests.
  1011. NullFields []string `json:"-"`
  1012. }
  1013. func (s *SimpleAddressType) MarshalJSON() ([]byte, error) {
  1014. type NoMethod SimpleAddressType
  1015. raw := NoMethod(*s)
  1016. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1017. }
  1018. // Source: Contains information about the data source for the element
  1019. // containing it.
  1020. type Source struct {
  1021. // Name: The name of the data source.
  1022. Name string `json:"name,omitempty"`
  1023. // Official: Whether this data comes from an official government source.
  1024. Official bool `json:"official,omitempty"`
  1025. // ForceSendFields is a list of field names (e.g. "Name") to
  1026. // unconditionally include in API requests. By default, fields with
  1027. // empty values are omitted from API requests. However, any non-pointer,
  1028. // non-interface field appearing in ForceSendFields will be sent to the
  1029. // server regardless of whether the field is empty or not. This may be
  1030. // used to include empty fields in Patch requests.
  1031. ForceSendFields []string `json:"-"`
  1032. // NullFields is a list of field names (e.g. "Name") to include in API
  1033. // requests with the JSON null value. By default, fields with empty
  1034. // values are omitted from API requests. However, any field with an
  1035. // empty value appearing in NullFields will be sent to the server as
  1036. // null. It is an error if a field in this list has a non-empty value.
  1037. // This may be used to include null fields in Patch requests.
  1038. NullFields []string `json:"-"`
  1039. }
  1040. func (s *Source) MarshalJSON() ([]byte, error) {
  1041. type NoMethod Source
  1042. raw := NoMethod(*s)
  1043. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1044. }
  1045. // VoterInfoRequest: A request for information about a voter.
  1046. type VoterInfoRequest struct {
  1047. ContextParams *ContextParams `json:"contextParams,omitempty"`
  1048. VoterInfoSegmentResult *VoterInfoSegmentResult `json:"voterInfoSegmentResult,omitempty"`
  1049. // ForceSendFields is a list of field names (e.g. "ContextParams") to
  1050. // unconditionally include in API requests. By default, fields with
  1051. // empty values are omitted from API requests. However, any non-pointer,
  1052. // non-interface field appearing in ForceSendFields will be sent to the
  1053. // server regardless of whether the field is empty or not. This may be
  1054. // used to include empty fields in Patch requests.
  1055. ForceSendFields []string `json:"-"`
  1056. // NullFields is a list of field names (e.g. "ContextParams") to include
  1057. // in API requests with the JSON null value. By default, fields with
  1058. // empty values are omitted from API requests. However, any field with
  1059. // an empty value appearing in NullFields will be sent to the server as
  1060. // null. It is an error if a field in this list has a non-empty value.
  1061. // This may be used to include null fields in Patch requests.
  1062. NullFields []string `json:"-"`
  1063. }
  1064. func (s *VoterInfoRequest) MarshalJSON() ([]byte, error) {
  1065. type NoMethod VoterInfoRequest
  1066. raw := NoMethod(*s)
  1067. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1068. }
  1069. // VoterInfoResponse: The result of a voter info lookup query.
  1070. type VoterInfoResponse struct {
  1071. // Contests: Contests that will appear on the voter's ballot.
  1072. Contests []*Contest `json:"contests,omitempty"`
  1073. // DropOffLocations: Locations where a voter is eligible to drop off a
  1074. // completed ballot. The voter must have received and completed a ballot
  1075. // prior to arriving at the location. The location may not have ballots
  1076. // available on the premises. These locations could be open on or before
  1077. // election day as indicated in the pollingHours field.
  1078. DropOffLocations []*PollingLocation `json:"dropOffLocations,omitempty"`
  1079. // EarlyVoteSites: Locations where the voter is eligible to vote early,
  1080. // prior to election day.
  1081. EarlyVoteSites []*PollingLocation `json:"earlyVoteSites,omitempty"`
  1082. // Election: The election that was queried.
  1083. Election *Election `json:"election,omitempty"`
  1084. // Kind: Identifies what kind of resource this is. Value: the fixed
  1085. // string "civicinfo#voterInfoResponse".
  1086. Kind string `json:"kind,omitempty"`
  1087. // MailOnly: Specifies whether voters in the precinct vote only by
  1088. // mailing their ballots (with the possible option of dropping off their
  1089. // ballots as well).
  1090. MailOnly bool `json:"mailOnly,omitempty"`
  1091. // NormalizedInput: The normalized version of the requested address
  1092. NormalizedInput *SimpleAddressType `json:"normalizedInput,omitempty"`
  1093. // OtherElections: If no election ID was specified in the query, and
  1094. // there was more than one election with data for the given voter, this
  1095. // will contain information about the other elections that could apply.
  1096. OtherElections []*Election `json:"otherElections,omitempty"`
  1097. // PollingLocations: Locations where the voter is eligible to vote on
  1098. // election day.
  1099. PollingLocations []*PollingLocation `json:"pollingLocations,omitempty"`
  1100. PrecinctId string `json:"precinctId,omitempty"`
  1101. // State: Local Election Information for the state that the voter votes
  1102. // in. For the US, there will only be one element in this array.
  1103. State []*AdministrationRegion `json:"state,omitempty"`
  1104. // ServerResponse contains the HTTP response code and headers from the
  1105. // server.
  1106. googleapi.ServerResponse `json:"-"`
  1107. // ForceSendFields is a list of field names (e.g. "Contests") to
  1108. // unconditionally include in API requests. By default, fields with
  1109. // empty values are omitted from API requests. However, any non-pointer,
  1110. // non-interface field appearing in ForceSendFields will be sent to the
  1111. // server regardless of whether the field is empty or not. This may be
  1112. // used to include empty fields in Patch requests.
  1113. ForceSendFields []string `json:"-"`
  1114. // NullFields is a list of field names (e.g. "Contests") to include in
  1115. // API requests with the JSON null value. By default, fields with empty
  1116. // values are omitted from API requests. However, any field with an
  1117. // empty value appearing in NullFields will be sent to the server as
  1118. // null. It is an error if a field in this list has a non-empty value.
  1119. // This may be used to include null fields in Patch requests.
  1120. NullFields []string `json:"-"`
  1121. }
  1122. func (s *VoterInfoResponse) MarshalJSON() ([]byte, error) {
  1123. type NoMethod VoterInfoResponse
  1124. raw := NoMethod(*s)
  1125. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1126. }
  1127. type VoterInfoSegmentResult struct {
  1128. GeneratedMillis int64 `json:"generatedMillis,omitempty,string"`
  1129. PostalAddress *PostalAddress `json:"postalAddress,omitempty"`
  1130. Request *VoterInfoRequest `json:"request,omitempty"`
  1131. Response *VoterInfoResponse `json:"response,omitempty"`
  1132. // ForceSendFields is a list of field names (e.g. "GeneratedMillis") to
  1133. // unconditionally include in API requests. By default, fields with
  1134. // empty values are omitted from API requests. However, any non-pointer,
  1135. // non-interface field appearing in ForceSendFields will be sent to the
  1136. // server regardless of whether the field is empty or not. This may be
  1137. // used to include empty fields in Patch requests.
  1138. ForceSendFields []string `json:"-"`
  1139. // NullFields is a list of field names (e.g. "GeneratedMillis") to
  1140. // include in API requests with the JSON null value. By default, fields
  1141. // with empty values are omitted from API requests. However, any field
  1142. // with an empty value appearing in NullFields will be sent to the
  1143. // server as null. It is an error if a field in this list has a
  1144. // non-empty value. This may be used to include null fields in Patch
  1145. // requests.
  1146. NullFields []string `json:"-"`
  1147. }
  1148. func (s *VoterInfoSegmentResult) MarshalJSON() ([]byte, error) {
  1149. type NoMethod VoterInfoSegmentResult
  1150. raw := NoMethod(*s)
  1151. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1152. }
  1153. // method id "civicinfo.divisions.search":
  1154. type DivisionsSearchCall struct {
  1155. s *Service
  1156. divisionsearchrequest *DivisionSearchRequest
  1157. urlParams_ gensupport.URLParams
  1158. ifNoneMatch_ string
  1159. ctx_ context.Context
  1160. header_ http.Header
  1161. }
  1162. // Search: Searches for political divisions by their natural name or OCD
  1163. // ID.
  1164. func (r *DivisionsService) Search(divisionsearchrequest *DivisionSearchRequest) *DivisionsSearchCall {
  1165. c := &DivisionsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1166. c.divisionsearchrequest = divisionsearchrequest
  1167. return c
  1168. }
  1169. // Query sets the optional parameter "query": The search query. Queries
  1170. // can cover any parts of a OCD ID or a human readable division name.
  1171. // All words given in the query are treated as required patterns. In
  1172. // addition to that, most query operators of the Apache Lucene library
  1173. // are supported. See
  1174. // http://lucene.apache.org/core/2_9_4/queryparsersyntax.html
  1175. func (c *DivisionsSearchCall) Query(query string) *DivisionsSearchCall {
  1176. c.urlParams_.Set("query", query)
  1177. return c
  1178. }
  1179. // Fields allows partial responses to be retrieved. See
  1180. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1181. // for more information.
  1182. func (c *DivisionsSearchCall) Fields(s ...googleapi.Field) *DivisionsSearchCall {
  1183. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1184. return c
  1185. }
  1186. // IfNoneMatch sets the optional parameter which makes the operation
  1187. // fail if the object's ETag matches the given value. This is useful for
  1188. // getting updates only after the object has changed since the last
  1189. // request. Use googleapi.IsNotModified to check whether the response
  1190. // error from Do is the result of In-None-Match.
  1191. func (c *DivisionsSearchCall) IfNoneMatch(entityTag string) *DivisionsSearchCall {
  1192. c.ifNoneMatch_ = entityTag
  1193. return c
  1194. }
  1195. // Context sets the context to be used in this call's Do method. Any
  1196. // pending HTTP request will be aborted if the provided context is
  1197. // canceled.
  1198. func (c *DivisionsSearchCall) Context(ctx context.Context) *DivisionsSearchCall {
  1199. c.ctx_ = ctx
  1200. return c
  1201. }
  1202. // Header returns an http.Header that can be modified by the caller to
  1203. // add HTTP headers to the request.
  1204. func (c *DivisionsSearchCall) Header() http.Header {
  1205. if c.header_ == nil {
  1206. c.header_ = make(http.Header)
  1207. }
  1208. return c.header_
  1209. }
  1210. func (c *DivisionsSearchCall) doRequest(alt string) (*http.Response, error) {
  1211. reqHeaders := make(http.Header)
  1212. for k, v := range c.header_ {
  1213. reqHeaders[k] = v
  1214. }
  1215. reqHeaders.Set("User-Agent", c.s.userAgent())
  1216. if c.ifNoneMatch_ != "" {
  1217. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1218. }
  1219. var body io.Reader = nil
  1220. c.urlParams_.Set("alt", alt)
  1221. urls := googleapi.ResolveRelative(c.s.BasePath, "divisions")
  1222. urls += "?" + c.urlParams_.Encode()
  1223. req, _ := http.NewRequest("GET", urls, body)
  1224. req.Header = reqHeaders
  1225. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1226. }
  1227. // Do executes the "civicinfo.divisions.search" call.
  1228. // Exactly one of *DivisionSearchResponse or error will be non-nil. Any
  1229. // non-2xx status code is an error. Response headers are in either
  1230. // *DivisionSearchResponse.ServerResponse.Header or (if a response was
  1231. // returned at all) in error.(*googleapi.Error).Header. Use
  1232. // googleapi.IsNotModified to check whether the returned error was
  1233. // because http.StatusNotModified was returned.
  1234. func (c *DivisionsSearchCall) Do(opts ...googleapi.CallOption) (*DivisionSearchResponse, error) {
  1235. gensupport.SetOptions(c.urlParams_, opts...)
  1236. res, err := c.doRequest("json")
  1237. if res != nil && res.StatusCode == http.StatusNotModified {
  1238. if res.Body != nil {
  1239. res.Body.Close()
  1240. }
  1241. return nil, &googleapi.Error{
  1242. Code: res.StatusCode,
  1243. Header: res.Header,
  1244. }
  1245. }
  1246. if err != nil {
  1247. return nil, err
  1248. }
  1249. defer googleapi.CloseBody(res)
  1250. if err := googleapi.CheckResponse(res); err != nil {
  1251. return nil, err
  1252. }
  1253. ret := &DivisionSearchResponse{
  1254. ServerResponse: googleapi.ServerResponse{
  1255. Header: res.Header,
  1256. HTTPStatusCode: res.StatusCode,
  1257. },
  1258. }
  1259. target := &ret
  1260. if err := gensupport.DecodeResponse(target, res); err != nil {
  1261. return nil, err
  1262. }
  1263. return ret, nil
  1264. // {
  1265. // "description": "Searches for political divisions by their natural name or OCD ID.",
  1266. // "httpMethod": "GET",
  1267. // "id": "civicinfo.divisions.search",
  1268. // "parameters": {
  1269. // "query": {
  1270. // "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",
  1271. // "location": "query",
  1272. // "type": "string"
  1273. // }
  1274. // },
  1275. // "path": "divisions",
  1276. // "request": {
  1277. // "$ref": "DivisionSearchRequest"
  1278. // },
  1279. // "response": {
  1280. // "$ref": "DivisionSearchResponse"
  1281. // }
  1282. // }
  1283. }
  1284. // method id "civicinfo.elections.electionQuery":
  1285. type ElectionsElectionQueryCall struct {
  1286. s *Service
  1287. electionsqueryrequest *ElectionsQueryRequest
  1288. urlParams_ gensupport.URLParams
  1289. ifNoneMatch_ string
  1290. ctx_ context.Context
  1291. header_ http.Header
  1292. }
  1293. // ElectionQuery: List of available elections to query.
  1294. func (r *ElectionsService) ElectionQuery(electionsqueryrequest *ElectionsQueryRequest) *ElectionsElectionQueryCall {
  1295. c := &ElectionsElectionQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1296. c.electionsqueryrequest = electionsqueryrequest
  1297. return c
  1298. }
  1299. // Fields allows partial responses to be retrieved. See
  1300. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1301. // for more information.
  1302. func (c *ElectionsElectionQueryCall) Fields(s ...googleapi.Field) *ElectionsElectionQueryCall {
  1303. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1304. return c
  1305. }
  1306. // IfNoneMatch sets the optional parameter which makes the operation
  1307. // fail if the object's ETag matches the given value. This is useful for
  1308. // getting updates only after the object has changed since the last
  1309. // request. Use googleapi.IsNotModified to check whether the response
  1310. // error from Do is the result of In-None-Match.
  1311. func (c *ElectionsElectionQueryCall) IfNoneMatch(entityTag string) *ElectionsElectionQueryCall {
  1312. c.ifNoneMatch_ = entityTag
  1313. return c
  1314. }
  1315. // Context sets the context to be used in this call's Do method. Any
  1316. // pending HTTP request will be aborted if the provided context is
  1317. // canceled.
  1318. func (c *ElectionsElectionQueryCall) Context(ctx context.Context) *ElectionsElectionQueryCall {
  1319. c.ctx_ = ctx
  1320. return c
  1321. }
  1322. // Header returns an http.Header that can be modified by the caller to
  1323. // add HTTP headers to the request.
  1324. func (c *ElectionsElectionQueryCall) Header() http.Header {
  1325. if c.header_ == nil {
  1326. c.header_ = make(http.Header)
  1327. }
  1328. return c.header_
  1329. }
  1330. func (c *ElectionsElectionQueryCall) doRequest(alt string) (*http.Response, error) {
  1331. reqHeaders := make(http.Header)
  1332. for k, v := range c.header_ {
  1333. reqHeaders[k] = v
  1334. }
  1335. reqHeaders.Set("User-Agent", c.s.userAgent())
  1336. if c.ifNoneMatch_ != "" {
  1337. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1338. }
  1339. var body io.Reader = nil
  1340. c.urlParams_.Set("alt", alt)
  1341. urls := googleapi.ResolveRelative(c.s.BasePath, "elections")
  1342. urls += "?" + c.urlParams_.Encode()
  1343. req, _ := http.NewRequest("GET", urls, body)
  1344. req.Header = reqHeaders
  1345. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1346. }
  1347. // Do executes the "civicinfo.elections.electionQuery" call.
  1348. // Exactly one of *ElectionsQueryResponse or error will be non-nil. Any
  1349. // non-2xx status code is an error. Response headers are in either
  1350. // *ElectionsQueryResponse.ServerResponse.Header or (if a response was
  1351. // returned at all) in error.(*googleapi.Error).Header. Use
  1352. // googleapi.IsNotModified to check whether the returned error was
  1353. // because http.StatusNotModified was returned.
  1354. func (c *ElectionsElectionQueryCall) Do(opts ...googleapi.CallOption) (*ElectionsQueryResponse, error) {
  1355. gensupport.SetOptions(c.urlParams_, opts...)
  1356. res, err := c.doRequest("json")
  1357. if res != nil && res.StatusCode == http.StatusNotModified {
  1358. if res.Body != nil {
  1359. res.Body.Close()
  1360. }
  1361. return nil, &googleapi.Error{
  1362. Code: res.StatusCode,
  1363. Header: res.Header,
  1364. }
  1365. }
  1366. if err != nil {
  1367. return nil, err
  1368. }
  1369. defer googleapi.CloseBody(res)
  1370. if err := googleapi.CheckResponse(res); err != nil {
  1371. return nil, err
  1372. }
  1373. ret := &ElectionsQueryResponse{
  1374. ServerResponse: googleapi.ServerResponse{
  1375. Header: res.Header,
  1376. HTTPStatusCode: res.StatusCode,
  1377. },
  1378. }
  1379. target := &ret
  1380. if err := gensupport.DecodeResponse(target, res); err != nil {
  1381. return nil, err
  1382. }
  1383. return ret, nil
  1384. // {
  1385. // "description": "List of available elections to query.",
  1386. // "httpMethod": "GET",
  1387. // "id": "civicinfo.elections.electionQuery",
  1388. // "path": "elections",
  1389. // "request": {
  1390. // "$ref": "ElectionsQueryRequest"
  1391. // },
  1392. // "response": {
  1393. // "$ref": "ElectionsQueryResponse"
  1394. // }
  1395. // }
  1396. }
  1397. // method id "civicinfo.elections.voterInfoQuery":
  1398. type ElectionsVoterInfoQueryCall struct {
  1399. s *Service
  1400. voterinforequest *VoterInfoRequest
  1401. urlParams_ gensupport.URLParams
  1402. ifNoneMatch_ string
  1403. ctx_ context.Context
  1404. header_ http.Header
  1405. }
  1406. // VoterInfoQuery: Looks up information relevant to a voter based on the
  1407. // voter's registered address.
  1408. func (r *ElectionsService) VoterInfoQuery(address string, voterinforequest *VoterInfoRequest) *ElectionsVoterInfoQueryCall {
  1409. c := &ElectionsVoterInfoQueryCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1410. c.urlParams_.Set("address", address)
  1411. c.voterinforequest = voterinforequest
  1412. return c
  1413. }
  1414. // ElectionId sets the optional parameter "electionId": The unique ID of
  1415. // the election to look up. A list of election IDs can be obtained at
  1416. // https://www.googleapis.com/civicinfo/{version}/elections
  1417. func (c *ElectionsVoterInfoQueryCall) ElectionId(electionId int64) *ElectionsVoterInfoQueryCall {
  1418. c.urlParams_.Set("electionId", fmt.Sprint(electionId))
  1419. return c
  1420. }
  1421. // OfficialOnly sets the optional parameter "officialOnly": If set to
  1422. // true, only data from official state sources will be returned.
  1423. func (c *ElectionsVoterInfoQueryCall) OfficialOnly(officialOnly bool) *ElectionsVoterInfoQueryCall {
  1424. c.urlParams_.Set("officialOnly", fmt.Sprint(officialOnly))
  1425. return c
  1426. }
  1427. // ReturnAllAvailableData sets the optional parameter
  1428. // "returnAllAvailableData": If set to true, the query will return the
  1429. // success codeand include any partial information when it is unable to
  1430. // determine a matching address or unable to determine the election for
  1431. // electionId=0 queries.
  1432. func (c *ElectionsVoterInfoQueryCall) ReturnAllAvailableData(returnAllAvailableData bool) *ElectionsVoterInfoQueryCall {
  1433. c.urlParams_.Set("returnAllAvailableData", fmt.Sprint(returnAllAvailableData))
  1434. return c
  1435. }
  1436. // Fields allows partial responses to be retrieved. See
  1437. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1438. // for more information.
  1439. func (c *ElectionsVoterInfoQueryCall) Fields(s ...googleapi.Field) *ElectionsVoterInfoQueryCall {
  1440. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1441. return c
  1442. }
  1443. // IfNoneMatch sets the optional parameter which makes the operation
  1444. // fail if the object's ETag matches the given value. This is useful for
  1445. // getting updates only after the object has changed since the last
  1446. // request. Use googleapi.IsNotModified to check whether the response
  1447. // error from Do is the result of In-None-Match.
  1448. func (c *ElectionsVoterInfoQueryCall) IfNoneMatch(entityTag string) *ElectionsVoterInfoQueryCall {
  1449. c.ifNoneMatch_ = entityTag
  1450. return c
  1451. }
  1452. // Context sets the context to be used in this call's Do method. Any
  1453. // pending HTTP request will be aborted if the provided context is
  1454. // canceled.
  1455. func (c *ElectionsVoterInfoQueryCall) Context(ctx context.Context) *ElectionsVoterInfoQueryCall {
  1456. c.ctx_ = ctx
  1457. return c
  1458. }
  1459. // Header returns an http.Header that can be modified by the caller to
  1460. // add HTTP headers to the request.
  1461. func (c *ElectionsVoterInfoQueryCall) Header() http.Header {
  1462. if c.header_ == nil {
  1463. c.header_ = make(http.Header)
  1464. }
  1465. return c.header_
  1466. }
  1467. func (c *ElectionsVoterInfoQueryCall) doRequest(alt string) (*http.Response, error) {
  1468. reqHeaders := make(http.Header)
  1469. for k, v := range c.header_ {
  1470. reqHeaders[k] = v
  1471. }
  1472. reqHeaders.Set("User-Agent", c.s.userAgent())
  1473. if c.ifNoneMatch_ != "" {
  1474. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1475. }
  1476. var body io.Reader = nil
  1477. c.urlParams_.Set("alt", alt)
  1478. urls := googleapi.ResolveRelative(c.s.BasePath, "voterinfo")
  1479. urls += "?" + c.urlParams_.Encode()
  1480. req, _ := http.NewRequest("GET", urls, body)
  1481. req.Header = reqHeaders
  1482. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1483. }
  1484. // Do executes the "civicinfo.elections.voterInfoQuery" call.
  1485. // Exactly one of *VoterInfoResponse or error will be non-nil. Any
  1486. // non-2xx status code is an error. Response headers are in either
  1487. // *VoterInfoResponse.ServerResponse.Header or (if a response was
  1488. // returned at all) in error.(*googleapi.Error).Header. Use
  1489. // googleapi.IsNotModified to check whether the returned error was
  1490. // because http.StatusNotModified was returned.
  1491. func (c *ElectionsVoterInfoQueryCall) Do(opts ...googleapi.CallOption) (*VoterInfoResponse, error) {
  1492. gensupport.SetOptions(c.urlParams_, opts...)
  1493. res, err := c.doRequest("json")
  1494. if res != nil && res.StatusCode == http.StatusNotModified {
  1495. if res.Body != nil {
  1496. res.Body.Close()
  1497. }
  1498. return nil, &googleapi.Error{
  1499. Code: res.StatusCode,
  1500. Header: res.Header,
  1501. }
  1502. }
  1503. if err != nil {
  1504. return nil, err
  1505. }
  1506. defer googleapi.CloseBody(res)
  1507. if err := googleapi.CheckResponse(res); err != nil {
  1508. return nil, err
  1509. }
  1510. ret := &VoterInfoResponse{
  1511. ServerResponse: googleapi.ServerResponse{
  1512. Header: res.Header,
  1513. HTTPStatusCode: res.StatusCode,
  1514. },
  1515. }
  1516. target := &ret
  1517. if err := gensupport.DecodeResponse(target, res); err != nil {
  1518. return nil, err
  1519. }
  1520. return ret, nil
  1521. // {
  1522. // "description": "Looks up information relevant to a voter based on the voter's registered address.",
  1523. // "httpMethod": "GET",
  1524. // "id": "civicinfo.elections.voterInfoQuery",
  1525. // "parameterOrder": [
  1526. // "address"
  1527. // ],
  1528. // "parameters": {
  1529. // "address": {
  1530. // "description": "The registered address of the voter to look up.",
  1531. // "location": "query",
  1532. // "required": true,
  1533. // "type": "string"
  1534. // },
  1535. // "electionId": {
  1536. // "default": "0",
  1537. // "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",
  1538. // "format": "int64",
  1539. // "location": "query",
  1540. // "type": "string"
  1541. // },
  1542. // "officialOnly": {
  1543. // "default": "false",
  1544. // "description": "If set to true, only data from official state sources will be returned.",
  1545. // "location": "query",
  1546. // "type": "boolean"
  1547. // },
  1548. // "returnAllAvailableData": {
  1549. // "default": "false",
  1550. // "description": "If set to true, the query will return the success codeand include any partial information when it is unable to determine a matching address or unable to determine the election for electionId=0 queries.",
  1551. // "location": "query",
  1552. // "type": "boolean"
  1553. // }
  1554. // },
  1555. // "path": "voterinfo",
  1556. // "request": {
  1557. // "$ref": "VoterInfoRequest"
  1558. // },
  1559. // "response": {
  1560. // "$ref": "VoterInfoResponse"
  1561. // }
  1562. // }
  1563. }
  1564. // method id "civicinfo.representatives.representativeInfoByAddress":
  1565. type RepresentativesRepresentativeInfoByAddressCall struct {
  1566. s *Service
  1567. representativeinforequest *RepresentativeInfoRequest
  1568. urlParams_ gensupport.URLParams
  1569. ifNoneMatch_ string
  1570. ctx_ context.Context
  1571. header_ http.Header
  1572. }
  1573. // RepresentativeInfoByAddress: Looks up political geography and
  1574. // representative information for a single address.
  1575. func (r *RepresentativesService) RepresentativeInfoByAddress(representativeinforequest *RepresentativeInfoRequest) *RepresentativesRepresentativeInfoByAddressCall {
  1576. c := &RepresentativesRepresentativeInfoByAddressCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1577. c.representativeinforequest = representativeinforequest
  1578. return c
  1579. }
  1580. // Address sets the optional parameter "address": The address to look
  1581. // up. May only be specified if the field ocdId is not given in the URL.
  1582. func (c *RepresentativesRepresentativeInfoByAddressCall) Address(address string) *RepresentativesRepresentativeInfoByAddressCall {
  1583. c.urlParams_.Set("address", address)
  1584. return c
  1585. }
  1586. // IncludeOffices sets the optional parameter "includeOffices": Whether
  1587. // to return information about offices and officials. If false, only the
  1588. // top-level district information will be returned.
  1589. func (c *RepresentativesRepresentativeInfoByAddressCall) IncludeOffices(includeOffices bool) *RepresentativesRepresentativeInfoByAddressCall {
  1590. c.urlParams_.Set("includeOffices", fmt.Sprint(includeOffices))
  1591. return c
  1592. }
  1593. // Levels sets the optional parameter "levels": A list of office levels
  1594. // to filter by. Only offices that serve at least one of these levels
  1595. // will be returned. Divisions that don't contain a matching office will
  1596. // not be returned.
  1597. //
  1598. // Possible values:
  1599. // "administrativeArea1"
  1600. // "administrativeArea2"
  1601. // "country"
  1602. // "international"
  1603. // "locality"
  1604. // "regional"
  1605. // "special"
  1606. // "subLocality1"
  1607. // "subLocality2"
  1608. func (c *RepresentativesRepresentativeInfoByAddressCall) Levels(levels ...string) *RepresentativesRepresentativeInfoByAddressCall {
  1609. c.urlParams_.SetMulti("levels", append([]string{}, levels...))
  1610. return c
  1611. }
  1612. // Roles sets the optional parameter "roles": A list of office roles to
  1613. // filter by. Only offices fulfilling one of these roles will be
  1614. // returned. Divisions that don't contain a matching office will not be
  1615. // returned.
  1616. //
  1617. // Possible values:
  1618. // "deputyHeadOfGovernment"
  1619. // "executiveCouncil"
  1620. // "governmentOfficer"
  1621. // "headOfGovernment"
  1622. // "headOfState"
  1623. // "highestCourtJudge"
  1624. // "judge"
  1625. // "legislatorLowerBody"
  1626. // "legislatorUpperBody"
  1627. // "schoolBoard"
  1628. // "specialPurposeOfficer"
  1629. func (c *RepresentativesRepresentativeInfoByAddressCall) Roles(roles ...string) *RepresentativesRepresentativeInfoByAddressCall {
  1630. c.urlParams_.SetMulti("roles", append([]string{}, roles...))
  1631. return c
  1632. }
  1633. // Fields allows partial responses to be retrieved. See
  1634. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1635. // for more information.
  1636. func (c *RepresentativesRepresentativeInfoByAddressCall) Fields(s ...googleapi.Field) *RepresentativesRepresentativeInfoByAddressCall {
  1637. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1638. return c
  1639. }
  1640. // IfNoneMatch sets the optional parameter which makes the operation
  1641. // fail if the object's ETag matches the given value. This is useful for
  1642. // getting updates only after the object has changed since the last
  1643. // request. Use googleapi.IsNotModified to check whether the response
  1644. // error from Do is the result of In-None-Match.
  1645. func (c *RepresentativesRepresentativeInfoByAddressCall) IfNoneMatch(entityTag string) *RepresentativesRepresentativeInfoByAddressCall {
  1646. c.ifNoneMatch_ = entityTag
  1647. return c
  1648. }
  1649. // Context sets the context to be used in this call's Do method. Any
  1650. // pending HTTP request will be aborted if the provided context is
  1651. // canceled.
  1652. func (c *RepresentativesRepresentativeInfoByAddressCall) Context(ctx context.Context) *RepresentativesRepresentativeInfoByAddressCall {
  1653. c.ctx_ = ctx
  1654. return c
  1655. }
  1656. // Header returns an http.Header that can be modified by the caller to
  1657. // add HTTP headers to the request.
  1658. func (c *RepresentativesRepresentativeInfoByAddressCall) Header() http.Header {
  1659. if c.header_ == nil {
  1660. c.header_ = make(http.Header)
  1661. }
  1662. return c.header_
  1663. }
  1664. func (c *RepresentativesRepresentativeInfoByAddressCall) doRequest(alt string) (*http.Response, error) {
  1665. reqHeaders := make(http.Header)
  1666. for k, v := range c.header_ {
  1667. reqHeaders[k] = v
  1668. }
  1669. reqHeaders.Set("User-Agent", c.s.userAgent())
  1670. if c.ifNoneMatch_ != "" {
  1671. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1672. }
  1673. var body io.Reader = nil
  1674. c.urlParams_.Set("alt", alt)
  1675. urls := googleapi.ResolveRelative(c.s.BasePath, "representatives")
  1676. urls += "?" + c.urlParams_.Encode()
  1677. req, _ := http.NewRequest("GET", urls, body)
  1678. req.Header = reqHeaders
  1679. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1680. }
  1681. // Do executes the "civicinfo.representatives.representativeInfoByAddress" call.
  1682. // Exactly one of *RepresentativeInfoResponse or error will be non-nil.
  1683. // Any non-2xx status code is an error. Response headers are in either
  1684. // *RepresentativeInfoResponse.ServerResponse.Header or (if a response
  1685. // was returned at all) in error.(*googleapi.Error).Header. Use
  1686. // googleapi.IsNotModified to check whether the returned error was
  1687. // because http.StatusNotModified was returned.
  1688. func (c *RepresentativesRepresentativeInfoByAddressCall) Do(opts ...googleapi.CallOption) (*RepresentativeInfoResponse, error) {
  1689. gensupport.SetOptions(c.urlParams_, opts...)
  1690. res, err := c.doRequest("json")
  1691. if res != nil && res.StatusCode == http.StatusNotModified {
  1692. if res.Body != nil {
  1693. res.Body.Close()
  1694. }
  1695. return nil, &googleapi.Error{
  1696. Code: res.StatusCode,
  1697. Header: res.Header,
  1698. }
  1699. }
  1700. if err != nil {
  1701. return nil, err
  1702. }
  1703. defer googleapi.CloseBody(res)
  1704. if err := googleapi.CheckResponse(res); err != nil {
  1705. return nil, err
  1706. }
  1707. ret := &RepresentativeInfoResponse{
  1708. ServerResponse: googleapi.ServerResponse{
  1709. Header: res.Header,
  1710. HTTPStatusCode: res.StatusCode,
  1711. },
  1712. }
  1713. target := &ret
  1714. if err := gensupport.DecodeResponse(target, res); err != nil {
  1715. return nil, err
  1716. }
  1717. return ret, nil
  1718. // {
  1719. // "description": "Looks up political geography and representative information for a single address.",
  1720. // "httpMethod": "GET",
  1721. // "id": "civicinfo.representatives.representativeInfoByAddress",
  1722. // "parameters": {
  1723. // "address": {
  1724. // "description": "The address to look up. May only be specified if the field ocdId is not given in the URL.",
  1725. // "location": "query",
  1726. // "type": "string"
  1727. // },
  1728. // "includeOffices": {
  1729. // "default": "true",
  1730. // "description": "Whether to return information about offices and officials. If false, only the top-level district information will be returned.",
  1731. // "location": "query",
  1732. // "type": "boolean"
  1733. // },
  1734. // "levels": {
  1735. // "description": "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.",
  1736. // "enum": [
  1737. // "administrativeArea1",
  1738. // "administrativeArea2",
  1739. // "country",
  1740. // "international",
  1741. // "locality",
  1742. // "regional",
  1743. // "special",
  1744. // "subLocality1",
  1745. // "subLocality2"
  1746. // ],
  1747. // "enumDescriptions": [
  1748. // "",
  1749. // "",
  1750. // "",
  1751. // "",
  1752. // "",
  1753. // "",
  1754. // "",
  1755. // "",
  1756. // ""
  1757. // ],
  1758. // "location": "query",
  1759. // "repeated": true,
  1760. // "type": "string"
  1761. // },
  1762. // "roles": {
  1763. // "description": "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.",
  1764. // "enum": [
  1765. // "deputyHeadOfGovernment",
  1766. // "executiveCouncil",
  1767. // "governmentOfficer",
  1768. // "headOfGovernment",
  1769. // "headOfState",
  1770. // "highestCourtJudge",
  1771. // "judge",
  1772. // "legislatorLowerBody",
  1773. // "legislatorUpperBody",
  1774. // "schoolBoard",
  1775. // "specialPurposeOfficer"
  1776. // ],
  1777. // "enumDescriptions": [
  1778. // "",
  1779. // "",
  1780. // "",
  1781. // "",
  1782. // "",
  1783. // "",
  1784. // "",
  1785. // "",
  1786. // "",
  1787. // "",
  1788. // ""
  1789. // ],
  1790. // "location": "query",
  1791. // "repeated": true,
  1792. // "type": "string"
  1793. // }
  1794. // },
  1795. // "path": "representatives",
  1796. // "request": {
  1797. // "$ref": "RepresentativeInfoRequest"
  1798. // },
  1799. // "response": {
  1800. // "$ref": "RepresentativeInfoResponse"
  1801. // }
  1802. // }
  1803. }
  1804. // method id "civicinfo.representatives.representativeInfoByDivision":
  1805. type RepresentativesRepresentativeInfoByDivisionCall struct {
  1806. s *Service
  1807. ocdId string
  1808. divisionrepresentativeinforequest *DivisionRepresentativeInfoRequest
  1809. urlParams_ gensupport.URLParams
  1810. ifNoneMatch_ string
  1811. ctx_ context.Context
  1812. header_ http.Header
  1813. }
  1814. // RepresentativeInfoByDivision: Looks up representative information for
  1815. // a single geographic division.
  1816. func (r *RepresentativesService) RepresentativeInfoByDivision(ocdId string, divisionrepresentativeinforequest *DivisionRepresentativeInfoRequest) *RepresentativesRepresentativeInfoByDivisionCall {
  1817. c := &RepresentativesRepresentativeInfoByDivisionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1818. c.ocdId = ocdId
  1819. c.divisionrepresentativeinforequest = divisionrepresentativeinforequest
  1820. return c
  1821. }
  1822. // Levels sets the optional parameter "levels": A list of office levels
  1823. // to filter by. Only offices that serve at least one of these levels
  1824. // will be returned. Divisions that don't contain a matching office will
  1825. // not be returned.
  1826. //
  1827. // Possible values:
  1828. // "administrativeArea1"
  1829. // "administrativeArea2"
  1830. // "country"
  1831. // "international"
  1832. // "locality"
  1833. // "regional"
  1834. // "special"
  1835. // "subLocality1"
  1836. // "subLocality2"
  1837. func (c *RepresentativesRepresentativeInfoByDivisionCall) Levels(levels ...string) *RepresentativesRepresentativeInfoByDivisionCall {
  1838. c.urlParams_.SetMulti("levels", append([]string{}, levels...))
  1839. return c
  1840. }
  1841. // Recursive sets the optional parameter "recursive": If true,
  1842. // information about all divisions contained in the division requested
  1843. // will be included as well. For example, if querying
  1844. // ocd-division/country:us/district:dc, this would also return all DC's
  1845. // wards and ANCs.
  1846. func (c *RepresentativesRepresentativeInfoByDivisionCall) Recursive(recursive bool) *RepresentativesRepresentativeInfoByDivisionCall {
  1847. c.urlParams_.Set("recursive", fmt.Sprint(recursive))
  1848. return c
  1849. }
  1850. // Roles sets the optional parameter "roles": A list of office roles to
  1851. // filter by. Only offices fulfilling one of these roles will be
  1852. // returned. Divisions that don't contain a matching office will not be
  1853. // returned.
  1854. //
  1855. // Possible values:
  1856. // "deputyHeadOfGovernment"
  1857. // "executiveCouncil"
  1858. // "governmentOfficer"
  1859. // "headOfGovernment"
  1860. // "headOfState"
  1861. // "highestCourtJudge"
  1862. // "judge"
  1863. // "legislatorLowerBody"
  1864. // "legislatorUpperBody"
  1865. // "schoolBoard"
  1866. // "specialPurposeOfficer"
  1867. func (c *RepresentativesRepresentativeInfoByDivisionCall) Roles(roles ...string) *RepresentativesRepresentativeInfoByDivisionCall {
  1868. c.urlParams_.SetMulti("roles", append([]string{}, roles...))
  1869. return c
  1870. }
  1871. // Fields allows partial responses to be retrieved. See
  1872. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1873. // for more information.
  1874. func (c *RepresentativesRepresentativeInfoByDivisionCall) Fields(s ...googleapi.Field) *RepresentativesRepresentativeInfoByDivisionCall {
  1875. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1876. return c
  1877. }
  1878. // IfNoneMatch sets the optional parameter which makes the operation
  1879. // fail if the object's ETag matches the given value. This is useful for
  1880. // getting updates only after the object has changed since the last
  1881. // request. Use googleapi.IsNotModified to check whether the response
  1882. // error from Do is the result of In-None-Match.
  1883. func (c *RepresentativesRepresentativeInfoByDivisionCall) IfNoneMatch(entityTag string) *RepresentativesRepresentativeInfoByDivisionCall {
  1884. c.ifNoneMatch_ = entityTag
  1885. return c
  1886. }
  1887. // Context sets the context to be used in this call's Do method. Any
  1888. // pending HTTP request will be aborted if the provided context is
  1889. // canceled.
  1890. func (c *RepresentativesRepresentativeInfoByDivisionCall) Context(ctx context.Context) *RepresentativesRepresentativeInfoByDivisionCall {
  1891. c.ctx_ = ctx
  1892. return c
  1893. }
  1894. // Header returns an http.Header that can be modified by the caller to
  1895. // add HTTP headers to the request.
  1896. func (c *RepresentativesRepresentativeInfoByDivisionCall) Header() http.Header {
  1897. if c.header_ == nil {
  1898. c.header_ = make(http.Header)
  1899. }
  1900. return c.header_
  1901. }
  1902. func (c *RepresentativesRepresentativeInfoByDivisionCall) doRequest(alt string) (*http.Response, error) {
  1903. reqHeaders := make(http.Header)
  1904. for k, v := range c.header_ {
  1905. reqHeaders[k] = v
  1906. }
  1907. reqHeaders.Set("User-Agent", c.s.userAgent())
  1908. if c.ifNoneMatch_ != "" {
  1909. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1910. }
  1911. var body io.Reader = nil
  1912. c.urlParams_.Set("alt", alt)
  1913. urls := googleapi.ResolveRelative(c.s.BasePath, "representatives/{ocdId}")
  1914. urls += "?" + c.urlParams_.Encode()
  1915. req, _ := http.NewRequest("GET", urls, body)
  1916. req.Header = reqHeaders
  1917. googleapi.Expand(req.URL, map[string]string{
  1918. "ocdId": c.ocdId,
  1919. })
  1920. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1921. }
  1922. // Do executes the "civicinfo.representatives.representativeInfoByDivision" call.
  1923. // Exactly one of *RepresentativeInfoData or error will be non-nil. Any
  1924. // non-2xx status code is an error. Response headers are in either
  1925. // *RepresentativeInfoData.ServerResponse.Header or (if a response was
  1926. // returned at all) in error.(*googleapi.Error).Header. Use
  1927. // googleapi.IsNotModified to check whether the returned error was
  1928. // because http.StatusNotModified was returned.
  1929. func (c *RepresentativesRepresentativeInfoByDivisionCall) Do(opts ...googleapi.CallOption) (*RepresentativeInfoData, error) {
  1930. gensupport.SetOptions(c.urlParams_, opts...)
  1931. res, err := c.doRequest("json")
  1932. if res != nil && res.StatusCode == http.StatusNotModified {
  1933. if res.Body != nil {
  1934. res.Body.Close()
  1935. }
  1936. return nil, &googleapi.Error{
  1937. Code: res.StatusCode,
  1938. Header: res.Header,
  1939. }
  1940. }
  1941. if err != nil {
  1942. return nil, err
  1943. }
  1944. defer googleapi.CloseBody(res)
  1945. if err := googleapi.CheckResponse(res); err != nil {
  1946. return nil, err
  1947. }
  1948. ret := &RepresentativeInfoData{
  1949. ServerResponse: googleapi.ServerResponse{
  1950. Header: res.Header,
  1951. HTTPStatusCode: res.StatusCode,
  1952. },
  1953. }
  1954. target := &ret
  1955. if err := gensupport.DecodeResponse(target, res); err != nil {
  1956. return nil, err
  1957. }
  1958. return ret, nil
  1959. // {
  1960. // "description": "Looks up representative information for a single geographic division.",
  1961. // "httpMethod": "GET",
  1962. // "id": "civicinfo.representatives.representativeInfoByDivision",
  1963. // "parameterOrder": [
  1964. // "ocdId"
  1965. // ],
  1966. // "parameters": {
  1967. // "levels": {
  1968. // "description": "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.",
  1969. // "enum": [
  1970. // "administrativeArea1",
  1971. // "administrativeArea2",
  1972. // "country",
  1973. // "international",
  1974. // "locality",
  1975. // "regional",
  1976. // "special",
  1977. // "subLocality1",
  1978. // "subLocality2"
  1979. // ],
  1980. // "enumDescriptions": [
  1981. // "",
  1982. // "",
  1983. // "",
  1984. // "",
  1985. // "",
  1986. // "",
  1987. // "",
  1988. // "",
  1989. // ""
  1990. // ],
  1991. // "location": "query",
  1992. // "repeated": true,
  1993. // "type": "string"
  1994. // },
  1995. // "ocdId": {
  1996. // "description": "The Open Civic Data division identifier of the division to look up.",
  1997. // "location": "path",
  1998. // "required": true,
  1999. // "type": "string"
  2000. // },
  2001. // "recursive": {
  2002. // "description": "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.",
  2003. // "location": "query",
  2004. // "type": "boolean"
  2005. // },
  2006. // "roles": {
  2007. // "description": "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.",
  2008. // "enum": [
  2009. // "deputyHeadOfGovernment",
  2010. // "executiveCouncil",
  2011. // "governmentOfficer",
  2012. // "headOfGovernment",
  2013. // "headOfState",
  2014. // "highestCourtJudge",
  2015. // "judge",
  2016. // "legislatorLowerBody",
  2017. // "legislatorUpperBody",
  2018. // "schoolBoard",
  2019. // "specialPurposeOfficer"
  2020. // ],
  2021. // "enumDescriptions": [
  2022. // "",
  2023. // "",
  2024. // "",
  2025. // "",
  2026. // "",
  2027. // "",
  2028. // "",
  2029. // "",
  2030. // "",
  2031. // "",
  2032. // ""
  2033. // ],
  2034. // "location": "query",
  2035. // "repeated": true,
  2036. // "type": "string"
  2037. // }
  2038. // },
  2039. // "path": "representatives/{ocdId}",
  2040. // "request": {
  2041. // "$ref": "DivisionRepresentativeInfoRequest"
  2042. // },
  2043. // "response": {
  2044. // "$ref": "RepresentativeInfoData"
  2045. // }
  2046. // }
  2047. }