client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHeaders

func CreateHeaders(apiKey string) map[string]string

CreateHeaders creates a standard set of headers with optional API key

Types

type Client

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

Client is the base HTTP client for the SDK

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a new HTTP client

func NewClientWithHTTPClient

func NewClientWithHTTPClient(baseURL string, httpClient *http.Client) *Client

NewClientWithHTTPClient creates a new client with a custom HTTP client

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, url string, headers map[string]string) (*Response, error)

Delete performs a DELETE request

func (*Client) Get

func (c *Client) Get(ctx context.Context, url string, headers map[string]string) (*Response, error)

Get performs a GET request

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, url string, body interface{}, headers map[string]string) (*Response, error)

Patch performs a PATCH request

func (*Client) Post

func (c *Client) Post(ctx context.Context, url string, body interface{}, headers map[string]string) (*Response, error)

Post performs a POST request

func (*Client) Put

func (c *Client) Put(ctx context.Context, url string, body interface{}, headers map[string]string) (*Response, error)

Put performs a PUT request

type HTTPClient

type HTTPClient interface {
	Get(ctx context.Context, url string, headers map[string]string) (*Response, error)
	Post(ctx context.Context, url string, body interface{}, headers map[string]string) (*Response, error)
	Put(ctx context.Context, url string, body interface{}, headers map[string]string) (*Response, error)
	Patch(ctx context.Context, url string, body interface{}, headers map[string]string) (*Response, error)
	Delete(ctx context.Context, url string, headers map[string]string) (*Response, error)
}

HTTPClient defines the interface for making HTTP requests

type Response

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

Response wraps the HTTP response

Jump to

Keyboard shortcuts

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