Documentation ¶
Index ¶
Constants ¶
const FileFieldName = "file"
FileFieldName refers to the POST field containing file upload
const JSONRPCFieldName = "json_payload"
JSONRPCFieldName is a name of the POST field containing JSONRPC request accompanying the uploaded file
Variables ¶
Functions ¶
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func NewAuthError ¶
func NewInternalError ¶
func (Error) AsRPCResponse ¶
func (e Error) AsRPCResponse() *jsonrpc.RPCResponse
type LbrynetPublisher ¶
LbrynetPublisher is an implementation of SDK publisher.
func (*LbrynetPublisher) Publish ¶
func (p *LbrynetPublisher) Publish(filePath, accountID string, rawQuery []byte) []byte
Publish takes a file path, account ID and client JSON-RPC query, patches the query and sends it to the SDK for processing. Resulting response is then returned back as a slice of bytes.
type Publisher ¶
Publisher is responsible for sending data to lbrynet and should take file path, account ID and client query as a slice of bytes.
type UploadHandler ¶
UploadHandler glues HTTP uploads to the Publisher.
func NewUploadHandler ¶
func NewUploadHandler(opts UploadOpts) (*UploadHandler, error)
NewUploadHandler returns a HTTP upload handler object.
func (UploadHandler) CanHandle ¶ added in v0.8.2
func (h UploadHandler) CanHandle(r *http.Request, _ *mux.RouteMatch) bool
CanHandle checks if http.Request contains POSTed data in an accepted format. Supposed to be used in gorilla mux router MatcherFunc.
func (UploadHandler) Handle ¶
func (h UploadHandler) Handle(w http.ResponseWriter, r *users.AuthenticatedRequest)
Handle is where HTTP upload is handled and passed on to Publisher. It should be wrapped with users.Authenticator.Wrap before it can be used in a mux.Router.