api

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package api provides the HTTP client for the weside.ai REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the HTTP client for the weside API.

func NewClient

func NewClient(baseURL, token string) *Client

NewClient creates a new API client.

func (*Client) Delete

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

Delete sends a DELETE request.

func (*Client) DoRaw

func (c *Client) DoRaw(ctx context.Context, method, path string, body any) (*http.Response, error)

DoRaw sends a request and returns the raw response (for streaming).

func (*Client) Get

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

Get sends a GET request.

func (*Client) Patch

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

Patch sends a PATCH request.

func (*Client) Post

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

Post sends a POST request.

func (*Client) Put

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

Put sends a PUT request.

type Error

type Error struct {
	StatusCode int
	Status     string
	Detail     string `json:"detail"`
	Message    string `json:"message"`
}

Error represents an error response from the API.

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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