api

package
v0.0.0-...-f880ecd Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// File-related errors
	ErrKeyFileUploadFailed     = "ErrFileUploadFailed"
	ErrKeyFileDownloadFailed   = "ErrFileDownloadFailed"
	ErrKeyMetadataFetchFailed  = "ErrMetadataFetchFailed"
	ErrKeyInvalidFileFormat    = "ErrInvalidFileFormat"
	ErrKeyUnsupportedFileType  = "ErrUnsupportedFileType"
	ErrKeyFileProcessingFailed = "ErrFileProcessingFailed"

	// Storage and data handling errors
	ErrKeyStorageOperationFailed = "ErrStorageOperationFailed"
	ErrKeyResourceNotFound       = "ErrResourceNotFound"
	ErrKeyResourceLimitExceeded  = "ErrResourceLimitExceeded"
	ErrKeyDataIntegrityError     = "ErrDataIntegrityError"

	// User and permission errors
	ErrKeyPermissionDenied     = "ErrPermissionDenied"
	ErrKeyInvalidOperation     = "ErrInvalidOperation"
	ErrKeyAuthenticationFailed = "ErrAuthenticationFailed"
	ErrKeyAuthorizationFailed  = "ErrAuthorizationFailed"

	// Network and communication errors
	ErrKeyNetworkError       = "ErrNetworkError"
	ErrKeyServiceUnavailable = "ErrServiceUnavailable"

	// General errors
	ErrKeyInternalError      = "ErrInternalError"
	ErrKeyConfigurationError = "ErrConfigurationError"
	ErrKeyOperationTimeout   = "ErrOperationTimeout"
)

S5-specific error keys

Variables

This section is empty.

Functions

func ResolveDirCid

func ResolveDirCid(dir *metadata.DirectoryReference, node *node.Node) (*encoding.CID, error)

Types

type AccountInfoResponse

type AccountInfoResponse struct {
	Email          string      `json:"email"`
	QuotaExceeded  bool        `json:"quotaExceeded"`
	EmailConfirmed bool        `json:"emailConfirmed"`
	IsRestricted   bool        `json:"isRestricted"`
	Tier           AccountTier `json:"tier"`
}

type AccountLoginChallengeResponse

type AccountLoginChallengeResponse struct {
	Challenge string `json:"challenge"`
}

type AccountLoginRequest

type AccountLoginRequest struct {
	Pubkey    string `json:"pubkey"`
	Response  string `json:"response"`
	Signature string `json:"signature"`
}

type AccountPin

type AccountPin struct {
	Hash     string    `json:"hash"`
	Size     uint64    `json:"size"`
	PinnedAt time.Time `json:"pinned_at"`
	MimeType string    `json:"mime_type"`
}

type AccountPinBinaryResponse

type AccountPinBinaryResponse struct {
	Pins   []models.Pin
	Cursor uint64
}

func (AccountPinBinaryResponse) EncodeMsgpack

func (a AccountPinBinaryResponse) EncodeMsgpack(enc *msgpack.Encoder) error

type AccountPinResponse

type AccountPinResponse struct {
	Pins []AccountPin `json:"pins"`
}

type AccountPinStatusResponse

type AccountPinStatusResponse struct {
	Status   models.ImportStatus `json:"status"`
	Progress float64             `json:"progress"`
}

type AccountRegisterChallengeResponse

type AccountRegisterChallengeResponse struct {
	Challenge string `json:"challenge"`
}

type AccountRegisterRequest

type AccountRegisterRequest struct {
	Pubkey    string `json:"pubkey"`
	Response  string `json:"response"`
	Signature string `json:"signature"`
	Email     string `json:"email,omitempty"`
}

type AccountStats

type AccountStats struct {
	Total AccountStatsTotal `json:"total"`
}

type AccountStatsResponse

type AccountStatsResponse struct {
	AccountInfoResponse
	Stats AccountStats `json:"stats"`
}

type AccountStatsTotal

type AccountStatsTotal struct {
	UsedStorage uint64 `json:"usedStorage"`
}

type AccountTier

type AccountTier struct {
	Id              uint64        `json:"id"`
	Name            string        `json:"name"`
	UploadBandwidth uint64        `json:"uploadBandwidth"`
	StorageLimit    uint64        `json:"storageLimit"`
	Scopes          []interface{} `json:"scopes"`
}

type AppUploadResponse

type AppUploadResponse struct {
	CID string `json:"cid"`
}

type DebugStorageLocation

type DebugStorageLocation struct {
	Type   int      `json:"type"`
	Parts  []string `json:"parts"`
	Expiry int64    `json:"expiry"`
	NodeId string   `json:"nodeId"`
	Score  float64  `json:"score"`
}

type DebugStorageLocationsResponse

type DebugStorageLocationsResponse struct {
	Locations []DebugStorageLocation `json:"locations"`
}

type FileParams

type FileParams struct {
	Context    core.Context
	ReqContext context.Context
	Hash       []byte
	Type       types.CIDType
	Protocol   *s5.S5Protocol
	Tus        *s5.TusHandler
	Name       string
	Root       []byte
	RootType   types.CIDType
}

type RegistryQueryResponse

type RegistryQueryResponse struct {
	Pk        string `json:"pk"`
	Revision  uint64 `json:"revision"`
	Data      string `json:"data"`
	Signature string `json:"signature"`
}

type RegistrySetRequest

type RegistrySetRequest struct {
	Pk        string `json:"pk"`
	Revision  uint64 `json:"revision"`
	Data      string `json:"data"`
	Signature string `json:"signature"`
}

type S5API

type S5API struct {
	// contains filtered or unexported fields
}

func NewS5API

func NewS5API(ctx core.Context) *S5API

func (*S5API) AuthTokenName

func (s *S5API) AuthTokenName() string

func (*S5API) Can

func (s *S5API) Can(_ http.ResponseWriter, r *http.Request) bool

func (*S5API) Configure

func (s *S5API) Configure(router *mux.Router) error

func (*S5API) Domain

func (s *S5API) Domain() string

func (*S5API) Handle

func (s *S5API) Handle(w http.ResponseWriter, r *http.Request)

func (*S5API) Init

func (s *S5API) Init(_ *core.Context) error

func (S5API) Subdomain

func (s S5API) Subdomain() string

type S5Error

type S5Error struct {
	Key     string
	Message string
	Err     error
}

S5Error struct for representing S5-specific errors

func NewS5Error

func NewS5Error(key string, err error, customMessage ...string) *S5Error

func (*S5Error) Error

func (e *S5Error) Error() string

Error method to implement the error interface

func (*S5Error) HttpStatus

func (e *S5Error) HttpStatus() int

type S5File

type S5File struct {
	// contains filtered or unexported fields
}

func NewFile

func NewFile(params FileParams) *S5File

func (*S5File) CID

func (f *S5File) CID() *encoding.CID

func (*S5File) Close

func (f *S5File) Close() error

func (*S5File) Exists

func (f *S5File) Exists() bool

func (*S5File) Hash

func (f *S5File) Hash() []byte

func (*S5File) HashString

func (f *S5File) HashString() string

func (*S5File) Info

func (f *S5File) Info() (fs.FileInfo, error)

func (*S5File) IsDir

func (f *S5File) IsDir() bool

func (*S5File) Manifest

func (f *S5File) Manifest() (s5libmetadata.Metadata, error)

func (*S5File) Mime

func (f *S5File) Mime() string

func (*S5File) Modtime

func (f *S5File) Modtime() time.Time

func (*S5File) Name

func (f *S5File) Name() string

func (*S5File) Proof

func (f *S5File) Proof() ([]byte, error)

func (*S5File) Read

func (f *S5File) Read(p []byte) (n int, err error)

func (*S5File) ReadDir

func (f *S5File) ReadDir(n int) ([]fs.DirEntry, error)

func (*S5File) Record

func (f *S5File) Record() (*core.UploadMetadata, error)

func (*S5File) RootCID

func (f *S5File) RootCID() *encoding.CID

func (*S5File) Seek

func (f *S5File) Seek(offset int64, whence int) (int64, error)

func (*S5File) Size

func (f *S5File) Size() uint64

func (*S5File) Stat

func (f *S5File) Stat() (fs.FileInfo, error)

func (*S5File) StorageProtocol

func (f *S5File) StorageProtocol() core.StorageProtocol

func (*S5File) Type

func (f *S5File) Type() fs.FileMode

type S5FileInfo

type S5FileInfo struct {
	// contains filtered or unexported fields
}

func (S5FileInfo) IsDir

func (s S5FileInfo) IsDir() bool

func (S5FileInfo) ModTime

func (s S5FileInfo) ModTime() time.Time

func (S5FileInfo) Mode

func (s S5FileInfo) Mode() fs.FileMode

func (S5FileInfo) Name

func (s S5FileInfo) Name() string

func (S5FileInfo) Size

func (s S5FileInfo) Size() int64

func (S5FileInfo) Sys

func (s S5FileInfo) Sys() any

type SmallUploadResponse

type SmallUploadResponse struct {
	CID string `json:"cid"`
}

Jump to

Keyboard shortcuts

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