api

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) (p *bool)

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func IsHTTPStatusErrorCode added in v0.8.3

func IsHTTPStatusErrorCode(err error, code int) bool

IsHTTPStatusErrorCode return whether the error is HTTPStatusError with a specific HTTP status code.

Types

type BytesService added in v0.2.10

type BytesService service

BytesService represents Bee's Bytes service

func (*BytesService) Download added in v0.2.10

func (b *BytesService) Download(ctx context.Context, a swarm.Address) (resp io.ReadCloser, err error)

Download downloads data from the node

func (*BytesService) Upload added in v0.2.10

Upload uploads bytes to the node

type BytesUploadResponse added in v0.2.10

type BytesUploadResponse struct {
	Reference swarm.Address `json:"reference"`
}

BytesUploadResponse represents Upload's response

type ChunksService added in v0.2.10

type ChunksService service

ChunksService represents Bee's Chunks service

func (*ChunksService) Download added in v0.2.10

func (c *ChunksService) Download(ctx context.Context, a swarm.Address, targets string) (resp io.ReadCloser, err error)

Download downloads data from the node

func (*ChunksService) Upload added in v0.2.10

Upload uploads chunks to the node

type ChunksUploadResponse added in v0.2.10

type ChunksUploadResponse struct {
	Reference swarm.Address `json:"reference"`
}

ChunksUploadResponse represents Upload's response

type Client

type Client struct {

	// Services that API provides.
	Bytes       *BytesService
	Chunks      *ChunksService
	Files       *FilesService
	Dirs        *DirsService
	Pinning     *PinningService
	Tags        *TagsService
	PSS         *PSSService
	SOC         *SOCService
	Stewardship *StewardshipService
	// contains filtered or unexported fields
}

Client manages communication with the Bee API.

func NewClient

func NewClient(baseURL *url.URL, o *ClientOptions) (c *Client)

NewClient constructs a new Client.

type ClientOptions

type ClientOptions struct {
	HTTPClient *http.Client
}

ClientOptions holds optional parameters for the Client.

type DirsService added in v0.2.18

type DirsService service

DirsService represents Bee's Dirs service

func (*DirsService) Download added in v0.2.18

func (s *DirsService) Download(ctx context.Context, a swarm.Address, path string) (resp io.ReadCloser, err error)

Download downloads data from the node

func (*DirsService) Upload added in v0.2.18

func (s *DirsService) Upload(ctx context.Context, data io.Reader, size int64, o UploadOptions) (resp DirsUploadResponse, err error)

Upload uploads TAR collection to the node

type DirsUploadResponse added in v0.2.18

type DirsUploadResponse struct {
	Reference swarm.Address `json:"reference"`
}

DirsUploadResponse represents Upload's response

type FilesService added in v0.2.11

type FilesService service

FilesService represents Bee's Files service

func (*FilesService) Download added in v0.2.11

func (f *FilesService) Download(ctx context.Context, a swarm.Address) (resp io.ReadCloser, err error)

Download downloads data from the node

func (*FilesService) Upload added in v0.2.11

func (f *FilesService) Upload(ctx context.Context, name string, data io.Reader, size int64, o UploadOptions) (resp FilesUploadResponse, err error)

Upload uploads files to the node

type FilesUploadResponse added in v0.2.11

type FilesUploadResponse struct {
	Reference swarm.Address `json:"reference"`
}

FilesUploadResponse represents Upload's response

type HTTPStatusError added in v0.8.3

type HTTPStatusError struct {
	Code int
}

HTTPStatusError represents the error derived from the HTTP response status code.

func NewHTTPStatusError added in v0.8.3

func NewHTTPStatusError(code int) *HTTPStatusError

NewHTTPStatusError creates a new instance of HTTPStatusError based on the provided code.

func (*HTTPStatusError) Error added in v0.8.3

func (e *HTTPStatusError) Error() string

type PSSService added in v0.5.0

type PSSService service

PSSService represents Bee's PSS service

func (*PSSService) SendMessage added in v0.5.0

func (p *PSSService) SendMessage(ctx context.Context, nodeAddress swarm.Address, nodePublicKey string, topic string, prefix int, data io.Reader, batchID string) error

Sends a PSS message to a recipienct with a specific topic

type PinningService added in v0.2.19

type PinningService service

PinningService represents Bee's Pin service

func (*PinningService) GetPinnedRootHash added in v0.6.6

func (ps *PinningService) GetPinnedRootHash(ctx context.Context, ref swarm.Address) (swarm.Address, error)

GetPinnedRootHash determines if the root hash of given reference is pinned by returning its reference.

func (*PinningService) GetPins added in v0.6.6

func (ps *PinningService) GetPins(ctx context.Context) ([]swarm.Address, error)

GetPins returns all references of pinned root hashes.

func (*PinningService) PinRootHash added in v0.6.6

func (ps *PinningService) PinRootHash(ctx context.Context, ref swarm.Address) error

PinRootHash pins root hash of given reference.

func (*PinningService) UnpinRootHash added in v0.6.6

func (ps *PinningService) UnpinRootHash(ctx context.Context, ref swarm.Address) error

UnpinRootHash unpins root hash of given reference.

type SOCService added in v0.5.0

type SOCService service

PSSService represents Bee's PSS service

func (*SOCService) UploadSOC added in v0.5.0

func (p *SOCService) UploadSOC(ctx context.Context, owner, ID, signature string, data io.Reader, batchID string) (*SocResponse, error)

Sends a PSS message to a recipienct with a specific topic

type SocResponse added in v0.5.5

type SocResponse struct {
	Reference swarm.Address
}

type StewardshipService added in v0.8.3

type StewardshipService service

StewardshipService represents Bee's Stewardship service.

func (*StewardshipService) IsRetrievable added in v0.8.3

func (ss *StewardshipService) IsRetrievable(ctx context.Context, ref swarm.Address) (bool, error)

IsRetrievable checks whether the content on the given address is retrievable.

func (*StewardshipService) Reupload added in v0.8.3

func (ss *StewardshipService) Reupload(ctx context.Context, ref swarm.Address) error

Reupload re-uploads root hash and all of its underlying associated chunks to the network.

type TagResponse added in v0.3.7

type TagResponse struct {
	Total     int64         `json:"total"`
	Split     int64         `json:"split"`
	Seen      int64         `json:"seen"`
	Stored    int64         `json:"stored"`
	Sent      int64         `json:"sent"`
	Synced    int64         `json:"synced"`
	Uid       uint32        `json:"uid"`
	Name      string        `json:"name"`
	Address   swarm.Address `json:"address"`
	StartedAt time.Time     `json:"startedAt"`
}

type TagsService added in v0.3.7

type TagsService service

TagsService represents Bee's Tag service

func (*TagsService) CreateTag added in v0.3.7

func (p *TagsService) CreateTag(ctx context.Context) (resp TagResponse, err error)

CreateTag creates new tag

func (*TagsService) GetTag added in v0.3.7

func (p *TagsService) GetTag(ctx context.Context, tagUID uint32) (resp TagResponse, err error)

GetTag gets a new tag

func (*TagsService) WaitSync added in v0.5.6

func (p *TagsService) WaitSync(ctx context.Context, tagUID uint32) (err error)

type UploadOptions added in v0.3.5

type UploadOptions struct {
	Pin     bool
	Tag     uint32
	BatchID string
}

Jump to

Keyboard shortcuts

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