service

package
v0.0.0-...-5a07a87 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppInfoTypeIpa     = AppInfoType(0)
	AppInfoTypeApk     = AppInfoType(1)
	AppInfoTypeUnknown = AppInfoType(-1)
)

Variables

View Source
var (
	ErrIdInvalid = errors.New("id invalid")
)
View Source
var (
	ErrIdNotFound = errors.New("id not found")
)

Functions

func DecodeAddRequest

func DecodeAddRequest(_ context.Context, r *http.Request) (interface{}, error)

func DecodeDeleteRequest

func DecodeDeleteRequest(_ context.Context, r *http.Request) (interface{}, error)

func DecodeFindRequest

func DecodeFindRequest(_ context.Context, r *http.Request) (interface{}, error)

func DecodeListRequest

func DecodeListRequest(_ context.Context, r *http.Request) (interface{}, error)

func DecodePlistRequest

func DecodePlistRequest(_ context.Context, r *http.Request) (interface{}, error)

func EncodeJsonResponse

func EncodeJsonResponse(_ context.Context, w http.ResponseWriter, response interface{}) error

func EncodePlistResponse

func EncodePlistResponse(_ context.Context, w http.ResponseWriter, response interface{}) error

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger, name string, debug bool) endpoint.Middleware

func MakeAddEndpoint

func MakeAddEndpoint(srv Service) endpoint.Endpoint

func MakeDeleteEndpoint

func MakeDeleteEndpoint(srv Service, enabledDelete bool) endpoint.Endpoint

func MakeFindEndpoint

func MakeFindEndpoint(srv Service) endpoint.Endpoint

func MakeListEndpoint

func MakeListEndpoint(srv Service) endpoint.Endpoint

func MakePlistEndpoint

func MakePlistEndpoint(srv Service) endpoint.Endpoint

func NewInstallPlist

func NewInstallPlist(app *Item) ([]byte, error)

Types

type AppInfo

type AppInfo struct {
	ID         string      `json:"id"`
	Name       string      `json:"name"`
	Version    string      `json:"version"`
	Identifier string      `json:"identifier"`
	Build      string      `json:"build"`
	Channel    string      `json:"channel"`
	Date       time.Time   `json:"date"`
	Size       int64       `json:"size"`
	NoneIcon   bool        `json:"noneIcon"`
	Type       AppInfoType `json:"type"`
}

func NewAppInfo

func NewAppInfo(i Package, t AppInfoType) *AppInfo

func (*AppInfo) IconStorageName

func (a *AppInfo) IconStorageName() string

func (*AppInfo) PackageStorageName

func (a *AppInfo) PackageStorageName() string

type AppInfoType

type AppInfoType int

func FileType

func FileType(n string) AppInfoType

func (AppInfoType) StorageName

func (t AppInfoType) StorageName() string

type AppList

type AppList []*AppInfo

func (AppList) Len

func (a AppList) Len() int

func (AppList) Less

func (a AppList) Less(i, j int) bool

func (AppList) Swap

func (a AppList) Swap(i, j int)

type Item

type Item struct {
	// from AppInfo
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	Date       time.Time `json:"date"`
	Size       int64     `json:"size"`
	Channel    string    `json:"channel"`
	Build      string    `json:"build"`
	Version    string    `json:"version"`
	Identifier string    `json:"identifier"`

	// package download link
	Pkg string `json:"pkg"`
	// Icon to display on iOS desktop
	Icon string `json:"icon"`
	// Plist to install ipa
	Plist string `json:"plist,omitempty"`
	// WebIcon to display on web
	WebIcon string `json:"webIcon"`
	// Type 0:ios 1:android
	Type AppInfoType `json:"type"`

	Current bool    `json:"current"`
	History []*Item `json:"history,omitempty"`
}

Item to use on web interface

func (*Item) String

func (i *Item) String() string

type Package

type Package interface {
	Name() string
	Version() string
	Identifier() string
	Build() string
	Channel() string
	Icon() image.Image
	Size() int64
}

type Reader

type Reader interface {
	io.Reader
	io.ReaderAt
	Size() int64
}

type Service

type Service interface {
	List(publicURL string) ([]*Item, error)
	Find(id string, publicURL string) (*Item, error)
	History(id string, publicURL string) ([]*Item, error)
	Delete(id string) error
	Add(r Reader, t AppInfoType) error
	Plist(id, publicURL string) ([]byte, error)
}

func New

func New(store storager.Storager, publicURL, metadataName string) Service

type ServiceMiddleware

type ServiceMiddleware func(Service) Service

Jump to

Keyboard shortcuts

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