Documentation ¶
Overview ¶
Package w3s provides a client to interact with the web3.storage API in the context of Git Annex remotes.
For a general purpose client see https://github.com/web3-storage/go-w3s-client
Index ¶
- Constants
- type Client
- func (cl *Client) Equal(other *Client) bool
- func (cl *Client) IsPresent(ctx context.Context, c cid.Cid) (bool, error)
- func (cl *Client) Pin(ctx context.Context, c cid.Cid, key string) error
- func (cl *Client) PutCar(ctx context.Context, car *os.File, pro *progress.Tracker) (cid.Cid, error)
- func (cl *Client) Unpin(ctx context.Context, c cid.Cid) error
- func (cl *Client) Upload(ctx context.Context, rdr fs.File, pro *progress.Tracker) (cid.Cid, error)
- type NewOpt
Constants ¶
const DefaultEndpoint = "https://api.web3.storage"
DefaultEndpoint is the default base URL for the web3.storage API. To use a different endpoint see the WithEndpoint function.
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 web3.storage API for use by Git Annex remotes.
func New ¶
New creates a new Client with the given options. The only mandatory option is WithToken; the others have sensible defaults.
type NewOpt ¶
type NewOpt func(options *config) error
NewOpt is an option for the New() function.
func WithCanPin ¶
WithCanPin is an option for the New() function which specifies whether the client is authorised to access the web3.storage PSA API; by default, this is false.
func WithEndpoint ¶
WithEndpoint is an option for the New() function which sets the URL of the web3.storage endpoint. By default, DefaultEndpoint is used.
func WithHTTPClient ¶
WithHTTPClient is an option for the New() function which sets the http.Client with which to access the endpoint. By default, http.DefaultClient is used.
func WithTempDir ¶
WithTempDir is an option for the New() function which specifies the temporary directory Upload() will use. By default, os.TempDir() is used.