api

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnauthorized        = errors.New("unauthorized")
	ErrForbidden           = errors.New("forbidden")
	ErrNotFound            = errors.New("not found")
	ErrConflict            = errors.New("conflict")
	ErrUnprocessableEntity = errors.New("unprocessable entity")
	ErrRateLimited         = errors.New("rate limited")
)

Functions

func ParsePaginationLinks(linkHeader string) (nextPage int, hasNext bool)

Types

type Client

type Client struct {
	BaseURL    string
	Token      string
	HTTPClient *http.Client
}

func NewClient

func NewClient(baseURL, token string) *Client

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string, opts ...RequestOption) (*Response, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, opts ...RequestOption) (*Response, error)

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, path string, body interface{}, opts ...RequestOption) (*Response, error)

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body interface{}, opts ...RequestOption) (*Response, error)

type PaginatedResponse

type PaginatedResponse struct {
	Items      []map[string]interface{}
	Page       int
	PerPage    int
	TotalPages int
	HasNext    bool
}

type RequestOption

type RequestOption func(*http.Request)

func WithPagination

func WithPagination(page, perPage int) RequestOption

func WithQueryParams

func WithQueryParams(params map[string]string) RequestOption

type Response

type Response struct {
	StatusCode int
	Headers    http.Header
	Body       []byte
}

func (*Response) Decode

func (r *Response) Decode(v interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL