/
routes.go
107 lines (101 loc) · 5.03 KB
/
routes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package api
import (
"gopkg.in/gin-gonic/gin.v1"
)
func SetupRoutes(router *gin.Engine) {
router.GET("/health_check", HealthCheckHandler)
operations := router.Group("operations")
operations.POST("/capture_start", CaptureStartHandler)
operations.POST("/capture_stop", CaptureStopHandler)
operations.POST("/demux", DemuxHandler)
operations.POST("/trim", TrimHandler)
operations.POST("/send", SendHandler)
operations.POST("/convert", ConvertHandler)
operations.POST("/upload", UploadHandler)
operations.POST("/sirtutim", SirtutimHandler)
operations.POST("/insert", InsertHandler)
operations.POST("/transcode", TranscodeHandler)
operations.POST("/join", JoinHandler)
operations.GET("/descendant_units/:sha1", DescendantUnitsHandler)
rest := router.Group("rest")
rest.GET("/collections/", CollectionsListHandler)
rest.POST("/collections/", CollectionsListHandler)
rest.GET("/collections/:id/", CollectionHandler)
rest.PUT("/collections/:id/", CollectionHandler)
rest.DELETE("/collections/:id/", CollectionHandler)
rest.PUT("/collections/:id/i18n/", CollectionI18nHandler)
rest.GET("/collections/:id/content_units/", CollectionContentUnitsHandler)
rest.POST("/collections/:id/order_positions", CollectionContentUnitsPositionHandler)
rest.POST("/collections/:id/content_units/", CollectionContentUnitsHandler)
rest.PUT("/collections/:id/content_units/:cuID", CollectionContentUnitsHandler)
rest.DELETE("/collections/:id/content_units/:cuID", CollectionContentUnitsHandler)
rest.POST("/collections/:id/activate", CollectionActivateHandler)
rest.GET("/content_units/", ContentUnitsListHandler)
rest.POST("/content_units/", ContentUnitsListHandler)
rest.GET("/content_units/:id/", ContentUnitHandler)
rest.PUT("/content_units/:id/", ContentUnitHandler)
rest.PUT("/content_units/:id/i18n/", ContentUnitI18nHandler)
rest.GET("/content_units/:id/files/", ContentUnitFilesHandler)
rest.POST("/content_units/:id/files/", ContentUnitFilesHandler)
rest.GET("/content_units/:id/collections/", ContentUnitCollectionsHandler)
rest.GET("/content_units/:id/derivatives/", ContentUnitDerivativesHandler)
rest.POST("/content_units/:id/derivatives/", ContentUnitDerivativesHandler)
rest.PUT("/content_units/:id/derivatives/:duID", ContentUnitDerivativesHandler)
rest.DELETE("/content_units/:id/derivatives/:duID", ContentUnitDerivativesHandler)
rest.GET("/content_units/:id/origins/", ContentUnitOriginsHandler)
rest.GET("/content_units/:id/sources/", ContentUnitSourcesHandler)
rest.POST("/content_units/:id/sources/", ContentUnitSourcesHandler)
rest.DELETE("/content_units/:id/sources/:sourceID", ContentUnitSourcesHandler)
rest.GET("/content_units/:id/tags/", ContentUnitTagsHandler)
rest.POST("/content_units/:id/tags/", ContentUnitTagsHandler)
rest.DELETE("/content_units/:id/tags/:tagID", ContentUnitTagsHandler)
rest.GET("/content_units/:id/persons/", ContentUnitPersonsHandler)
rest.POST("/content_units/:id/persons/", ContentUnitPersonsHandler)
rest.DELETE("/content_units/:id/persons/:personID", ContentUnitPersonsHandler)
rest.GET("/content_units/:id/publishers/", ContentUnitPublishersHandler)
rest.POST("/content_units/:id/publishers/", ContentUnitPublishersHandler)
rest.DELETE("/content_units/:id/publishers/:publisherID", ContentUnitPublishersHandler)
rest.POST("/content_units/:id/merge", ContentUnitMergeHandler)
rest.GET("/files/", FilesListHandler)
rest.GET("/files/:id/", FileHandler)
rest.PUT("/files/:id/", FileHandler)
rest.GET("/files/:id/storages/", FileStoragesHandler)
rest.GET("/files/:id/tree/", FilesWithOperationsTreeHandler)
rest.GET("/operations/", OperationsListHandler)
rest.GET("/operations/:id/", OperationItemHandler)
rest.GET("/operations/:id/files/", OperationFilesHandler)
rest.GET("/authors/", AuthorsHandler)
rest.GET("/sources/", SourcesHandler)
rest.POST("/sources/", SourcesHandler)
rest.GET("/sources/:id/", SourceHandler)
rest.PUT("/sources/:id/", SourceHandler)
rest.PUT("/sources/:id/i18n/", SourceI18nHandler)
rest.GET("/tags/", TagsHandler)
rest.POST("/tags/", TagsHandler)
rest.GET("/tags/:id/", TagHandler)
rest.PUT("/tags/:id/", TagHandler)
rest.PUT("/tags/:id/i18n/", TagI18nHandler)
rest.GET("/persons/", PersonsListHandler)
rest.POST("/persons/", PersonsListHandler)
rest.GET("/persons/:id/", PersonHandler)
rest.PUT("/persons/:id/", PersonHandler)
rest.DELETE("/persons/:id/", PersonHandler)
rest.PUT("/persons/:id/i18n/", PersonI18nHandler)
rest.GET("/storages/", StoragesHandler)
rest.GET("/publishers/", PublishersHandler)
rest.POST("/publishers/", PublishersHandler)
rest.GET("/publishers/:id/", PublisherHandler)
rest.PUT("/publishers/:id/", PublisherHandler)
rest.PUT("/publishers/:id/i18n/", PublisherI18nHandler)
hierarchy := router.Group("hierarchy")
hierarchy.GET("/sources/", SourcesHierarchyHandler)
hierarchy.GET("/tags/", TagsHierarchyHandler)
//router.GET("/recover", func(c *gin.Context) {
// panic("test recover")
//})
//router.GET("/error", func(c *gin.Context) {
// c.AbortWithError(500,
// errors.Wrap(errors.New("test error with stack"), "wrap msg")).
// SetType(gin.ErrorTypePrivate)
//})
}