Documentation
¶
Overview ¶
Package firstscreen reads what the first screen of a new account shows (design first-screen §2): Postgres only, never Rivian. Every query filters on user_id and is bounded: an indexed range per user, a LIMIT of 10000 rows for a count, or a LIMIT 1.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Currency ¶
type Currency struct {
Currency string `json:"currency"`
Sessions int `json:"sessions"`
HomeSessions int `json:"home_sessions"`
KWh float64 `json:"kwh"`
Billed float64 `json:"billed"`
}
Currency is one currency's totals. A home session with no price counts in HomeSessions and adds nothing to Billed.
type Data ¶
type Data struct {
// Vehicles is how many vehicles the account has. Receipts are per account, not per vehicle: with more than one the card says
// "on your Rivian account".
Vehicles int `json:"vehicles"`
// OdometerMi is the last recorded odometer (the earlier owner's miles included on a used truck); nil before any state is recorded.
OdometerMi *float64 `json:"odometer_mi"`
Recorded Counts `json:"recorded"`
Imported Counts `json:"imported"`
// FirstRecordedChargeAt is when the first live-recorded charge started, so the client knows when two weeks of charges exist.
FirstRecordedChargeAt *time.Time `json:"first_recorded_charge_at"`
Receipts Receipts `json:"receipts"`
}
Data is the endpoint's body.
type NamedCount ¶
NamedCount is a vendor or a city and how many sessions.
type Receipts ¶
type Receipts struct {
OptIn bool `json:"opt_in"`
// State: "off" (not opted in), "waiting" (opted in, the first pass has not finished), "error" (it failed and nothing is stored yet),
// "empty" (it finished and Rivian returned none), "ready".
State string `json:"state"`
Sessions int `json:"sessions"`
FirstMonth string `json:"first_month,omitempty"` // YYYY-MM of the first session
Currencies []Currency `json:"currencies"`
TopVendors []NamedCount `json:"top_vendors"`
TopCities []NamedCount `json:"top_cities"`
LastSuccessAt *time.Time `json:"last_success_at"`
}
Receipts is the "billed by Rivian" card. Without the user's opt-in it holds only OptIn false and nothing is read.
Click to show internal directories.
Click to hide internal directories.