Documentation ¶
Index ¶
- type UserPostStruct
- type UserResource
- func (r *UserResource) Get(context smolder.APIContext, request *restful.Request, ...)
- func (r *UserResource) GetAuthRequired() bool
- func (r *UserResource) GetByIDs(context smolder.APIContext, request *restful.Request, ...)
- func (r *UserResource) GetByIDsAuthRequired() bool
- func (r *UserResource) GetDoc() string
- func (r *UserResource) GetParams() []*restful.Parameter
- func (r *UserResource) Post(context smolder.APIContext, data interface{}, request *restful.Request, ...)
- func (r *UserResource) PostAuthRequired() bool
- func (r *UserResource) PostDoc() string
- func (r *UserResource) PostParams() []*restful.Parameter
- func (r *UserResource) Reads() interface{}
- func (r *UserResource) Register(container *restful.Container, config smolder.APIConfig, ...)
- func (r *UserResource) Returns() interface{}
- func (r *UserResource) Validate(context smolder.APIContext, data interface{}, request *restful.Request) error
- type UserResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserPostStruct ¶
type UserPostStruct struct { User struct { Email string `json:"email"` About string `json:"about"` } `json:"user"` }
UserPostStruct holds all values of an incoming POST request
type UserResource ¶
UserResource is the resource responsible for /users
func (*UserResource) Get ¶
func (r *UserResource) Get(context smolder.APIContext, request *restful.Request, response *restful.Response, params map[string][]string)
Get sends out items matching the query parameters
func (*UserResource) GetAuthRequired ¶
func (r *UserResource) GetAuthRequired() bool
GetAuthRequired returns true because all requests need authentication
func (*UserResource) GetByIDs ¶
func (r *UserResource) GetByIDs(context smolder.APIContext, request *restful.Request, response *restful.Response, ids []string)
GetByIDs sends out all items matching a set of IDs
func (*UserResource) GetByIDsAuthRequired ¶
func (r *UserResource) GetByIDsAuthRequired() bool
GetByIDsAuthRequired returns true because all requests need authentication
func (*UserResource) GetDoc ¶
func (r *UserResource) GetDoc() string
GetDoc returns the description of this API endpoint
func (*UserResource) GetParams ¶
func (r *UserResource) GetParams() []*restful.Parameter
GetParams returns the parameters supported by this API endpoint
func (*UserResource) Post ¶
func (r *UserResource) Post(context smolder.APIContext, data interface{}, request *restful.Request, response *restful.Response)
Post processes an incoming POST (create) request
func (*UserResource) PostAuthRequired ¶
func (r *UserResource) PostAuthRequired() bool
PostAuthRequired returns true because all requests need authentication
func (*UserResource) PostDoc ¶
func (r *UserResource) PostDoc() string
PostDoc returns the description of this API endpoint
func (*UserResource) PostParams ¶
func (r *UserResource) PostParams() []*restful.Parameter
PostParams returns the parameters supported by this API endpoint
func (*UserResource) Reads ¶
func (r *UserResource) Reads() interface{}
Reads returns the model that will be read by POST, PUT & PATCH operations
func (*UserResource) Register ¶
func (r *UserResource) Register(container *restful.Container, config smolder.APIConfig, context smolder.APIContextFactory)
Register this resource with the container to setup all the routes
func (*UserResource) Returns ¶
func (r *UserResource) Returns() interface{}
Returns returns the model that will be returned
func (*UserResource) Validate ¶
func (r *UserResource) Validate(context smolder.APIContext, data interface{}, request *restful.Request) error
type UserResponse ¶
type UserResponse struct { smolder.Response Users []userInfoResponse `json:"users,omitempty"` // contains filtered or unexported fields }
UserResponse is the common response to 'user' requests
func (*UserResponse) AddUser ¶
func (r *UserResponse) AddUser(user *db.User)
AddUser adds a user to the response
func (*UserResponse) EmptyResponse ¶
func (r *UserResponse) EmptyResponse() interface{}
EmptyResponse returns an empty API response for this endpoint if there's no data to respond with
func (*UserResponse) Init ¶
func (r *UserResponse) Init(context smolder.APIContext)
Init a new response