api

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PinHeader            = "Pin"
	EncryptHeader        = "Encrypt"
	IndexDocumentHeader  = "Index-Document"
	ErrorDocumentHeader  = "Error-Document"
	CollectionHeader     = "Collection"
	CollectionNameHeader = "Collection-Name"
	ReferenceLinkHeader  = "Reference-Link"
	// TargetsRecoveryHeader defines the Header for Recovery targets in Global Pinning
	TargetsRecoveryHeader = "recovery-targets"
)
View Source
const (
	StringTrue = "true"
)

Variables

View Source
var (
	ErrNotFound    = errors.New("manifest: not found")
	ErrServerError = errors.New("manifest: ServerError")
)
View Source
var BufferSizeMul int

Functions

func UnescapeUnicode

func UnescapeUnicode(raw string) (string, error)

UnescapeUnicode convert the raw Unicode encoding to character

Types

type AllRequest

type AllRequest struct {
	Id      int           `json:"id"`
	JsonRpc string        `json:"jsonrpc"`
	Method  string        `json:"method"`
	Params  []interface{} `json:"params"`
}

type AllResponse

type AllResponse struct {
	Id      int         `json:"id"`
	JsonRpc string      `json:"jsonrpc"`
	Result  interface{} `json:"result"`
}

type FileInfo

type FileInfo struct {
	Path        string
	Name        string
	ContentType string
	Size        int64
	Reader      io.Reader
}

type ListResponse added in v1.1.2

type ListResponse struct {
	RootCid   boson.Address          `json:"rootCid"`
	PinState  bool                   `json:"pinState"`
	BitVector address.BitVectorApi   `json:"bitVector"`
	Register  bool                   `json:"register"`
	Manifest  *fileinfo.ManifestNode `json:"manifest"`
}

type ManifestAction added in v1.2.1

type ManifestAction struct {
	Target    string              `json:"target"`
	Source    string              `json:"source"`
	Reference string              `json:"ref"`
	Operation filestore.Operation `json:"op"`
}

type Options

type Options struct {
	CORSAllowedOrigins []string
	GatewayMode        bool
	WsPingPeriod       time.Duration
	BufferSizeMul      int
	Restricted         bool
	DebugApiAddr       string
	RPCWSAddr          string
}

type PageResponse added in v1.1.2

type PageResponse struct {
	Total int            `json:"total"`
	List  []ListResponse `json:"list"`
}

type RegisterResponse added in v1.1.2

type RegisterResponse struct {
	Hash common.Hash `json:"hash"`
}

type Service

type Service interface {
	http.Handler
	m.Collector
	io.Closer
}

Service is the API service interface.

func New

func New(storer storage.Storer, resolver resolver.Interface, addr boson.Address, chunkInfo chunkinfo.Interface, fileInfo fileinfo.Interface,
	traversalService traversal.Traverser, pinning pinning.Interface, auth authenticator, logger logging.Logger, kad topology.Driver,
	tracer *tracing.Tracer, traffic traffic.ApiInterface, commonChain chain.Common, oracleChain chain.Resolver, netRelay netrelay.NetRelay,
	multicast multicast.GroupInterface, route routetab.RouteTab, o Options) Service

New will create a and initialize a new API service.

type TransactionResponse

type TransactionResponse struct {
	Hash     common.Hash
	Address  boson.Address
	Register bool
}

type UpgradedResponseWriter

type UpgradedResponseWriter interface {
	http.ResponseWriter
	http.Pusher
	http.Hijacker
	http.Flusher
	http.CloseNotifier
}

UpgradedResponseWriter adds more functionality on top of ResponseWriter

type UploadResponse added in v1.1.2

type UploadResponse struct {
	Reference boson.Address `json:"reference"`
}

UploadResponse is returned when an HTTP request to upload a file or collection is successful

Jump to

Keyboard shortcuts

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