Documentation ¶
Index ¶
- Variables
- type EncryptionRequest
- type File
- type Handler
- func (h *Handler) DeleteItemByID(user security.User, w http.ResponseWriter, r *http.Request) error
- func (h *Handler) GetHandlers() http.Handler
- func (h *Handler) GetItemByID(user security.User, w http.ResponseWriter, r *http.Request) error
- func (h *Handler) Upload(user security.User, w http.ResponseWriter, r *http.Request) error
- type ItemResponse
- type Result
- type ResultResponse
- type Service
- type ServiceOptions
- type Store
- type Upload
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidParameters tells the caller that incorrect, invalid parameters were supplied ErrInvalidParameters = errors.New("invalid parameters supplied") // ErrValidation tells the caller that the process cannot proceed because of validation errors ErrValidation = errors.New("validation error") // ErrService tells the caller that an application error happened ErrService = errors.New("application error occurred") )
Functions ¶
This section is empty.
Types ¶
type EncryptionRequest ¶
EncryptionRequest contains parammeters used for encryption
type Handler ¶
Handler defines the api logic for the upload-service
func (*Handler) DeleteItemByID ¶
DeleteItemByID removes an upload item specified by it's id
func (*Handler) GetHandlers ¶
GetHandlers returns the upload handler routes
func (*Handler) GetItemByID ¶
GetItemByID returns the uploaded item by it's id
type ItemResponse ¶
type ItemResponse struct {
*Upload
}
ItemResponse returns Result
func (ItemResponse) Render ¶
func (b ItemResponse) Render(w http.ResponseWriter, r *http.Request) error
Render the specific response
type ResultResponse ¶
ResultResponse returns Result
func (ResultResponse) Render ¶
func (b ResultResponse) Render(w http.ResponseWriter, r *http.Request) error
Render the specific response
type Service ¶
type Service interface { Save(file File) (string, error) Read(id string) (Upload, error) Delete(id string) error }
Service contains the main logic of the upload package the Service takes care of saving, reading and deleting uploaded files
func NewService ¶
func NewService(init ServiceOptions) Service
NewService creates a new Service instance
type ServiceOptions ¶
type ServiceOptions struct { Logger logging.Logger Store Store MaxUploadSize int64 AllowedFileTypes []string // the Encryptionservice which is used to optionally encrypt the payload / change password of encrypted payload Crypter crypter.EncryptionService TimeOut string }
ServiceOptions defines parameters used to initialize a new Service
Click to show internal directories.
Click to hide internal directories.