pinata

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultEndpoint = "https://api.pinata.cloud"

DefaultEndpoint is the default base URL for the Pinata API. It can be overridden with the WithEndpoint option.

View Source
const DefaultPSAEndpoint = "https://api.pinata.cloud/psa"

DefaultPSAEndpoint is the default base URL for the Pinata Pinning Service API. It can be overridden with the WithPSAEndpoint option.

View Source
const MaxFileSize = 1024 * 1024 * 1024 * 25

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(opts ...NewOpt) (*Client, error)

New creates a new Client with the given options. The only mandatory option is WithToken; the others have sensible defaults.

func (*Client) Equal

func (cl *Client) Equal(other *Client) bool

func (*Client) IsPresent

func (cl *Client) IsPresent(ctx context.Context, c cid.Cid) (bool, error)

func (*Client) Pin

func (cl *Client) Pin(ctx context.Context, c cid.Cid, k string) error

func (*Client) Unpin

func (cl *Client) Unpin(ctx context.Context, c cid.Cid) error

func (*Client) Upload

func (cl *Client) Upload(ctx context.Context, fi fs.File, pro *progress.Tracker) (cid.Cid, error)

type NewOpt

type NewOpt func(options *config) error

NewOpt is an option for the New() function.

func WithEndpoint

func WithEndpoint(e string) NewOpt

WithEndpoint is an option for the New() function which sets the URL of the pinata.cloud endpoint. By default, DefaultEndpoint is used.

func WithHTTPClient

func WithHTTPClient(c *http.Client) NewOpt

WithHTTPClient is an option for the New() function which sets the http.Client with which to access the endpoint. By default, a new retryablehttp.Client is used.

func WithPSAEndpoint

func WithPSAEndpoint(e string) NewOpt

WithPSAEndpoint is an option for the New() function which sets the URL of the pinata.cloud Pinning Service API endpoint. By default, DefaultPSAEndpoint is used.

func WithToken

func WithToken(tok string) NewOpt

WithToken is an option for the New() function which sets the JSON Web Token to authenticate with the endpoint.

Jump to

Keyboard shortcuts

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