ipfsapi

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

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 is a client for the IPFS HTTP API.

func NewClient

func NewClient(options ...ClientOption) *Client

NewClient returns a new Client created with the given options.

func (*Client) ID

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

func (*Client) PinAdd

func (c *Client) PinAdd(ctx context.Context, cids ...string) (PinAdd, error)

func (*Client) PinLs

func (c *Client) PinLs(ctx context.Context, pintype PinType, cids ...string) ([]PinLs, error)

PinLs gets information about pins from the node.

func (*Client) PinRm

func (c *Client) PinRm(ctx context.Context, cids ...string) ([]string, error)

func (*Client) PinUpdate

func (c *Client) PinUpdate(ctx context.Context, oldCID, newCID string, unpin bool) ([]string, error)

func (*Client) SwarmConnect

func (c *Client) SwarmConnect(ctx context.Context, addr string) error

type ClientOption

type ClientOption func(*Client)

func WithBaseURL

func WithBaseURL(base string) ClientOption

WithBaseURL sets the base URL for accessing the API. The default is "http://localhost:5001".

func WithHTTPClient

func WithHTTPClient(client *http.Client) ClientOption

WithHTTPClient uses the given http.Client instead of http.DefaultClient.

type ID

type ID struct {
	Addresses       []string
	AgentVersion    string
	ID              string
	ProtocolVersion string
	Protocols       []string
	PublicKey       string
}

type PinAdd

type PinAdd struct {
	Pins     []string
	Progress int
}

type PinLs

type PinLs struct {
	CID  string
	Type PinType
}

type PinType

type PinType string
const (
	Direct    PinType = "direct"
	Indirect  PinType = "indirect"
	Recursive PinType = "recursive"
	All       PinType = "all"
)

Jump to

Keyboard shortcuts

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