MCPcopy
hub / github.com/pocketbase/pocketbase / bindCollectionApi

Function bindCollectionApi

apis/collection.go:18–32  ·  view source on GitHub ↗

bindCollectionApi registers the collection api endpoints and the corresponding handlers.

(app core.App, rg *router.RouterGroup[*core.RequestEvent])

Source from the content-addressed store, hash-verified

16
17// bindCollectionApi registers the collection api endpoints and the corresponding handlers.
18func bindCollectionApi(app core.App, rg *router.RouterGroup[*core.RequestEvent]) {
19 subGroup := rg.Group("/collections").Bind(RequireSuperuserAuth())
20 subGroup.GET("", collectionsList)
21 subGroup.POST("", collectionCreate)
22 subGroup.GET("/{collection}", collectionView)
23 subGroup.PATCH("/{collection}", collectionUpdate)
24 subGroup.DELETE("/{collection}", collectionDelete)
25 subGroup.DELETE("/{collection}/truncate", collectionTruncate)
26 subGroup.PUT("/import", collectionsImport)
27 subGroup.GET("/meta/scaffolds", collectionScaffolds)
28
29 // @todo experimental
30 subGroup.GET("/meta/oauth2-providers", collectionListOAuth2Providers)
31 subGroup.POST("/meta/dry-run-view", collectionDryRunView)
32}
33
34func collectionsList(e *core.RequestEvent) error {
35 fieldResolver := search.NewSimpleFieldResolver(

Callers 1

NewRouterFunction · 0.85

Calls 8

RequireSuperuserAuthFunction · 0.85
GroupMethod · 0.80
GETMethod · 0.80
POSTMethod · 0.80
PATCHMethod · 0.80
DELETEMethod · 0.80
PUTMethod · 0.80
BindMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…