client

package
v1.11.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: LGPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyServerURL   = errors.New("empty contentserver url provided")
	ErrInvalidServerURL = errors.New("invalid contentserver url provided")
)

Functions

This section is empty.

Types

type Client

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

Client a content server client

func New added in v1.11.0

func New(transport Transport) *Client

func NewHTTPClient

func NewHTTPClient(url string) (c *Client, err error)

NewHTTPClient constructs a new client to talk to the contentserver. It returns an error if the provided url is empty or invalid.

func (*Client) Close added in v1.11.0

func (c *Client) Close()

func (*Client) GetContent

func (c *Client) GetContent(ctx context.Context, request *requests.Content) (*content.SiteContent, error)

GetContent request site content

func (*Client) GetNodes

func (c *Client) GetNodes(ctx context.Context, env *requests.Env, nodes map[string]*requests.Node) (map[string]*content.Node, error)

GetNodes request nodes

func (*Client) GetRepo

func (c *Client) GetRepo(ctx context.Context) (map[string]*content.RepoNode, error)

GetRepo get the whole repo

func (*Client) GetURIs

func (c *Client) GetURIs(ctx context.Context, dimension string, ids []string) (map[string]string, error)

GetURIs resolve uris for ids in a dimension

func (*Client) Update

func (c *Client) Update(ctx context.Context) (*responses.Update, error)

Update tell the server to update itself

type HTTPTransport added in v1.11.0

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

func NewHTTPTransport

func NewHTTPTransport(server string, opts ...HTTPTransportOption) *HTTPTransport

NewHTTPTransport will create a new http transport for the given server and client. Caution: the provided server url is not validated!

func (*HTTPTransport) Call added in v1.11.0

func (t *HTTPTransport) Call(ctx context.Context, route handler.Route, request interface{}, response interface{}) error

func (*HTTPTransport) Close added in v1.11.0

func (t *HTTPTransport) Close()

type HTTPTransportOption added in v1.11.0

type HTTPTransportOption func(*HTTPTransport)

func HTTPTransportWithHTTPClient added in v1.11.0

func HTTPTransportWithHTTPClient(v *http.Client) HTTPTransportOption

type SocketTransport added in v1.11.0

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

func NewSocketTransport

func NewSocketTransport(url string, connectionPoolSize int, waitTimeout time.Duration) *SocketTransport

func (*SocketTransport) Call added in v1.11.0

func (t *SocketTransport) Call(ctx context.Context, route handler.Route, request interface{}, response interface{}) error

func (*SocketTransport) Close added in v1.11.0

func (t *SocketTransport) Close()

type Transport added in v1.11.0

type Transport interface {
	Call(ctx context.Context, route handler.Route, request interface{}, response interface{}) error
	Close()
}

Jump to

Keyboard shortcuts

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