Documentation
¶
Index ¶
- type ClientSchema
- type Command
- func (c *Command) Create(ctx *gin.Context)
- func (c *Command) Delete(ctx *gin.Context)
- func (c *Command) GetAll(ctx *gin.Context)
- func (c *Command) GetSingle(ctx *gin.Context)
- func (c *Command) ReturnOne(filter map[string]interface{}) (ResponseSchema, error)
- func (c *Command) Routes() []types.RouteDetails
- func (c *Command) Update(ctx *gin.Context)
- type CreationSchema
- type EmbeddedResponseSchema
- type ResponseSchema
- type UpdateEmbeddedResponseSchema
- type UpdateSchema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientSchema ¶
type ClientSchema struct {
Arguments []schemas.MessagePacket `json:"arguments"`
Enabled *bool `json:"enabled"`
Response EmbeddedResponseSchema `json:"response"`
}
ClientSchema is the schema the data from the client will be marshalled into
type Command ¶
type Command struct {
Conn *rethink.Connection // The RethinkDB connection
Table string // The database table we're using
}
Command is the struct that implements the handler interface for the command resource
func (*Command) ReturnOne ¶
func (c *Command) ReturnOne(filter map[string]interface{}) (ResponseSchema, error)
ReturnOne retrieves a single record given the filter provided
func (*Command) Routes ¶
func (c *Command) Routes() []types.RouteDetails
Routes returns the routing information for this endpoint
type CreationSchema ¶
type CreationSchema struct {
ClientSchema
// Ignore these fields in user input, they will be filled automatically by the API
Count int `json:"count"`
CreatedAt time.Time `json:"createdAt"`
DeletedAt float64 `json:"deletedAt"`
Token string `json:"token"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
}
CreationSchema is all the data required for a new command to be created
type EmbeddedResponseSchema ¶
type EmbeddedResponseSchema struct {
Action bool `json:"action" jsonapi:"attr,action"`
Message []schemas.MessagePacket `json:"message" jsonapi:"attr,message"`
Role int `json:"role" jsonapi:"attr,role"`
Target string `json:"target" jsonapi:"attr,target"`
User string `json:"user" jsonapi:"attr,user"`
}
EmbeddedResponseSchema is the schema that is stored under the response key in ResponseSchema
func (EmbeddedResponseSchema) GetAPITag ¶
func (r EmbeddedResponseSchema) GetAPITag(lookup string) string
GetAPITag allows each of these types to implement the JSONAPISchema interface
type ResponseSchema ¶
type ResponseSchema struct {
ID string `jsonapi:"primary,command"`
Arguments []schemas.MessagePacket `jsonapi:"attr,arguments"`
Count int `jsonapi:"attr,count"`
CreatedAt string `jsonapi:"meta,createdAt"`
Enabled bool `jsonapi:"attr,enabled"`
Name string `jsonapi:"attr,name"`
Response EmbeddedResponseSchema `jsonapi:"attr,response"`
Token string `jsonapi:"meta,token"`
}
ResponseSchema is the schema for the data that will be sent out to the client
func (ResponseSchema) DumpBody ¶
func (rs ResponseSchema) DumpBody(data []byte) ([]byte, error)
DumpBody dumps the body data bytes into this specific schema and returns the bytes from this
func (ResponseSchema) GetAPITag ¶
func (rs ResponseSchema) GetAPITag(lookup string) string
GetAPITag allows each of these types to implement the JSONAPISchema interface
func (ResponseSchema) JSONAPIMeta ¶
func (rs ResponseSchema) JSONAPIMeta() *types.Meta
JSONAPIMeta returns a meta object for the response
type UpdateEmbeddedResponseSchema ¶
type UpdateEmbeddedResponseSchema struct {
Action *bool `json:"action,omitempty" jsonapi:"attr,action"`
Message []schemas.MessagePacket `json:"message,omitempty" jsonapi:"attr,message"`
Role *int `json:"role,omitempty" jsonapi:"attr,role"`
Target *string `json:"target,omitempty" jsonapi:"attr,target"`
User *string `json:"user,omitempty" jsonapi:"attr,user"`
}
UpdateEmbeddedResponseSchema is the schema that is stored under the response key in UpdateSchema
func (UpdateEmbeddedResponseSchema) GetAPITag ¶
func (r UpdateEmbeddedResponseSchema) GetAPITag(lookup string) string
GetAPITag allows each of these types to implement the JSONAPISchema interface
type UpdateSchema ¶
type UpdateSchema struct {
Arguments []schemas.MessagePacket `json:"arguments,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Response UpdateEmbeddedResponseSchema `json:"response,omitempty"`
}
UpdateSchema is ClientSchema that is used when updating