client

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 9 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
	Status     string
	Method     string
	URL        string
	Body       []byte
}

APIError is returned for non-2xx responses. It captures the HTTP status, the raw response body, and any decoded JSON payload.

func (*APIError) Error

func (e *APIError) Error() string

type Client

type Client struct {
	// BaseURL is prepended to every request path (no trailing slash).
	BaseURL string
	// HTTP is the underlying HTTP client. nil falls back to http.DefaultClient.
	HTTP *http.Client
	// DefaultHeaders are merged onto every request before per-call headers.
	DefaultHeaders http.Header
}

Client is the typed HTTP client for the generated API.

func NewClient

func NewClient(baseURL string) *Client

NewClient returns a Client targeting baseURL.

func (*Client) CreateItem

func (c *Client) CreateItem(ctx context.Context, idempotencyKey string, body CreateItemBody) (*Item, error)

Create an item

func (*Client) DeleteItem

func (c *Client) DeleteItem(ctx context.Context, id int64, idempotencyKey string, ifMatch string) error

Delete an item

func (*Client) GetItem

func (c *Client) GetItem(ctx context.Context, id int64) (*Item, error)

Get an item

func (*Client) Healthz

func (c *Client) Healthz(ctx context.Context) (*Health, error)

Liveness check

func (*Client) ListItems

func (c *Client) ListItems(ctx context.Context, cursor *string, limit *int64) (*ItemList, error)

List items

type CreateItemBody

type CreateItemBody struct {
	Name string `json:"name"`
}

type Health

type Health struct {
	Status string `json:"status"`
}

type Item

type Item struct {
	Id        int64  `json:"id"`
	Name      string `json:"name"`
	CreatedAt string `json:"created_at"`
}

type ItemList

type ItemList struct {
	Items []Item `json:"items"`
}

type Problem

type Problem struct {
	Title  string  `json:"title"`
	Status int64   `json:"status"`
	Detail *string `json:"detail,omitempty"`
}

Jump to

Keyboard shortcuts

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