Documentation ¶
Index ¶
- func GetMux(req *http.Request) http.Handler
- func GetPath(req *http.Request) riposo.Path
- func Parse(r *http.Request, v interface{}) error
- func Render(w http.ResponseWriter, v interface{})
- func WithTxn(ctx context.Context, txn *Txn) context.Context
- type Config
- type Guard
- type HandlerFunc
- type Middleware
- type Model
- type Routes
- type Txn
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Guard is a custom authorization guard. Guard Guard // Pagination configures resource pagination options. Pagination struct { TokenValidity time.Duration MaxLimit int } }
Config holds API configuration values.
type Guard ¶
A Guard represents an authorization guard and can verify access of user principals to target entities.
func (Guard) Verify ¶
func (v Guard) Verify(tx permission.Transaction, principals []string, target []permission.ACE) (bool, error)
Verify returns true if any of the user principals can access any of the target entities.
type HandlerFunc ¶
HandlerFunc is a simplified API handler function.
func (HandlerFunc) ServeHTTP ¶
func (f HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler interface.
type Middleware ¶
Middleware represents a middleware handler function.
type Model ¶
type Model interface { // Get retrieves a single resource. Get(txn *Txn, path riposo.Path) (*schema.Resource, error) // Create creates a single resource. Create(txn *Txn, path riposo.Path, payload *schema.Resource) error // Update updates a resource. Update(txn *Txn, path riposo.Path, hs storage.UpdateHandle, payload *schema.Resource) error // Patch patches a resource. Patch(txn *Txn, path riposo.Path, hs storage.UpdateHandle, payload *schema.Resource) error // Delete deletes a resource. Delete(txn *Txn, path riposo.Path) (*schema.Object, error) // DeleteAll deletes resources. DeleteAll(txn *Txn, path riposo.Path, objIDs ...string) (riposo.Epoch, error) }
Model is a CRUD resource operator.
type Routes ¶
type Routes struct {
// contains filtered or unexported fields
}
Routes contains the main API route defintions.
type Txn ¶
type Txn struct { context.Context Store storage.Transaction Perms permission.Transaction Cache cache.Transaction Helpers *riposo.Helpers User *User Data map[string]interface{} }
Txn wraps an API transaction.
Click to show internal directories.
Click to hide internal directories.