Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for issuing REST-JSON requests for a specific type of objects.
type Config ¶
type Config struct { // Client is the underlying HTTP client. Client *jsonapi.Client // BasePath is the server HTTP path for manipulating a specific type of objects. BasePath string // SampleObject is an instance representing the type returned when getting an object. SampleObject any // SampleList is an instance representing the type returned when listing objects. SampleList any }
Config specifies a client configuration.
type Handler ¶
type Handler interface { // Decode and validate an object. Decode(data []byte) (any, error) // Create an object. Create(object any) error // Update an object. Update(object any) error // Get an object. Get(name string) (any, error) // Delete an object. Delete(object any) (any, error) // List all objects. List() (any, error) }
Handler for object operations.
type Server ¶
Server for handling REST-JSON requests.
func (*Server) AddObjectHandlers ¶
func (s *Server) AddObjectHandlers(spec *ServerObjectSpec)
AddObjectHandlers adds the server a handlers for managing a specific object type.
type ServerObjectSpec ¶
type ServerObjectSpec struct { // BasePath is the server HTTP path for manipulating a specific type of objects. BasePath string // Handler interface for object operations. Handler Handler // DeleteByValue is true for object types which are deletable by sending their value, instead of their name. DeleteByValue bool }
ServerObjectSpec specifies a set of server handlers for a specific object type.
Click to show internal directories.
Click to hide internal directories.