manifold

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package manifold implements the Go language bindings for the Manifold API. The bindings will support exactly one version of the API at a time, even though the data types for all currently supported versions can be found in the v* directories.

Index

Constants

View Source
const (
	APIPrefix   = "/manifold-api" // APIPrefix is the prefix for all API paths.
	APIVersion  = "v3-preview"    // APIVersion is the prefix for all API paths (without the leading slash).
	PortNumber  = 7434            // PortNumber is the default port for `sifid` (sifi on a keypad).
	ServiceName = "sifid"         // ServiceName is the public name of the manifold-api service.
)

Variables

This section is empty.

Functions

func WithDebug

func WithDebug(b bool) func(*client.Client)

WithDebug is an option setting function for NewClient that sets the debug mode on the underlying generic http client.

func WithLogger

func WithLogger(logger *slog.Logger) func(*client.Client)

WithLogger is an option setting function for NewClient that sets the logger on the underlying generic http client.

func WithUserAgent

func WithUserAgent(ua string) func(*client.Client)

WithUserAgent is an option setting function for NewClient that sets the user-agent on the underlying generic http client.

Types

type Client

type Client struct {
	Cloud    *cloud.Service
	Metal    *metal.Service
	Upload   *upload.Service
	Snapshot *snapshot.Service

	*client.Client
}

Client is a connection to the manifold-api service.

func NewClient

func NewClient(o *client.Options, fn ...func(*client.Client)) *Client

NewClient returns a new client.

type InfoResponse

type InfoResponse struct {
	ProductName    string `json:"product_name"`
	ProductRelease string `json:"product_release"`
}

InfoResponse is the response body for GET /.

type ResponseError

type ResponseError struct {
	Code    int      `json:"code"`
	Text    string   `json:"error"`
	Details []string `json:"details"`
}

ResponseError is the response body for all error responses.

func NewErrorResponse

func NewErrorResponse(code int, err error, detail ...string) *ResponseError

NewErrorResponse returns a new ErrorResponse.

func (ResponseError) Error

func (e ResponseError) Error() string

Error implements the error interface for e.

func (ResponseError) StatusCode

func (e ResponseError) StatusCode() int

StatusCode returns the status code for e.

Jump to

Keyboard shortcuts

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