Documentation
¶
Index ¶
- Constants
- Variables
- func DebugRequest(req *http.Request)
- func DebugResponse(res *http.Response)
- func Do[T any](apiReq *APIRequest) (*T, error)
- func DoPaginated[T []E, E any](apiReq *APIRequest) (chan func() (*E, error), error)
- func InitClients(apiKeys []models.APIKey) error
- func OauthAPIKey() *models.APIKey
- func OauthToken(apiKey models.APIKey, code string, next string) (string, error)
- type APIRequest
- func (apiReq *APIRequest) Authenticated() *APIRequest
- func (apiReq *APIRequest) AuthenticatedAs(accessToken string) *APIRequest
- func (apiReq *APIRequest) OutputHeadersIn(output **http.Header) *APIRequest
- func (apiReq *APIRequest) SinceLastFetch(db *gorm.DB, defaultTime time.Time) *APIRequest
- func (apiReq *APIRequest) WithHeaders(headers map[string]string) *APIRequest
- func (apiReq *APIRequest) WithMaxConcurrentFetches(n int64) *APIRequest
- func (apiReq *APIRequest) WithMethod(method string) *APIRequest
- func (apiReq *APIRequest) WithPageSize(n int) *APIRequest
- func (apiReq *APIRequest) WithParams(params map[string]string) *APIRequest
- type APIResult
- type KeysManager
- type OauthTokenResponse
- type PageCountError
- type ParseError
- type RLHTTPClient
- type Stats
- type Target
Constants ¶
View Source
const ( RequestsPerSecond = 2 RequestsPerHour = 1200 SleepBetweenTries = 100 * time.Millisecond )
View Source
const DebugVar = "httpdebug"
Variables ¶
View Source
var APIStats = Stats{}
Functions ¶
func DebugRequest ¶
func DebugResponse ¶
func Do ¶
func Do[T any](apiReq *APIRequest) (*T, error)
func DoPaginated ¶
func DoPaginated[T []E, E any](apiReq *APIRequest) (chan func() (*E, error), error)
func InitClients ¶
func OauthAPIKey ¶
Types ¶
type APIRequest ¶
type APIRequest struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func NewRequest(endpoint string) *APIRequest
func (*APIRequest) Authenticated ¶
func (apiReq *APIRequest) Authenticated() *APIRequest
func (*APIRequest) AuthenticatedAs ¶
func (apiReq *APIRequest) AuthenticatedAs(accessToken string) *APIRequest
func (*APIRequest) OutputHeadersIn ¶
func (apiReq *APIRequest) OutputHeadersIn(output **http.Header) *APIRequest
func (*APIRequest) SinceLastFetch ¶
func (apiReq *APIRequest) SinceLastFetch(db *gorm.DB, defaultTime time.Time) *APIRequest
func (*APIRequest) WithHeaders ¶
func (apiReq *APIRequest) WithHeaders(headers map[string]string) *APIRequest
func (*APIRequest) WithMaxConcurrentFetches ¶
func (apiReq *APIRequest) WithMaxConcurrentFetches(n int64) *APIRequest
func (*APIRequest) WithMethod ¶
func (apiReq *APIRequest) WithMethod(method string) *APIRequest
func (*APIRequest) WithPageSize ¶
func (apiReq *APIRequest) WithPageSize(n int) *APIRequest
func (*APIRequest) WithParams ¶
func (apiReq *APIRequest) WithParams(params map[string]string) *APIRequest
type KeysManager ¶
type KeysManager struct {
// contains filtered or unexported fields
}
var DefaultKeysManager *KeysManager = nil
func NewKeysManager ¶
func NewKeysManager(db *gorm.DB) (*KeysManager, error)
func (*KeysManager) DeleteAllKeys ¶
func (manager *KeysManager) DeleteAllKeys() error
func (*KeysManager) DeleteOne ¶
func (manager *KeysManager) DeleteOne(id int) error
type OauthTokenResponse ¶
type OauthTokenResponse struct {
AccessToken string `json:"access_token"`
}
type PageCountError ¶
type PageCountError struct {
// contains filtered or unexported fields
}
func (PageCountError) Error ¶
func (pageCountErr PageCountError) Error() string
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
func (ParseError) Error ¶
func (parseError ParseError) Error() string
type RLHTTPClient ¶
func RateLimitedClient ¶
func RateLimitedClient(accessToken string, apiKey models.APIKey) *RLHTTPClient
Click to show internal directories.
Click to hide internal directories.