Golang SDK
import "github.com/photon-storage/gw3-sdk-go"
Index
- Constants
- type Client
- func NewClient(accessKey, accessSecret string) (*Client, error)
- func (c *Client) AuthDAGAdd(root, filePath string, size int) (string, error)
- func (c *Client) AuthDAGImport(size int, boundary string) (string, error)
- func (c *Client) AuthDAGRemove(root, filePath string) (string, error)
- func (c *Client) AuthPost(size int) (string, error)
- func (c *Client) CreateIPNS(value string) (string, error)
- func (c *Client) DAGAdd(root, path string, data []byte) (string, error)
- func (c *Client) DAGImport(src any) (string, error)
- func (c *Client) DAGRemove(root, path string) (string, error)
- func (c *Client) Get(cid string) ([]byte, error)
- func (c *Client) GetIPNS(name string) ([]byte, error)
- func (c *Client) Pin(cid string) error
- func (c *Client) Post(data []byte) (string, error)
- func (c *Client) Unpin(cid string) error
- func (c *Client) UpdateIPNS(name, value string) error
Constants
const (
EmptyDAGRoot = "QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"
)
type Client
Client represents a Gateway3 client for interacting with the Gateway3.
type Client struct {
// contains filtered or unexported fields
}
func NewClient
func NewClient(accessKey, accessSecret string) (*Client, error)
NewClient creates a new Gateway3 client with the provided access key and access secret.
func (*Client) AuthDAGAdd
func (c *Client) AuthDAGAdd(root, filePath string, size int) (string, error)
AuthDAGAdd requests Gateway3 for an authorized redirect URL for subsequently adding a new CID and path to the existing dag.
func (*Client) AuthDAGImport
func (c *Client) AuthDAGImport(size int, boundary string) (string, error)
AuthDAGImport requests Gateway3 for an authorized redirect URL for uploading a CAR file.
func (*Client) AuthDAGRemove
func (c *Client) AuthDAGRemove(root, filePath string) (string, error)
AuthDAGRemove requests Gateway3 for an authorized redirect URL for subsequently removing a path from the existing dag, generating a new dag root.
func (*Client) AuthPost
func (c *Client) AuthPost(size int) (string, error)
AuthPost gets the authorized URL from the Gateway3.
func (*Client) CreateIPNS
func (c *Client) CreateIPNS(value string) (string, error)
CreateIPNS creates a new IPNS record and binds it to the given CID. This function should only be used for creating a new record. To update an existing IPNS record, use the UpdateIPNS interface.
func (*Client) DAGAdd
func (c *Client) DAGAdd(root, path string, data []byte) (string, error)
DAGAdd adds a new CID and path to the existing dag, generating a new dag root.
func (*Client) DAGImport
func (c *Client) DAGImport(src any) (string, error)
DAGImport imports the given src input as a CAR format and returns its root CID. The `src` can be a path to a directory, a byte array or a io.Reader.
func (*Client) DAGRemove
func (c *Client) DAGRemove(root, path string) (string, error)
DAGRemove removes a path from the existing dag, generating a new dag root.
func (*Client) Get
func (c *Client) Get(cid string) ([]byte, error)
Get retrieves data from the Gateway3 for the given CID.
func (*Client) GetIPNS
func (c *Client) GetIPNS(name string) ([]byte, error)
GetIPNS retrieves data from the IPFS network using the given IPNS.
func (*Client) Pin
func (c *Client) Pin(cid string) error
Pin requests Gateway3 to pin the given CID.
func (*Client) Post
func (c *Client) Post(data []byte) (string, error)
Post uploads the given data to Gateway3 and returns the corresponding CID.
func (*Client) Unpin
func (c *Client) Unpin(cid string) error
Unpin requests Gateway3 to unpin the given CID.
func (*Client) UpdateIPNS
func (c *Client) UpdateIPNS(name, value string) error
UpdateIPNS updates the value for the IPNS record specified by the given name.
Generated by gomarkdoc