api

package
v0.0.0-...-fcb3c3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckServer

func CheckServer(address string) tea.Msg

Types

type Address

type Address struct {
	LocationName string `json:"locationName"`
	Line1        string `json:"line1"`
	Line2        string `json:"line2"`
	Line3        string `json:"line3"`
	City         string `json:"city"`
	State        string `json:"state"`
	Zip          string `json:"zip"`
}

Address Resource

func (Address) String

func (a Address) String() string

type AdministrationRegion

type AdministrationRegion struct {
	Name                       string                     `json:"name"`
	ElectionAdministrationBody ElectionAdministrationBody `json:"electionAdministrationBody"`
}

AdministrationRegion Resource

type Candidate

type Candidate struct {
	Name          string    `json:"name"`
	Party         string    `json:"party"`
	CandidateUrl  string    `json:"candidateUrl"`
	Phone         string    `json:"phone"`
	PhotoUrl      string    `json:"photoUrl"`
	Email         string    `json:"email"`
	OrderOnBallot int64     `json:"orderOnBallot"`
	Channels      []Channel `json:"channels"`
}

Candidate Resource

func (Candidate) Description

func (c Candidate) Description() string

func (Candidate) FilterValue

func (c Candidate) FilterValue() string

func (Candidate) Title

func (c Candidate) Title() string

type Channel

type Channel struct {
	Type string `json:"type"`
	ID   string `json:"id"`
}

Channel Resource

type Contest

type Contest struct {
	Type                       string      `json:"type"`
	PrimaryParty               string      `json:"primaryParty"`
	ElectorateSpecifications   string      `json:"electorateSpecifications"`
	Special                    string      `json:"special"`
	BallotTitle                string      `json:"ballotTitle"`
	Office                     string      `json:"office"`
	Level                      []string    `json:"level"`
	Roles                      []string    `json:"roles"`
	District                   District    `json:"district"`
	NumberElected              string      `json:"numberElected"`   // Docs say long, but API returns a string
	NumberVotingFor            string      `json:"numberVotingFor"` // Docs say long, but API returns a string
	BallotPlacement            string      `json:"ballotPlacement"` // Docs say long, but API returns a string
	Candidates                 []Candidate `json:"candidates"`
	ReferendumTitle            string      `json:"referendumTitle"`
	ReferendumSubtitle         string      `json:"referendumSubtitle"`
	ReferendumUrl              string      `json:"referendumUrl"`
	ReferendumBrief            string      `json:"referendumBrief"`
	ReferendumText             string      `json:"referendumText"`
	ReferendumProStatement     string      `json:"referendumProStatement"`
	ReferendumConStatement     string      `json:"referendumConStatement"`
	ReferendumPassageThreshold string      `json:"referendumPassageThreshold"`
	ReferendumEffectOfAbstain  string      `json:"referendumEffectOfAbstain"`
	ReferendumBallotResponses  []string    `json:"referendumBallotResponses"`
	Sources                    []Source    `json:"sources"`
}

Contest Resource

func (Contest) Description

func (c Contest) Description() string

func (Contest) FilterValue

func (c Contest) FilterValue() string

func (Contest) Title

func (c Contest) Title() string

TODO: I wish I could truncate based on the terminal width, but I think that would require a global variable

type District

type District struct {
	Name  string `json:"name"`
	Scope string `json:"scope"`
	ID    string `json:"id"`
}

District Resource

type Election

type Election struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	ElectionDay   string `json:"electionDay"`
	OcdDivisionId string `json:"ocdDivisionId"`
}

Election Resource

type ElectionAdministrationBody

type ElectionAdministrationBody struct {
	Name                                string             `json:"name"`
	ElectionInfoUrl                     string             `json:"electionInfoUrl"`
	ElectionRegistrationUrl             string             `json:"electionRegistrationUrl"`
	ElectionRegistrationConfirmationUrl string             `json:"electionRegistrationConfirmationUrl"`
	ElectionNoticeText                  string             `json:"electionNoticeText"`
	ElectionNoticeUrl                   string             `json:"electionNoticeUrl"`
	AbsenteeVotingInfoUrl               string             `json:"absenteeVotingInfoUrl"`
	VotingLocationFinderUrl             string             `json:"votingLocationFinderUrl"`
	BallotInfoUrl                       string             `json:"ballotInfoUrl"`
	ElectionRulesUrl                    string             `json:"electionRulesUrl"`
	VoterServices                       []string           `json:"voter_services"`
	HoursOfOperation                    string             `json:"hoursOfOperation"`
	CorrespondenceAddress               Address            `json:"correspondenceAddress"`
	PhysicalAddress                     Address            `json:"physicalAddress"`
	ElectionOfficials                   []ElectionOfficial `json:"electionOfficials"`
}

ElectionAdministrationBody Resource

type ElectionOfficial

type ElectionOfficial struct {
	Name              string `json:"name"`
	Title             string `json:"title"`
	OfficePhoneNumber string `json:"officePhoneNumber"`
	FaxNumber         string `json:"faxNumber"`
	EmailAddress      string `json:"emailAddress"`
}

ElectionOfficial Resource

type PollingPlace

type PollingPlace struct {
	Address       Address  `json:"address"`
	Notes         string   `json:"notes"`
	PollingHours  string   `json:"pollingHours"`
	Name          string   `json:"name"`
	VoterServices string   `json:"voterServices"`
	StartDate     string   `json:"startDate"`
	EndDate       string   `json:"endDate"`
	Latitude      float64  `json:"latitude"`
	Longitude     float64  `json:"longitude"`
	Sources       []Source `json:"sources"`
}

PollingPlace Resource (used for pollingLocations, earlyVoteSites, and dropOffLocations)

func (PollingPlace) Description

func (p PollingPlace) Description() string

func (PollingPlace) FilterValue

func (p PollingPlace) FilterValue() string

func (PollingPlace) GetMapsUrl

func (p PollingPlace) GetMapsUrl() (string, error)

func (PollingPlace) Title

func (p PollingPlace) Title() string

type Source

type Source struct {
	Name     string `json:"name"`
	Official bool   `json:"official"`
}

Source Resource

type State

type State struct {
	Name                       string                     `json:"name"`
	ElectionAdministrationBody ElectionAdministrationBody `json:"electionAdministrationBody"`
	LocalJurisdiction          *AdministrationRegion      `json:"local_jurisdiction"`
	Sources                    []Source                   `json:"sources"`
}

State Resource

type VoterInfoResponse

type VoterInfoResponse struct {
	Kind             string         `json:"kind"`
	Election         Election       `json:"election"`
	OtherElections   []Election     `json:"otherElections"`
	NormalizedInput  Address        `json:"normalizedInput"`
	PollingLocations []PollingPlace `json:"pollingLocations"`
	EarlyVoteSites   []PollingPlace `json:"earlyVoteSites"`
	DropOffLocations []PollingPlace `json:"dropOffLocations"`
	Contests         []Contest      `json:"contests"`
	State            []State        `json:"state"` // This is an array in the API, but I think it should be a single object. Have not seen a counterexample
	MailOnly         bool           `json:"mailOnly"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL