verboseapi

package
v0.0.0-...-02b9d31 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bill

type Bill struct {
	BasePrintNo string `json:"basePrintNo"`
	Session     int    `json:"session"`
	PrintNo     string `json:"printNo"`
	BillType    struct {
		Chamber    string `json:"chamber"`
		Desc       string `json:"desc"`
		Resolution bool   `json:"resolution"`
	} `json:"billType"`
	Title             string `json:"title"`
	ActiveVersion     string `json:"activeVersion,omitempty"`
	Year              int    `json:"year"`
	PublishedDateTime string `json:"publishedDateTime"`
	SubstitutedBy     BillID `json:"substitutedBy,omitempty"`
	Sponsor           struct {
		Member MemberEntry `json:"member"`
		Budget bool        `json:"budget"`
		Rules  bool        `json:"rules"`
	} `json:"sponsor"`
	Summary string `json:"summary"`
	Signed  bool   `json:"signed"`
	Status  struct {
		StatusType    string      `json:"statusType"`
		StatusDesc    string      `json:"statusDesc"`
		ActionDate    string      `json:"actionDate"`
		CommitteeName string      `json:"committeeName"`
		BillCalNo     interface{} `json:"billCalNo,omitempty"`
	} `json:"status"`
	Milestones struct {
		Items []struct {
			StatusType    string      `json:"statusType"`
			StatusDesc    string      `json:"statusDesc"`
			ActionDate    string      `json:"actionDate"`
			CommitteeName string      `json:"committeeName"`
			BillCalNo     interface{} `json:"billCalNo,omitempty"`
		} `json:"items,omitempty"`
		Size int `json:"size"`
	} `json:"milestones"`
	ProgramInfo struct {
		Name       string `json:"name,omitempty"`
		SequenceNo int    `json:"sequenceNo,omitempty"`
	} `json:"programInfo,omitempty"`
	Amendments struct {
		Items map[string]struct {
			BillID
			PublishDate string `json:"publishDate"`
			SameAs      struct {
				Items []BillID `json:"items,omitempty"`
				Size  int      `json:"size,omitempty"`
			} `json:"sameAs,omitempty"`
			Memo             string          `json:"memo"`
			LawSection       string          `json:"lawSection"`
			LawCode          string          `json:"lawCode"`
			ActClause        string          `json:"actClause"`
			FullTextFormats  []string        `json:"fullTextFormats"`
			FullText         string          `json:"fullText"`
			FullTextHTML     string          `json:"fullTextHtml,omitempty"`
			FullTextTemplate string          `json:"fullTextTemplate,omitempty"`
			CoSponsors       MemberEntryList `json:"coSponsors"`
			MultiSponsors    MemberEntryList `json:"multiSponsors"`
			UniBill          bool            `json:"uniBill"`
			Stricken         bool            `json:"stricken"`
		} `json:"items,omitempty"`
		Size int `json:"size"`
	} `json:"amendments"`
	Votes struct {
		Items []BillVote `json:"items,omitempty"`
		Size  int        `json:"size,omitempty"`
	} `json:"votes,omitempty"`
	VetoMessages struct {
		Items []struct {
			BillID     BillID      `json:"billId"`
			Year       int         `json:"year"`
			VetoNumber int         `json:"vetoNumber"`
			MemoText   string      `json:"memoText"`
			VetoType   string      `json:"vetoType"`
			Chapter    int         `json:"chapter"`
			BillPage   int         `json:"billPage"`
			LineStart  int         `json:"lineStart"`
			LineEnd    int         `json:"lineEnd"`
			Signer     string      `json:"signer"`
			SignedDate interface{} `json:"signedDate"`
		} `json:"items,omitempty"`
		Size int `json:"size,omitempty"`
	} `json:"vetoMessages,omitempty"`
	ApprovalMessage struct {
		BillID         BillID `json:"billId,omitempty"`
		Year           int    `json:"year,omitempty"`
		ApprovalNumber int    `json:"approvalNumber,omitempty"`
		Chapter        int    `json:"chapter,omitempty"`
		Signer         string `json:"signer,omitempty"`
		Text           string `json:"text,omitempty"`
	} `json:"approvalMessage,omitempty"`
	AdditionalSponsors MemberEntryList `json:"additionalSponsors,omitempty"`
	PastCommittees     struct {
		Items []struct {
			Chamber       string `json:"chamber"`
			Name          string `json:"name"`
			SessionYear   int    `json:"sessionYear"`
			ReferenceDate string `json:"referenceDate"`
		} `json:"items,omitempty"`
		Size int `json:"size,omitempty"`
	} `json:"pastCommittees,omitempty"`
	Actions struct {
		Items []struct {
			BillID     BillID `json:"billId"`
			Date       string `json:"date"`
			Chamber    string `json:"chamber"`
			SequenceNo int    `json:"sequenceNo"`
			Text       string `json:"text"`
		} `json:"items,omitempty"`
		Size int `json:"size,omitempty"`
	} `json:"actions"`
	PreviousVersions struct {
		Items []BillID `json:"items,omitempty"`
		Size  int      `json:"size,omitempty"`
	} `json:"previousVersions,omitempty"`
	CommitteeAgendas struct {
		Items []struct {
			AgendaID struct {
				Number int `json:"number"`
				Year   int `json:"year"`
			} `json:"agendaId"`
			CommitteeID struct {
				Chamber string `json:"chamber"`
				Name    string `json:"name"`
			} `json:"committeeId"`
		} `json:"items,omitempty"`
		Size int `json:"size,omitempty"`
	} `json:"committeeAgendas,omitempty"`
	Calendars struct {
		Items []struct {
			Year           int `json:"year"`
			CalendarNumber int `json:"calendarNumber"`
		} `json:"items,omitempty"`
		Size int `json:"size,omitempty"`
	} `json:"calendars,omitempty"`
	BillInfoRefs struct {
		Items interface{} `json:"items,omitempty"`
		Size  int         `json:"size,omitempty"`
	} `json:"billInfoRefs,omitempty"`
}

from https://legislation.nysenate.gov/static/docs/html/bills.html

func (Bill) GetVotes

func (b Bill) GetVotes() VoteEntries

type BillID

type BillID struct {
	BasePrintNo    string `json:"basePrintNo,omitempty"`
	Session        int    `json:"session,omitempty"`
	BasePrintNoStr string `json:"basePrintNoStr,omitempty"`
	PrintNo        string `json:"printNo,omitempty"`
	Version        string `json:"version,omitempty"`
}

type BillReference

type BillReference struct {
	BillID
	BillType struct {
		Chamber    string `json:"chamber"`
		Desc       string `json:"desc"`
		Resolution bool   `json:"resolution"`
	} `json:"billType"`
	Title             string `json:"title"`
	ActiveVersion     string `json:"activeVersion"`
	Year              int    `json:"year"`
	PublishedDateTime string `json:"publishedDateTime"`
}

type BillResponse

type BillResponse struct {
	Envelope
	Bill Bill `json:"result"`
}

type BillUpdate

type BillUpdate struct {
	ID              BillID `json:"id"`
	ContentType     string `json:"contentType"`     // i.e. "BILL"
	SourceID        string `json:"sourceId"`        // i.e. "2019-02-13-09.01.14.643609_LDSPON_S01826.XML-1-LDSPON",
	SourceDateTime  string `json:"sourceDateTime"`  // i.e. "2019-02-13T09:01:14.643609",
	ProcessDateTime string `json:"processDateTime"` // i.e. "2019-02-13T09:06:09.796845"
}

type BillUpdateResponse

type BillUpdateResponse struct {
	Envelope
	Result struct {
		Items []BillUpdate `json:"items"`
	}
}

type BillVote

type BillVote struct {
	Version   string `json:"version"`
	VoteType  string `json:"voteType"`
	VoteDate  string `json:"voteDate"`
	Committee struct {
		Chamber string `json:"chamber,omitempty"`
		Name    string `json:"name,omitempty"`
	} `json:"committee,omitempty"`
	MemberVotes struct {
		Items MemberVotes `json:"items,omitempty"`
		Size  int         `json:"size,omitempty"`
	} `json:"memberVotes"`
}

type BillsResponse

type BillsResponse struct {
	Envelope
	Result struct {
		Items []BillReference `json:"items"`
		Size  int             `json:"size"`
	} `json:"result"`
}

type Chamber

type Chamber string
const AssemblyChamber Chamber = "assembly"
const SenateChamber Chamber = "senate"

type Envelope

type Envelope struct {
	Success      bool   `json:"success"`
	Message      string `json:"message"`
	ResponseType string `json:"responseType"`
	Total        int    `json:"total"`
	OffsetStart  int    `json:"offsetStart"`
	OffsetEnd    int    `json:"offsetEnd"`
	Limit        int    `json:"limit"`
}

type MemberEntry

type MemberEntry struct {
	MemberID        int    `json:"memberId"`
	FullName        string `json:"fullName,omitempty"`
	ShortName       string `json:"shortName"`
	Chamber         string `json:"chamber"` // SENATE
	DistrictCode    int    `json:"districtCode"`
	Alternate       bool   `json:"alternate,omitempty"`
	SessionYear     int    `json:"sessionYear"`
	SessionMemberID int    `json:"sessionMemberId,omitempty"`
}

type MemberEntryList

type MemberEntryList struct {
	Items []MemberEntry `json:"items,omitempty"`
	Size  int           `json:"size,omitempty"`
}

type MemberListResponse

type MemberListResponse struct {
	Success      bool   `json:"success"`
	Message      string `json:"message"`
	ResponseType string `json:"responseType"` // "member-sessions list"
	Result       struct {
		Items []MemberSession `json:"items"`
	} `json:"result"`
}

type MemberSession

type MemberSession struct {
	MemberID     int                      `json:"memberId"` // memberId
	Chamber      string                   `json:"chamber"`  // SENATE
	Incumbent    bool                     `json:"incumbent"`
	FullName     string                   `json:"fullName"` // "James L. Seward"
	ShortName    string                   `json:"shortName"`
	DistrictCode int                      `json:"districtCode"`
	Sessions     map[string][]MemberEntry `json:"sessionShortNameMap"` // year: [...]
	Person       Person                   `json:"person"`
}

func (MemberSession) MemberEntry

func (m MemberSession) MemberEntry() MemberEntry

type MemberSessionResponse

type MemberSessionResponse struct {
	Success      bool          `json:"success"`
	Message      string        `json:"message"`
	ResponseType string        `json:"responseType"` // "member-sessions"
	Result       MemberSession `json:"result"`
}

https://legislation.nysenate.gov/static/docs/html/members.html

type MemberVotes

type MemberVotes struct {
	Aye                 MemberEntryList `json:"AYE,omitempty"`
	AyeWithReservations MemberEntryList `json:"AYEWR,omitempty"`
	Nay                 MemberEntryList `json:"NAY,omitempty"` // ?
	Excused             MemberEntryList `json:"EXC,omitempty"` // excused
	Absent              MemberEntryList `json:"Absent,omitempty"`
}

type NYSenateAPI

type NYSenateAPI struct {
	UserAgent string

	// Limiter throttles requests to the API
	Limiter *rate.Limiter
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(token string) *NYSenateAPI

func (NYSenateAPI) Bills

func (a NYSenateAPI) Bills(ctx context.Context, session string, offset int) (*BillsResponse, error)

func (NYSenateAPI) GetBill

func (a NYSenateAPI) GetBill(ctx context.Context, session, printNo string) (*Bill, error)

func (NYSenateAPI) GetBillUpdates

func (a NYSenateAPI) GetBillUpdates(ctx context.Context, from, to time.Time) (*BillUpdateResponse, error)

GetBillUpdates returns a list of bills that have been updated in the given time range. https://legislation.nysenate.gov/static/docs/html/bills.html#detailed-update-digests

func (NYSenateAPI) GetMembers

func (a NYSenateAPI) GetMembers(ctx context.Context, session string, c Chamber) ([]MemberEntry, error)

Note: response might have duplicates

type Person

type Person struct {
	PersonID   int         `json:"personId"`
	FullName   string      `json:"fullName"`
	FirstName  string      `json:"firstName"`
	MiddleName string      `json:"middleName"`
	LastName   string      `json:"lastName"`
	Email      string      `json:"email"`
	Prefix     string      `json:"prefix"`
	Suffix     interface{} `json:"suffix"`
	Verified   bool        `json:"verified"`
	ImgName    string      `json:"imgName"`
}

type VoteEntries

type VoteEntries []VoteEntry

func (VoteEntries) Filter

func (v VoteEntries) Filter(chamber string) VoteEntries

type VoteEntry

type VoteEntry struct {
	MemberID  int
	Chamber   string
	VoteType  string // COMMITTEE, FLOOR
	Vote      string // Aye, Nay, Excused
	ShortName string
	FullName  string
}

Jump to

Keyboard shortcuts

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