Documentation ¶
Overview ¶
Package gophish provides a convenient wrapper around the Phish.Net API.
Index ¶
- func FormatDate(date time.Time) string
- func ParseDate(date string) (time.Time, error)
- type Client
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) SetlistsGet(req *SetlistsGetRequest) (*SetlistsResponse, error)
- func (c *Client) SetlistsLatest() (*SetlistsResponse, error)
- func (c *Client) SetlistsRandom() (*SetlistsResponse, error)
- func (c *Client) SetlistsRecent(req *SetlistsRecentRequest) (*SetlistsResponse, error)
- func (c *Client) SetlistsTiph() (*SetlistsResponse, error)
- func (c *Client) ShowsQuery(req *ShowsQueryRequest) (*ShowsQueryResponse, error)
- type ClientOpt
- type ErrorResponse
- type ErrorResponseBody
- type ResponseHeader
- type Setlist
- type SetlistsGetRequest
- type SetlistsRecentRequest
- type SetlistsResponse
- type SetlistsResponseBody
- type Show
- type ShowsQueryRequest
- type ShowsQueryResponse
- type ShowsQueryResponseBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatDate ¶
FormatDate converts a time.Time into the correct format that the Phish.Net API expects.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a http.Client wrapper that handles rate limiting as well as provides convenience methods for various Phish.Net API endpoints.
func (*Client) SetlistsGet ¶
func (c *Client) SetlistsGet(req *SetlistsGetRequest) (*SetlistsResponse, error)
func (*Client) SetlistsLatest ¶
func (c *Client) SetlistsLatest() (*SetlistsResponse, error)
func (*Client) SetlistsRandom ¶
func (c *Client) SetlistsRandom() (*SetlistsResponse, error)
func (*Client) SetlistsRecent ¶
func (c *Client) SetlistsRecent(req *SetlistsRecentRequest) (*SetlistsResponse, error)
func (*Client) SetlistsTiph ¶
func (c *Client) SetlistsTiph() (*SetlistsResponse, error)
func (*Client) ShowsQuery ¶
func (c *Client) ShowsQuery(req *ShowsQueryRequest) (*ShowsQueryResponse, error)
type ClientOpt ¶
type ClientOpt func(*Client)
ClientOpt is a option configuring the Client.
func WithBaseUrl ¶
WithBaseUrl sets the baseurl that should be used for requests. The default is https://api.phish.net/v3.
func WithQueryRate ¶
WithQueryRate sets the rate limiting that should be used when making requests with the client.
func WithTimeout ¶
WithTimeout sets the default timeout for making HTTP requests.
type ErrorResponse ¶
type ErrorResponse struct { ErrorCode int `json:"error"` Response *ErrorResponseBody `json:"response"` }
ErrorResponse is the standard error format for API errors.
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
type ErrorResponseBody ¶
type ResponseHeader ¶
type Setlist ¶
type Setlist struct { ShowId int `json:"showid"` ShowDate string `json:"showdate"` ShortDate string `json:"short_date"` LongDate string `json:"long_date"` RelativeDate string `json:"relative_date"` Url string `json:"url"` GapChart string `json:"gapchart"` Artist string `json:"artist"` ArtistId int `json:"artistid"` VenueId int `json:"venueid"` Venue string `json:"venue"` Location string `json:"location"` SetlistData string `json:"setlistdata"` SetlistNotes string `json:"setlistnotes"` Rating string `json:"rating"` }
type SetlistsGetRequest ¶
type SetlistsRecentRequest ¶
type SetlistsRecentRequest struct {
Limit int `url:"limit,omitempty"`
}
type SetlistsResponse ¶
type SetlistsResponse struct { *ResponseHeader Response *SetlistsResponseBody `json:"response"` }
type SetlistsResponseBody ¶
type Show ¶
type Show struct { ShowId int `json:"showid"` ShowDate string `json:"showdate"` ArtistId int `json:"artistid"` BilledAs string `json:"billed_as"` Link string `json:"link"` Location string `json:"location"` Venue string `json:"venue"` SetlistNotes string `json:"setlistnotes"` VenueId int `json:"venueid"` TourId int `json:"tourid"` TourName string `json:"tourname"` TourWhen string `json:"tourwhen"` ArtistLink string `json:"artistlink"` }
type ShowsQueryRequest ¶
type ShowsQueryRequest struct { ShowIds []string `url:"showids,omitempty"` Year int `url:"year,omitempty"` Month int `url:"month,omitempty"` Day int `url:"day,omitempty"` VenueId int `url:"venueid,omitempty"` TourId int `url:"tourid,omitempty"` Country string `url:"country,omitempty"` City string `url:"city,omitempty"` State string `url:"state,omitempty"` ShowdateGt string `url:"showdate_gt,omitempty"` ShowdateGte string `url:"showdate_gte,omitempty"` ShowdateLt string `url:"showdate_lt,omitempty"` ShowdateLte string `url:"showdate_lte,omitempty"` ShowyearGt int `url:"showyear_gt,omitempty"` ShowyearGte int `url:"showyear_gte,omitempty"` ShowyearLt int `url:"showyear_lt,omitempty"` ShowyearLte int `url:"showyear_lte,omitempty"` Limit int `url:"limit,omitempty"` Order string `url:"order,omitempty"` }
ShowsQueryRequest is the request type for the shows/query endpoint.
type ShowsQueryResponse ¶
type ShowsQueryResponse struct { *ResponseHeader Response *ShowsQueryResponseBody `json:"response"` }