congress

package
v0.0.0-...-c5d5a31 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package congress retrieves members of the United States Congress

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidState error

ErrInvalidState indicates an invalid state was passed in

Functions

This section is empty.

Types

type Fetcher

type Fetcher interface {
	FetchSenators(location *Location) (*Response, error)
	FetchMembers(location *Location) (*Response, error)
}

Fetcher implements methods to retrieve members of Congress/Senate for a district/state

type Location

type Location struct {
	Short string
	State string
}

Location is the member's state

func ValidateState

func ValidateState(state string) *Location

ValidateState returns a valid code for a State

type Member

type Member struct {
	Name         string
	District     int
	Gender       string
	Party        string
	Twitter      string
	Facebook     string
	NextElection int
}

Member is a member of Congress

type ProPublica

type ProPublica struct {
	Key        string
	HTTPClient *http.Client
}

ProPublica holds settings for the ProPublic API

func (*ProPublica) FetchMembers

func (p *ProPublica) FetchMembers(location *Location) (*Response, error)

FetchMembers returns House members from ProPublica

func (*ProPublica) FetchSenators

func (p *ProPublica) FetchSenators(location *Location) (*Response, error)

FetchSenators returns Senators from ProPublica

type Provider

type Provider string

Provider is a data source

const ProPublicaProvider Provider = "ProPublica"

ProPublicaProvider is a data Provider

type Response

type Response struct {
	*Location
	Role
	Members []Member
	Provider
}

Response is contains the members of Congress/Senate for a district/state

type Role

type Role string

Role is a congressional role

const (
	// Senators are United States Senators
	Senators Role = "Senators"
	// House are United States House Members
	House Role = "House Members"
)

Jump to

Keyboard shortcuts

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