...

Source file src/google.golang.org/api/civicinfo/v2/civicinfo-gen.go

Documentation: google.golang.org/api/civicinfo/v2

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

View as plain text