client

package
v0.0.0-...-df3f4e6 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Overview

Package client provides tools to interact with a varda server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides access to a Varda server. After use, a Client should be closed via its Close method.

func New

func New(cfg config.Client, opts ...Option) (*Client, error)

New creates a new client with the provided client configuration.

func (*Client) Close

func (c *Client) Close() error

func (*Client) Do

func (c *Client) Do(r *http.Request) (*http.Response, error)

func (*Client) Endpoint

func (c *Client) Endpoint(name string) string

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context, v varda.Ref) (io.ReadCloser, error)

func (*Client) FindRef

func (c *Client) FindRef(ctx context.Context, sha string) (varda.Ref, error)

func (*Client) IterRef

func (c *Client) IterRef(ctx context.Context, f func(v varda.Ref) error) error

func (*Client) Login

func (c *Client) Login(ctx context.Context) error

func (*Client) NumRef

func (c *Client) NumRef(ctx context.Context) (int64, error)

func (*Client) Query

func (c *Client) Query(ctx context.Context, qry search.Query) (*search.Result, error)

func (*Client) Search

func (c *Client) Search(ctx context.Context, qry search.Query, f func(ref varda.Ref) error) error

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, f varda.File) (varda.Ref, error)

func (*Client) UploadRefs

func (c *Client) UploadRefs(ctx context.Context, vs []varda.File) ([]varda.Ref, error)

type Option

type Option func(c *Client)

Option provides configuration of a varda client.

func WithAuth

func WithAuth(a auth.Mode) Option

WithAuth configures a varda client to use the provided authentication mechanism.

func WithHTTP

func WithHTTP(cli *http.Client) Option

WithHTTP configures a varda client to use the provided HTTP client.

type UploadError

type UploadError struct {
	File varda.File
	Err  error
}

UploadError describes which varda resources failed to upload.

func (UploadError) Error

func (ue UploadError) Error() string

func (UploadError) Unwrap

func (ue UploadError) Unwrap() error

Jump to

Keyboard shortcuts

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