Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry interface { // >>> Getter and setter methods // There is no SetId method because the id will be generated by the Storage // Returns a unique Id of the Entry GetId() string // Returns the author (access token) GetAuthor() string // Sets the author (access token) SetAuthor(author string) // Returns the filename GetFilename() string // Sets the filename SetFilename(filename string) // Returns the content type GetContentType() string // Sets the content type SetContentType(contentType string) // Returns the last modified date GetLastModifiedValue() time.Time // Sets the e-tag value SetLastModifiedValue(lastModified time.Time) // Returns the upload date GetUploadDate() time.Time // Sets the upload date SetUploadDate(uploadDate time.Time) // <<< // // >>> Storage methods // This method is used to initially save the storages object. // It sets the Id of the Entry. // Returns an error if something went wrong or nil if not. Save() error // This method is used to update the storages object. // It updates all fields. // Returns an error if something went wrong or nil if not. Update() error // This method is used to delete the storages object // It deletes the entry by its Id. Therefore only the Id has to be set. // Returns an error if something went wrong or nil if not. Delete() error // This method is used to get a read-seeker and therefore the content of the entry. // It returns a reader which can be used to read the data and an error if something went wrong or nil if not. GetReadSeeker() (io.ReadSeeker, error) // This method is used to store content of the file. It returns a writer which can be used to write all content. GetWriter() (io.WriteCloser, error) }
type PathConfiguration ¶
type PathConfiguration struct { UploadPath string // Path where POST-Requests of ShareX are routing at. Example: /upload GetPath string // Path where clients get their files. The Id in the path must be {id}. Example: /get/{id} }
Path configuration: All paths have to start with a slash ("/")
type ShareXHandler ¶
type ShareXHandler struct { PathConfiguration Storage Storage OutgoingFunction func(http.ResponseWriter, *http.Request) SendBufferSize int ReceiveBufferSize int Path string ProtocolHost string WhitelistedContentTypes []string // contains filtered or unexported fields }PathConfiguration *
This is the main class which is used to use the ShareX handler
func (*ShareXHandler) BindToRouter ¶
func (shareXHandler *ShareXHandler) BindToRouter(parentRouter *mux.Router) (subRouter *mux.Router)
This is the function which binds a ShareX handler router to the given path.
type Storage ¶
type Storage interface { // Initializes the connection/files to/of the storages // Returns nil if the initialization was a success or a given error Initialize() error // Closes an existing connection/streams of the storages // Returns whether the close process was a success and error or nil Close() (bool, error) // Returns the pointer to completely fresh and new instance of a Entry which is not stored yet // To store it you should set the values and after that call the Save method. NewStorageEntry() Entry // LoadStorageEntry(id string) (bool, error, Entry) }
This interface is used to store/update/delete given files
Click to show internal directories.
Click to hide internal directories.