Documentation
¶
Index ¶
- Constants
- Variables
- func NewErrorAPI(err error) error
- func NewRequestError(err error) error
- type Client
- func (api *Client) ExchangeAuth() (*TokenPair, error)
- func (api *Client) Get(u string, result interface{}) error
- func (api *Client) Patch(u string, request any, result any) error
- func (api *Client) Post(u string, request any, result any) error
- func (api *Client) RefreshToken() (*OAuthTokenResponse, error)
- func (api *Client) RefreshTokenIfExpired() error
- func (client *Client) RequestsMade() int64
- func (client *Client) SetMRPS(rps int) *Client
- type ClientOptions
- type OAuthTokenResponse
- type RequestOptions
- type TokenPair
Constants ¶
View Source
const ( DefaultContentType = "application/json" DefaultAccept = DefaultContentType DefaultCacheControl = "no-cache" MaxEntitiesPerRequest = 250 )
Variables ¶
View Source
var ( ErrNoContent = errors.New("no content") ErrNoAuth = errors.New("not authorized") ErrUnreachable = errors.New("unreachable") ErrInvalidOptionsURL = errors.New("invalid URL options") ErrInvalidExchangeAuthOptions = errors.New( "invalid ExchangeAuth options", ) ErrUrlParsing = errors.New("URL parsing") )
Functions ¶
func NewErrorAPI ¶ added in v0.5.0
func NewRequestError ¶ added in v0.5.0
Types ¶
type Client ¶
type Client struct {
*log.Logger
BaseURL *url.URL
Debug bool
// contains filtered or unexported fields
}
func (*Client) ExchangeAuth ¶
func (*Client) RefreshToken ¶
func (api *Client) RefreshToken() (*OAuthTokenResponse, error)
func (*Client) RefreshTokenIfExpired ¶
func (*Client) RequestsMade ¶ added in v0.6.0
type ClientOptions ¶
type ClientOptions struct {
URL string `json:"url"`
RedirectURL string `json:"redirect_url"`
AuthCode string `json:"auth_code"`
ClientId string `json:"client_id"`
ClientSecret string `json:"client_secret"`
AccessToken string `json:"access_token"`
ExpirationAt time.Time `json:"expiration_at,omitempty"`
RefreshToken string `json:"refresh_token"`
}
type OAuthTokenResponse ¶ added in v0.5.0
type RequestOptions ¶ added in v0.5.0
Click to show internal directories.
Click to hide internal directories.