client

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package client provides the HTTP client for the deploybase API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithToken

func WithToken(ctx context.Context, token string) context.Context

WithToken returns a new context with the given bearer token attached. The token is read by APIClient methods and used in place of the static apiKey.

Types

type APIClient

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

APIClient is a thin HTTP client for the deploybase REST API.

func NewAPIClient

func NewAPIClient(cfg config.Config) *APIClient

NewAPIClient creates a configured API client.

func (*APIClient) Delete

func (c *APIClient) Delete(ctx context.Context, path string) *errors.APIError

Delete performs a DELETE request. Returns nil on success (204 No Content).

func (*APIClient) Get

func (c *APIClient) Get(ctx context.Context, path string, params url.Values, out any) *errors.APIError

Get performs a GET request and unmarshals the "data" field into out. Returns *APIError on non-2xx responses.

func (*APIClient) GetRaw

func (c *APIClient) GetRaw(ctx context.Context, path string, params url.Values) (json.RawMessage, *errors.APIError)

GetRaw performs a GET and returns the raw "data" JSON bytes.

func (*APIClient) PatchRaw

func (c *APIClient) PatchRaw(ctx context.Context, path string, body any) (json.RawMessage, *errors.APIError)

PatchRaw performs a PATCH and returns the raw "data" JSON bytes.

func (*APIClient) PostRaw

func (c *APIClient) PostRaw(ctx context.Context, path string, body any) (json.RawMessage, *errors.APIError)

PostRaw performs a POST and returns the raw "data" JSON bytes.

Jump to

Keyboard shortcuts

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