Documentation
¶
Index ¶
- func AsStravaError(err error, target **StravaError) bool
- type Client
- func (c *Client) Get(ctx context.Context, path string, params map[string]string) ([]byte, error)
- func (c *Client) GetRateLimits() RateLimits
- func (c *Client) Post(ctx context.Context, path string, body interface{}) ([]byte, error)
- func (c *Client) PostMultipart(ctx context.Context, path string, body io.Reader, contentType string) ([]byte, error)
- func (c *Client) Put(ctx context.Context, path string, body interface{}) ([]byte, error)
- func (c *Client) RateLimitWarning() string
- func (c *Client) SetBaseURL(u string)
- func (c *Client) SetTokenURL(u string)
- type RateLimits
- type StravaError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsStravaError ¶
func AsStravaError(err error, target **StravaError) bool
AsStravaError checks if an error is a StravaError and assigns it to the target.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Strava API HTTP client with automatic token refresh.
func (*Client) GetRateLimits ¶
func (c *Client) GetRateLimits() RateLimits
GetRateLimits returns the current rate limit state.
func (*Client) PostMultipart ¶
func (c *Client) PostMultipart(ctx context.Context, path string, body io.Reader, contentType string) ([]byte, error)
PostMultipart makes an authenticated POST request with a pre-built multipart body. The contentType must include the multipart boundary (use writer.FormDataContentType()).
func (*Client) RateLimitWarning ¶
RateLimitWarning returns a warning string if rate limit usage exceeds 80%. Returns empty string when usage is within acceptable limits.
func (*Client) SetBaseURL ¶
SetBaseURL overrides the API base URL (for testing).
func (*Client) SetTokenURL ¶
SetTokenURL overrides the token refresh URL (for testing).
type RateLimits ¶
RateLimits holds the current Strava API rate limit state.
type StravaError ¶
StravaError represents an error response from the Strava API.
func (*StravaError) Error ¶
func (e *StravaError) Error() string