api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
}

func (*APIError) Error

func (e *APIError) Error() string

type AuthHeader

type AuthHeader struct {
	Name  string
	Value string
}

AuthHeader defines a custom authentication header name and value format.

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey string, opts ...ClientOption) *Client

func (*Client) Delete

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

func (*Client) Do

func (c *Client) Do(ctx context.Context, req Request) (*http.Response, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, result any) error

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body, result any) error

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, body, result any) error

type ClientOption

type ClientOption func(*Client)

func WithAuthHeader

func WithAuthHeader(name, value string) ClientOption

WithAuthHeader sets a custom auth header instead of the default Authorization: Bearer.

func WithBaseURL

func WithBaseURL(url string) ClientOption

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOption

func WithUserAgent

func WithUserAgent(ua string) ClientOption

type Request

type Request struct {
	Method  string
	Path    string
	Body    any
	Headers map[string]string
}

Jump to

Keyboard shortcuts

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