api

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenConsumer   = "CP5tR8Zqd2txobVbWn02+YXZ6YEXDBjl8lq1cYaRHDJLE7rldjGBft5r2imUTAnExkQoSoBWSywCG93feYF5jtDN3kHpxcwKrm0Mz/JJknYZFzcZml8="
	TokenCreator    = "v2ACGxBiGJf3Jyos7MX/vq8nrp8zTVx/mT3wtGPXA/ayNBQdIZLIgd/gNlWoaS5r6AQ22zUAYa4hcbx93bKyUmIaKSJBuOGz/Sz0/dnUAZjkocF0pg=="
	TokenMaintainer = "MZhpzQUMPyNMmbrQMKcTBLzHpLpz3JB1CKuFVuHH+yqzZI6kzdjWI4OOhGw1l5NonvwZMhxTOlCmsmW2Fq/dRLgvn8EiKyOKNDsYcK8es94IwkMwKLcebw=="
	TokenAccountant = "3jpNFZwiVDAFeMEDi5tvSZ8czxgZjZr6AWaRSB0ApVueucGXpLbMVvU38HPxJtTIjEtW6BUtFb8EEkKfsw12coM+JngWNaRm9bWwJsCoG8b69oCklGK2sw=="
)

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 GetToken added in v0.8.6

func GetToken(path, method string) (string, error)

func IsHTTPStatusErrorCode added in v0.8.5

func IsHTTPStatusErrorCode(err error, code int) bool

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

Types

type AuthResponse added in v0.8.6

type AuthResponse struct {
	Key string `json:"key"`
}

AuthResponse represents authentication response

type AuthService added in v0.8.6

type AuthService service

AuthService represents Bee's Auth service

func (*AuthService) Authenticate added in v0.8.6

func (a *AuthService) Authenticate(ctx context.Context, role, password string) (string, error)

Authenticate gets the bearer security token based on given credentials

func (*AuthService) Refresh added in v0.8.6

func (a *AuthService) Refresh(ctx context.Context, securityToken string) (string, error)

type BytesService added in v0.8.5

type BytesService service

BytesService represents Bee's Bytes service

func (*BytesService) Download added in v0.8.5

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.8.5

Upload uploads bytes to the node

type BytesUploadResponse added in v0.8.5

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

BytesUploadResponse represents Upload's response

type ChunksService added in v0.8.5

type ChunksService service

ChunksService represents Bee's Chunks service

func (*ChunksService) Download added in v0.8.5

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.8.5

Upload uploads chunks to the node

type ChunksUploadResponse added in v0.8.5

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
	Auth        *AuthService
	// 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
	Restricted bool
}

ClientOptions holds optional parameters for the Client.

type DirsService added in v0.8.5

type DirsService service

DirsService represents Bee's Dirs service

func (*DirsService) Download added in v0.8.5

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.8.5

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.8.5

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

DirsUploadResponse represents Upload's response

type FilesService added in v0.8.5

type FilesService service

FilesService represents Bee's Files service

func (*FilesService) Download added in v0.8.5

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.8.5

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.8.5

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

FilesUploadResponse represents Upload's response

type HTTPStatusError added in v0.8.5

type HTTPStatusError struct {
	Code int
}

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

func NewHTTPStatusError added in v0.8.5

func NewHTTPStatusError(code int) *HTTPStatusError

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

func (*HTTPStatusError) Error added in v0.8.5

func (e *HTTPStatusError) Error() string

type PSSService added in v0.8.5

type PSSService service

PSSService represents Bee's PSS service

func (*PSSService) SendMessage added in v0.8.5

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.8.5

type PinningService service

PinningService represents Bee's Pin service

func (*PinningService) GetPinnedRootHash added in v0.8.5

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.8.5

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

GetPins returns all references of pinned root hashes.

func (*PinningService) PinRootHash added in v0.8.5

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

PinRootHash pins root hash of given reference.

func (*PinningService) UnpinRootHash added in v0.8.5

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

UnpinRootHash unpins root hash of given reference.

type SOCService added in v0.8.5

type SOCService service

PSSService represents Bee's PSS service

func (*SOCService) UploadSOC added in v0.8.5

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.8.5

type SocResponse struct {
	Reference swarm.Address
}

type StewardshipService added in v0.8.5

type StewardshipService service

StewardshipService represents Bee's Stewardship service.

func (*StewardshipService) IsRetrievable added in v0.8.5

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.5

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.8.5

type TagResponse struct {
	Split     uint64        `json:"split"`
	Seen      uint64        `json:"seen"`
	Stored    uint64        `json:"stored"`
	Sent      uint64        `json:"sent"`
	Synced    uint64        `json:"synced"`
	Uid       uint64        `json:"uid"`
	Address   swarm.Address `json:"address"`
	StartedAt time.Time     `json:"startedAt"`
}

type TagsService added in v0.8.5

type TagsService service

TagsService represents Bee's Tag service

func (*TagsService) CreateTag added in v0.8.5

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

CreateTag creates new tag

func (*TagsService) GetTag added in v0.8.5

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

GetTag gets a new tag

func (*TagsService) WaitSync added in v0.8.5

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

type UploadOptions added in v0.8.5

type UploadOptions struct {
	Pin     bool
	Tag     uint64
	BatchID string
	Direct  bool
}

Jump to

Keyboard shortcuts

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