client

package
v0.0.0-...-8444db5 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout        = 30 * time.Second
	DefaultRetryMax       = 3
	DefaultIPFSGatewayURL = "https://ipfs.io"
	DefaultMarketURL      = "http://localhost:3002"
)
View Source
const (
	ErrCodeBadRequest           api.ErrorCode = "bad-request"
	ErrCodeNotFound             api.ErrorCode = "not-found"
	ErrCodeInternalServerError  api.ErrorCode = "internal-server-error"
	ErrCodeAccountAlreadyExists api.ErrorCode = "account-already-exists"
	ErrCodeAppAlreadyExists     api.ErrorCode = "app-already-exists"
	ErrCodeReleaseAlreadyExists api.ErrorCode = "release-already-exists"
	ErrCodeStalledVersion       api.ErrorCode = "stalled-version"
	ErrCodeForbidden            api.ErrorCode = "forbidden"
	ErrCodeRegistrationDisabled api.ErrorCode = "registration-disabled"
)

Variables

View Source
var (
	ErrUnauthorized       = errors.New("unauthorized")
	ErrForbidden          = errors.New("forbidden")
	ErrAppAlreadyExists   = errors.New("app already exists")
	ErrStalledVersion     = errors.New("stalled app version")
	ErrUnknownMarketError = errors.New("unknown market error")
)

Functions

This section is empty.

Types

type AppEntry

type AppEntry struct {
	ID            int
	Name          string
	CreatedAt     JSONTime
	UpdatedAt     JSONTime
	LatestRelease struct {
		ID            int
		CID           string
		CreatedAt     JSONTime
		Version       string
		Description   string
		ArchiveFormat bundle.ArchiveExt
	}
	Owner struct {
		ID        int
		Username  string
		UpdatedAt JSONTime
		CreatedAt JSONTime
	}
}

type Client

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

func New

func New(funcs ...OptionFunc) *Client

func (*Client) CreateApp

func (c *Client) CreateApp(ctx context.Context, username, password, cid string, archiveFormat bundle.ArchiveExt) (*CreateAppResult, error)

func (*Client) DownloadApp

func (c *Client) DownloadApp(ctx context.Context, cid string, archiveFormat bundle.ArchiveExt) (bundle.Bundle, string, error)

func (*Client) GetApp

func (c *Client) GetApp(ctx context.Context, appID int) (*GetAppResult, error)

func (*Client) ReleaseApp

func (c *Client) ReleaseApp(ctx context.Context, username, password string, appID int, cid string, archiveFormat bundle.ArchiveExt) (*ReleaseAppResult, error)

func (*Client) SearchApps

func (c *Client) SearchApps(ctx context.Context, search string) (*SearchAppsResult, error)

type CreateAppResult

type CreateAppResult struct {
	App *AppEntry
}

type GetAppResult

type GetAppResult struct {
	App *AppEntry
}

type JSONTime

type JSONTime struct {
	time.Time
}

func (*JSONTime) UnmarshalJSON

func (t *JSONTime) UnmarshalJSON(b []byte) error

returns time.Now() no matter what!

type Option

type Option struct {
	IPFSGatewayURL string
	MarketURL      string
	Timeout        time.Duration
	RetryMax       int
}

type OptionFunc

type OptionFunc func(*Option)

func WithIPFSGatewayURL

func WithIPFSGatewayURL(ipfsGatewayURL string) OptionFunc

func WithMarketURL

func WithMarketURL(marketURL string) OptionFunc

func WithRetryMax

func WithRetryMax(retryMax int) OptionFunc

func WithTimeout

func WithTimeout(timeout time.Duration) OptionFunc

type ReleaseAppResult

type ReleaseAppResult struct {
	App *AppEntry
}

type SearchAppsResult

type SearchAppsResult struct {
	Apps []*AppEntry
}

Jump to

Keyboard shortcuts

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