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