Documentation ¶
Index ¶
- type PaymentPostStruct
- type PaymentPutStruct
- type PaymentResource
- func (r *PaymentResource) Get(context smolder.APIContext, request *restful.Request, ...)
- func (r *PaymentResource) GetAuthRequired() bool
- func (r *PaymentResource) GetByIDs(context smolder.APIContext, request *restful.Request, ...)
- func (r *PaymentResource) GetByIDsAuthRequired() bool
- func (r *PaymentResource) GetDoc() string
- func (r *PaymentResource) GetParams() []*restful.Parameter
- func (r *PaymentResource) Post(context smolder.APIContext, data interface{}, request *restful.Request, ...)
- func (r *PaymentResource) PostAuthRequired() bool
- func (r *PaymentResource) PostDoc() string
- func (r *PaymentResource) PostParams() []*restful.Parameter
- func (r *PaymentResource) Put(context smolder.APIContext, data interface{}, request *restful.Request, ...)
- func (r *PaymentResource) PutAuthRequired() bool
- func (r *PaymentResource) PutDoc() string
- func (r *PaymentResource) PutParams() []*restful.Parameter
- func (r *PaymentResource) Reads() interface{}
- func (r *PaymentResource) Register(container *restful.Container, config smolder.APIConfig, ...)
- func (r *PaymentResource) Returns() interface{}
- func (r *PaymentResource) Validate(context smolder.APIContext, data interface{}, request *restful.Request) error
- type PaymentResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PaymentPostStruct ¶
type PaymentPostStruct struct { Payment struct { Source string `json:"source"` SourceID string `json:"source_id"` Amount int64 `json:"amount"` Code string `json:"code"` Pending bool `json:"pending"` } `json:"payment"` }
PaymentPostStruct holds all values of an incoming POST request
type PaymentPutStruct ¶
type PaymentPutStruct struct {
PaymentPostStruct
}
PaymentPutStruct holds all values of an incoming PUT request
type PaymentResource ¶
PaymentResource is the resource responsible for /payments
func (*PaymentResource) Get ¶
func (r *PaymentResource) Get(context smolder.APIContext, request *restful.Request, response *restful.Response, params map[string][]string)
Get sends out items matching the query parameters
func (*PaymentResource) GetAuthRequired ¶
func (r *PaymentResource) GetAuthRequired() bool
GetAuthRequired returns true because all requests need authentication
func (*PaymentResource) GetByIDs ¶
func (r *PaymentResource) GetByIDs(context smolder.APIContext, request *restful.Request, response *restful.Response, ids []string)
GetByIDs sends out all items matching a set of IDs
func (*PaymentResource) GetByIDsAuthRequired ¶
func (r *PaymentResource) GetByIDsAuthRequired() bool
GetByIDsAuthRequired returns true because all requests need authentication
func (*PaymentResource) GetDoc ¶
func (r *PaymentResource) GetDoc() string
GetDoc returns the description of this API endpoint
func (*PaymentResource) GetParams ¶
func (r *PaymentResource) GetParams() []*restful.Parameter
GetParams returns the parameters supported by this API endpoint
func (*PaymentResource) Post ¶
func (r *PaymentResource) Post(context smolder.APIContext, data interface{}, request *restful.Request, response *restful.Response)
Post processes an incoming POST (create) request
func (*PaymentResource) PostAuthRequired ¶
func (r *PaymentResource) PostAuthRequired() bool
PostAuthRequired returns true because all requests need authentication
func (*PaymentResource) PostDoc ¶
func (r *PaymentResource) PostDoc() string
PostDoc returns the description of this API endpoint
func (*PaymentResource) PostParams ¶
func (r *PaymentResource) PostParams() []*restful.Parameter
PostParams returns the parameters supported by this API endpoint
func (*PaymentResource) Put ¶
func (r *PaymentResource) Put(context smolder.APIContext, data interface{}, request *restful.Request, response *restful.Response)
Put processes an incoming PUT (update) request
func (*PaymentResource) PutAuthRequired ¶
func (r *PaymentResource) PutAuthRequired() bool
PutAuthRequired returns true because all requests need authentication
func (*PaymentResource) PutDoc ¶
func (r *PaymentResource) PutDoc() string
PutDoc returns the description of this API endpoint
func (*PaymentResource) PutParams ¶
func (r *PaymentResource) PutParams() []*restful.Parameter
PutParams returns the parameters supported by this API endpoint
func (*PaymentResource) Reads ¶
func (r *PaymentResource) Reads() interface{}
Reads returns the model that will be read by POST, PUT & PATCH operations
func (*PaymentResource) Register ¶
func (r *PaymentResource) Register(container *restful.Container, config smolder.APIConfig, context smolder.APIContextFactory)
Register this resource with the container to setup all the routes
func (*PaymentResource) Returns ¶
func (r *PaymentResource) Returns() interface{}
Returns returns the model that will be returned
func (*PaymentResource) Validate ¶
func (r *PaymentResource) Validate(context smolder.APIContext, data interface{}, request *restful.Request) error
Validate checks an incoming request for data errors
type PaymentResponse ¶
type PaymentResponse struct { smolder.Response Payments []paymentInfoResponse `json:"payments,omitempty"` // contains filtered or unexported fields }
PaymentResponse is the common response to 'payment' requests
func (*PaymentResponse) AddPayment ¶
func (r *PaymentResponse) AddPayment(payment db.Payment)
AddPayment adds a payment to the response
func (*PaymentResponse) EmptyResponse ¶
func (r *PaymentResponse) EmptyResponse() interface{}
EmptyResponse returns an empty API response for this endpoint if there's no data to respond with
func (*PaymentResponse) Init ¶
func (r *PaymentResponse) Init(context smolder.APIContext)
Init a new response