Versions in this module Expand all Collapse all v0 v0.1.1 Oct 9, 2025 v0.1.0 Oct 9, 2025 Changes in this version + const DefaultOAuthAudience + const DefaultOAuthTokenURL + const ScopeBusinessAPI + const ScopeSchoolAPI + var ErrAuthFailed = fmt.Errorf("authentication failed") + var ErrInvalidCursor = fmt.Errorf("invalid pagination cursor") + var ErrInvalidResponse = fmt.Errorf("invalid response format") + var ErrNoNextPage = fmt.Errorf("no next page available") + var ErrRateLimited = fmt.Errorf("rate limit exceeded") + func HasNextPage(links *Links) bool + func HasPrevPage(links *Links) bool + func LoadPrivateKeyFromEnv() (any, error) + func LoadPrivateKeyFromFile(filePath string) (any, error) + func ParsePrivateKey(keyData []byte) (any, error) + func ValidatePrivateKey(privateKey any) error + type APIError struct + Code string + Detail string + ID string + Links *ErrorLinks + Meta *APIErrorMeta + Source *APIErrorSource + Status string + Title string + func (e *APIError) Error() string + type APIErrorMeta struct + AdditionalProperties map[string]any + func (m *APIErrorMeta) MarshalJSON() ([]byte, error) + func (m *APIErrorMeta) UnmarshalJSON(data []byte) error + type APIErrorResponse struct + Details map[string]any + ErrorCode string + Message string + type APIErrorSource struct + JsonPointer *JsonPointer + Parameter *Parameter + type APIKeyAuth struct + func NewAPIKeyAuth(apiKey, header string) *APIKeyAuth + func (a *APIKeyAuth) ApplyAuth(req *resty.Request) error + type APIResponse struct + Data []T + Links Links + Meta Meta + type AuthProvider interface + ApplyAuth func(req *resty.Request) error + type Client struct + func NewClient(config Config) (*Client, error) + func NewClientFromEnv() (*Client, error) + func NewClientFromEnvWithOptions(debug bool, timeout time.Duration, userAgent string) (*Client, error) + func NewClientFromFile(keyID, issuerID, privateKeyPath string) (*Client, error) + func NewClientFromFileWithOptions(keyID, issuerID, privateKeyPath string, debug bool, timeout time.Duration, ...) (*Client, error) + func (c *Client) Close() error + func (c *Client) Delete(ctx context.Context, path string, queryParams map[string]string, ...) error + func (c *Client) DeleteWithBody(ctx context.Context, path string, body any, headers map[string]string, ...) error + func (c *Client) Get(ctx context.Context, path string, queryParams map[string]string, ...) error + func (c *Client) GetAllPages(ctx context.Context, path string, queryParams map[string]string, ...) error + func (c *Client) GetHTTPClient() *resty.Client + func (c *Client) GetNextPage(ctx context.Context, nextURL string, headers map[string]string, result any) error + func (c *Client) GetPaginated(ctx context.Context, path string, queryParams map[string]string, ...) error + func (c *Client) Patch(ctx context.Context, path string, body any, headers map[string]string, ...) error + func (c *Client) Post(ctx context.Context, path string, body any, headers map[string]string, ...) error + func (c *Client) PostMultipart(ctx context.Context, path string, files map[string]string, ...) error + func (c *Client) PostWithQuery(ctx context.Context, path string, queryParams map[string]string, body any, ...) error + func (c *Client) Put(ctx context.Context, path string, body any, headers map[string]string, ...) error + func (c *Client) QueryBuilder() *QueryBuilder + type ClientBuilder struct + func NewClientBuilder() *ClientBuilder + func (cb *ClientBuilder) Build() (*Client, error) + func (cb *ClientBuilder) Clone() *ClientBuilder + func (cb *ClientBuilder) MustBuild() *Client + func (cb *ClientBuilder) Validate() error + func (cb *ClientBuilder) WithAudience(audience string) *ClientBuilder + func (cb *ClientBuilder) WithBaseURL(baseURL string) *ClientBuilder + func (cb *ClientBuilder) WithDebug(debug bool) *ClientBuilder + func (cb *ClientBuilder) WithJWTAuth(keyID, issuerID string, privateKey any) *ClientBuilder + func (cb *ClientBuilder) WithJWTAuthFromEnv() *ClientBuilder + func (cb *ClientBuilder) WithJWTAuthFromFile(keyID, issuerID, privateKeyPath string) *ClientBuilder + func (cb *ClientBuilder) WithLogger(logger *zap.Logger) *ClientBuilder + func (cb *ClientBuilder) WithRetry(count int, wait time.Duration) *ClientBuilder + func (cb *ClientBuilder) WithTimeout(timeout time.Duration) *ClientBuilder + func (cb *ClientBuilder) WithUserAgent(userAgent string) *ClientBuilder + type Config struct + Auth AuthProvider + BaseURL string + Debug bool + Logger *zap.Logger + RetryCount int + RetryWait time.Duration + Timeout time.Duration + UserAgent string + type ErrorHandler struct + func NewErrorHandler(logger *zap.Logger) *ErrorHandler + func (eh *ErrorHandler) HandleError(resp *resty.Response, errorResp *ErrorResponse) error + type ErrorLinks struct + About string + Associated *ErrorLinksAssociated + type ErrorLinksAssociated struct + Href string + Meta *ErrorLinksAssociatedMeta + type ErrorLinksAssociatedMeta struct + AdditionalProperties map[string]any + func (m *ErrorLinksAssociatedMeta) MarshalJSON() ([]byte, error) + func (m *ErrorLinksAssociatedMeta) UnmarshalJSON(data []byte) error + type ErrorResponse struct + Errors []APIError + type JWTAuth struct + func NewJWTAuth(config JWTAuthConfig) *JWTAuth + func (j *JWTAuth) ApplyAuth(req *resty.Request) error + type JWTAuthConfig struct + Audience string + IssuerID string + KeyID string + PrivateKey any + Scope string + type JsonPointer struct + Pointer string + type Links struct + First string + Last string + Next string + Prev string + Self string + type Meta struct + Paging *Paging + type OAuth2Auth struct + func NewOAuth2Auth(config OAuth2Config) (*OAuth2Auth, error) + func (o *OAuth2Auth) ApplyAuth(req *resty.Request) error + func (o *OAuth2Auth) ForceRefresh() + func (o *OAuth2Auth) GetTokenInfo() TokenInfo + type OAuth2Config struct + ClientID string + HTTPClient *resty.Client + KeyID string + PrivateKey *ecdsa.PrivateKey + Scope string + TeamID string + TokenURL string + type OAuth2TokenResponse struct + AccessToken string + ExpiresIn int + Scope string + TokenType string + type PaginationOptions struct + Cursor string + Limit int + func (opts *PaginationOptions) AddToQueryBuilder(qb *QueryBuilder) *QueryBuilder + type Paging struct + Limit int + NextCursor string + Total int + type Parameter struct + Parameter string + type QueryBuilder struct + func NewQueryBuilder() *QueryBuilder + func (qb *QueryBuilder) AddBool(key string, value bool) *QueryBuilder + func (qb *QueryBuilder) AddCustom(key, value string) *QueryBuilder + func (qb *QueryBuilder) AddIfNotEmpty(key, value string) *QueryBuilder + func (qb *QueryBuilder) AddIfTrue(condition bool, key, value string) *QueryBuilder + func (qb *QueryBuilder) AddInt(key string, value int) *QueryBuilder + func (qb *QueryBuilder) AddInt64(key string, value int64) *QueryBuilder + func (qb *QueryBuilder) AddIntSlice(key string, values []int) *QueryBuilder + func (qb *QueryBuilder) AddString(key, value string) *QueryBuilder + func (qb *QueryBuilder) AddStringSlice(key string, values []string) *QueryBuilder + func (qb *QueryBuilder) AddTime(key string, value time.Time) *QueryBuilder + func (qb *QueryBuilder) Build() map[string]string + func (qb *QueryBuilder) BuildString() string + func (qb *QueryBuilder) Clear() *QueryBuilder + func (qb *QueryBuilder) Count() int + func (qb *QueryBuilder) Get(key string) string + func (qb *QueryBuilder) Has(key string) bool + func (qb *QueryBuilder) IsEmpty() bool + func (qb *QueryBuilder) Merge(other map[string]string) *QueryBuilder + func (qb *QueryBuilder) Remove(key string) *QueryBuilder + type TokenInfo struct + ExpiresAt time.Time + ExpiresIn int64 + HasToken bool + IsExpired bool + NeedsRefresh bool + type TokenResponse struct + AccessToken string + ExpiresIn int + Scope string + TokenType string