client

package
v0.0.0-...-47e0bda Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package client is a client for the Scrap Exchange REST API.

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 implements api.ScrapExchange using the HTTP REST API talking to a server.

func New

func New(host string) (*Client, error)

New returns a new instance of Client.

The value of the host should be the base scheme, host, and port that all requests should go to, e.g. "http://scrapexchange:9000".

func (*Client) CreateScrap

func (c *Client) CreateScrap(ctx context.Context, body scrap.ScrapBody) (scrap.ScrapID, error)

CreateScrap implements scrap.ScrapExchange.

func (*Client) DeleteName

func (c *Client) DeleteName(ctx context.Context, t scrap.Type, name string) error

DeleteName implements scrap.ScrapExchange.

func (*Client) DeleteScrap

func (c *Client) DeleteScrap(ctx context.Context, t scrap.Type, hashOrName string) error

DeleteScrap implements scrap.ScrapExchange.

func (*Client) Expand

func (c *Client) Expand(ctx context.Context, t scrap.Type, hashOrName string, lang scrap.Lang, w io.Writer) error

Expand implements scrap.ScrapExchange.

func (*Client) GetName

func (c *Client) GetName(ctx context.Context, t scrap.Type, name string) (scrap.Name, error)

GetName implements scrap.ScrapExchange.

func (*Client) ListNames

func (c *Client) ListNames(ctx context.Context, t scrap.Type) ([]string, error)

ListNames implements scrap.ScrapExchange.

func (*Client) LoadScrap

func (c *Client) LoadScrap(ctx context.Context, t scrap.Type, hashOrName string) (scrap.ScrapBody, error)

LoadScrap implements scrap.ScrapExchange.

func (*Client) PutName

func (c *Client) PutName(ctx context.Context, t scrap.Type, name string, nameBody scrap.Name) error

PutName implements scrap.ScrapExchange.

Jump to

Keyboard shortcuts

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