votes

package
v0.0.0-...-0362a01 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2018 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

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

type VoteResource struct {
	smolder.Resource
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL