Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) FullURL(qs string) string
- func (c *Client) Get(u *url.URL) (*http.Response, error)
- func (c *Client) GetConditions(cq ConditionsQuery) (ConditionsResponse, error)
- func (c *Client) GetTaxonomy(tq TaxonomyQuery) (Taxonomy, error)
- func (c *Client) GetTides(tq TidesQuery) (TidesResponse, error)
- func (c *Client) GetWave(wq WaveQuery) (WaveResponse, error)
- func (c *Client) PostLogin(lq LoginQuery, lp LoginPayload) (LoginResponse, error)
- type Condition
- type ConditionsAssociated
- type ConditionsQuery
- type ConditionsResponse
- type ErrorLoginResponse
- type Forecaster
- type Location
- type LoginPayload
- type LoginQuery
- type LoginResponse
- type Report
- type Surf
- type Swell
- type Taxonomy
- type TaxonomyQuery
- type Tide
- type TidesAssociated
- type TidesQuery
- type TidesResponse
- type Units
- type Wave
- type WaveAssociated
- type WaveQuery
- type WaveResponse
Constants ¶
const ConditionsBaseURL = "https://services.surfline.com/kbyg/regions/forecasts/conditions"
ConditionsBaseURL is the base URL for the regional conditions service
const LoginBaseURL = "https://services.surfline.com/trusted/token"
const TaxonomyBaseURL = "https://services.surfline.com/taxonomy"
TaxonomyBaseURL is the base URL for the taxonomy service
const TidesBaseURL = "https://services.surfline.com/kbyg/spots/forecasts/tides"
TidesBaseURL is the base URL for the spot tides service
const WaveBaseURL = "https://services.surfline.com/kbyg/spots/forecasts/wave"
WaveBaseURL is the base URL for the wave/swell service
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is the SurflineF HTTP Client.
func (*Client) GetConditions ¶
func (c *Client) GetConditions(cq ConditionsQuery) (ConditionsResponse, error)
GetConditions fetches a ConditionsResponse from the API
func (*Client) GetTaxonomy ¶ added in v2.2.0
func (c *Client) GetTaxonomy(tq TaxonomyQuery) (Taxonomy, error)
GetTaxonomy fetches a Taxonomy from the API
func (*Client) GetTides ¶
func (c *Client) GetTides(tq TidesQuery) (TidesResponse, error)
GetTides fetches a TidesResponse from the API
func (*Client) GetWave ¶ added in v2.4.0
func (c *Client) GetWave(wq WaveQuery) (WaveResponse, error)
GetWave fetches a WaveResponse from the API
func (*Client) PostLogin ¶ added in v2.7.0
func (c *Client) PostLogin(lq LoginQuery, lp LoginPayload) (LoginResponse, error)
type Condition ¶
type Condition struct { Timestamp int `json:"timestamp"` Forecaster Forecaster `json:"forecaster"` Human bool `json:"human"` Observation string `json:"observation"` AM Report `json:"am"` PM Report `json:"pm"` }
Condition is the JSON struct for a daily condition
type ConditionsAssociated ¶ added in v2.5.0
ConditionsAssociated is associated info to go along with the Conditions API response It includes units of measurement and utc offset for timezones
type ConditionsQuery ¶ added in v2.5.0
type ConditionsQuery struct { SubregionID string `url:"subregionId"` Days int `url:"days"` AccessToken string `url:"accesstoken,omitempty"` }
ConditionsQuery is used to build Conditions query params
type ConditionsResponse ¶
type ConditionsResponse struct { Associated ConditionsAssociated `json:"associated"` Data conditonsData `json:"data"` }
ConditionsResponse is the root JSON struct for condition data
type ErrorLoginResponse ¶ added in v2.7.0
type Forecaster ¶
Forecaster is the JSON struct for the forecaster
type LoginPayload ¶ added in v2.7.0
type LoginPayload struct { AuthorizationString string `json:"authorizationString"` DeviseID string `json:"device_id"` DeviseType string `json:"device_type"` Forced bool `json:"forced"` GrantType string `json:"grant_type"` Password string `json:"password"` Username string `json:"username"` }
func DefaultLoginPayload ¶ added in v2.7.0
func DefaultLoginPayload(username string, password string) LoginPayload
type LoginQuery ¶ added in v2.7.0
type LoginQuery struct {
IsShortLived bool `url:"isShortLived"`
}
type LoginResponse ¶ added in v2.7.0
type Report ¶
type Report struct { MaxHeight float64 `json:"maxHeight"` MinHeight float64 `json:"minHeight"` HumanRelation string `json:"humanRelation"` Rating string `json:"rating"` Plus bool `json:"plus"` OccasionalHeight float64 `json:"occasionalHeight"` }
Report is the JSON struct of a report (for the AM or PM)
type Surf ¶ added in v2.4.0
type Surf struct { Min float64 `json:"min"` Max float64 `json:"max"` OptimalScore int `json:"optimalScore"` }
Surf is the JSON struct for an interval's nearshore height At least... I think it is nearshore height
type Swell ¶ added in v2.4.0
type Swell struct { Height float64 `json:"height"` Period int `json:"period"` Direction float64 `json:"direction"` DirectionMin float64 `json:"directionMin"` OptimalScore int `json:"optimalScore"` }
Swell is the JSON struct for an interval's individual swell
type Taxonomy ¶ added in v2.2.0
type Taxonomy struct { ID string `json:"_id"` Spot string `json:"spot"` // different kind of ID for spots Subregion string `json:"subregion"` // different kind of ID for subregions Type string `json:"type"` // ["geoname", "spot", "subregion"] Name string `json:"name"` HasSpots bool `json:"hasSpots"` Contains []Taxonomy `json:"contains"` }
Taxonomy is the JSON struct for a daily condition
type TaxonomyQuery ¶ added in v2.2.0
type TaxonomyQuery struct { ID string `url:"id"` MaxDepth int `url:"maxDepth"` Type string `url:"type"` }
TaxonomyQuery is used to build Taxonomy query params
type Tide ¶
type Tide struct { Timestamp int `json:"timestamp"` Type string `json:"type"` Height float64 `json:"height"` }
Tide is the JSON struct for a tide reading
type TidesAssociated ¶ added in v2.5.0
type TidesAssociated struct { Units Units `json:"units"` UTCOffset int32 `json:"utcOffset"` TideLocation Location `json:"tideLocation"` }
TidesAssociated is associated info to go along with the Tide API response It includes units of measurement, utc offset for timezones, related locations, etc
type TidesQuery ¶ added in v2.5.0
type TidesQuery struct { SpotID string `url:"spotId"` Days int `url:"days"` AccessToken string `url:"accesstoken,omitempty"` }
TidesQuery is used to build Tides query params
type TidesResponse ¶
type TidesResponse struct { Associated TidesAssociated `json:"associated"` Data tidesData `json:"data"` }
TidesResponse is the root JSON struct for tide data
type Units ¶ added in v2.4.0
type Units struct { Temperature string `json:"temperature"` TideHeight string `json:"tideHeight"` SwellHeight string `json:"swellHeight"` WaveHeight string `json:"waveHeight"` WindSpeed string `json:"windSpeed"` Model string `json:"model"` }
Units is a collection of units for measurements (heights, speeds, etc)
type Wave ¶ added in v2.4.0
type Wave struct { Timestamp int `json:"timestamp"` Surf Surf `json:"surf"` Swells []Swell `json:"swells"` }
Wave is the JSON struct for an interval's swells
type WaveAssociated ¶ added in v2.5.0
type WaveAssociated struct { Units Units `json:"units"` UTCOffset int32 `json:"utcOffset"` Location Location `json:"location"` ForecastLocation Location `json:"forecastLocation"` OffshoreLocation Location `json:"offshoreLocation"` }
WaveAssociated is associated info to go along with the Wave API response It includes units of measurement, utc offset for timezones, related locations, etc
type WaveQuery ¶ added in v2.5.0
type WaveQuery struct { SpotID string `url:"spotId"` Days int `url:"days"` IntervalHours int `url:"intervalHours"` MaxHeights bool `url:"maxHeights"` AccessToken string `url:"accesstoken,omitempty"` }
WaveQuery is used to build Wave query params
type WaveResponse ¶ added in v2.4.0
type WaveResponse struct { Associated WaveAssociated `json:"associated"` Data waveData `json:"data"` }
WaveResponse is the root JSON struct for wave data