api

package
v0.0.0-...-1695a3e Latest Latest
Warning

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

Go to latest
Published: May 12, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    APIErrorCode `json:"code"`
	Message string       `json:"message"`
}

func NewAPIError

func NewAPIError(code APIErrorCode) *APIError

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) JSON

func (e *APIError) JSON() []byte

func (*APIError) WithMessage

func (e *APIError) WithMessage(msg string) *APIError

type APIErrorCode

type APIErrorCode string
const (
	APIErrorNotFound         APIErrorCode = "RESOURCE_NOT_FOUND"
	APIErrorUnauthenticated  APIErrorCode = "UNAUTHENTICATED"
	APIErrorUntrustedService APIErrorCode = "UNTRUSTED_SERVICE"
	APIErrorUnimplemented    APIErrorCode = "FUNCTION_NOT_IMPLEMENTED"
	APIErrorInvalidParameter APIErrorCode = "INVALID_PARAMETER"
	APIErrorProviderError    APIErrorCode = "PROVIDER_ERROR"
)

type HAL_Embedded

type HAL_Embedded struct {
	HAL_Shares []*HAL_SingleShareResponse `json:"shares"`
}
type HAL_Links struct {
	Self *HAL_Ref `json:"self"`
	Next *HAL_Ref `json:"next,omitempty"`
}

HAL mambo-jambo for the format of the responses.

type HAL_MultipleShareResponse

type HAL_MultipleShareResponse struct {
	Embbeded *HAL_Embedded `json:"_embbeded"`
	Links    *HAL_Links    `json:"_links"`
}

func (HAL_MultipleShareResponse) JSON

func (msr HAL_MultipleShareResponse) JSON() []byte

type HAL_Ref

type HAL_Ref struct {
	Href string `json:"href"`
}

type HAL_SingleShareResponse

type HAL_SingleShareResponse struct {
	*Share
	*HAL_Links `json:"_links"`
}

func (HAL_SingleShareResponse) JSON

func (ssr HAL_SingleShareResponse) JSON() []byte

type Info

type Info struct {
	Enabled       bool            `json:"enabled"`
	APIVersion    string          `json:"apiVersion"`
	EndPoint      string          `json:"endPoint"`
	ResourceTypes []ResourceTypes `json:"resourceTypes"`
}

func (*Info) JSON

func (s *Info) JSON() []byte

type MySQLOptions

type MySQLOptions struct {
	Hostname string
	Port     int
	Username string
	Password string
	DB       string
	Table    string

	Logger *zap.Logger
}

type ProtocolInfo

type ProtocolInfo struct {
	Name    string           `json:"name"`
	Options *ProtocolOptions `json:"options"`
}

type ProtocolOptions

type ProtocolOptions struct {
	SharedSecret string `json:"sharedSecret,omitempty"`
	Permissions  string `json:"permissions,omitempty"`
}

type ProviderAuthorizer

type ProviderAuthorizer interface {
	IsProviderAllowed(ctx context.Context, domain string) error
	GetProviderInfoByDomain(ctx context.Context, domain string) (*ProviderInfo, error)
	AddProvider(ctx context.Context, p *ProviderInfo) error
}

type ProviderInfo

type ProviderInfo struct {
	Domain         string
	APIVersion     string
	APIEndPoint    string
	WebdavEndPoint string
}

type ResourceTypes

type ResourceTypes struct {
	Name       string                 `json:"name"`
	ShareTypes []string               `json:"shareTypes"`
	Protocols  ResourceTypesProtocols `json:"protocols"`
}

type ResourceTypesProtocols

type ResourceTypesProtocols struct {
	Webdav string `json:"webdav"`
}

type Share

type Share struct {
	ShareWith         string        `json:"shareWith"`
	Name              string        `json:"name"`
	Description       string        `json:"description"`
	ProviderID        string        `json:"providerId"`
	Owner             string        `json:"owner"`
	Sender            string        `json:"sender"`
	OwnerDisplayName  string        `json:"ownerDisplayName"`
	SenderDisplayName string        `json:"senderDisplayName"`
	ShareType         string        `json:"shareType"`
	ResourceType      string        `json:"resourceType"`
	Protocol          *ProtocolInfo `json:"protocol"`

	ID        string `json:"id,omitempty"`
	CreatedAt string `json:"createdAt,omitempty"`
}

func (*Share) JSON

func (s *Share) JSON() []byte

type ShareManager

type ShareManager interface {
	GetInternalShare(ctx context.Context, id string) (*Share, error)
	NewShare(ctx context.Context, share *Share, domain, shareWith string) (*Share, error)
	GetShares(ctx context.Context, user string) ([]*Share, error)
	GetExternalShare(ctx context.Context, sharedWith, id string) (*Share, error)
}

type TokenManager

type TokenManager interface {
	IsValid(ctx context.Context, u *url.URL, token string) error
}

type UserManager

type UserManager interface {
	UserExists(ctx context.Context, username string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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