mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2026-01-06 02:33:22 -06:00
parent
dc338dc881
commit
742f985d5b
15 changed files with 322 additions and 56 deletions
|
|
@ -33,6 +33,10 @@ import (
|
|||
|
||||
// BasePath is the base API path for making media requests
|
||||
const BasePath = "/api/v1/media"
|
||||
// IDKey is the key for media attachment IDs
|
||||
const IDKey = "id"
|
||||
// BasePathWithID corresponds to a media attachment with the given ID
|
||||
const BasePathWithID = BasePath + "/:" + IDKey
|
||||
|
||||
// Module implements the ClientAPIModule interface for media
|
||||
type Module struct {
|
||||
|
|
@ -53,6 +57,8 @@ func New(config *config.Config, processor message.Processor, log *logrus.Logger)
|
|||
// Route satisfies the RESTAPIModule interface
|
||||
func (m *Module) Route(s router.Router) error {
|
||||
s.AttachHandler(http.MethodPost, BasePath, m.MediaCreatePOSTHandler)
|
||||
s.AttachHandler(http.MethodGet, BasePathWithID, m.MediaGETHandler)
|
||||
s.AttachHandler(http.MethodPut, BasePathWithID, m.MediaPUTHandler)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue