transactions

package
v0.0.0-...-678ecff Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TransactionPostStruct

type TransactionPostStruct struct {
	Transaction struct {
		BudgetID   string `json:"budget_id"`
		ToBudgetID string `json:"to_budget_id"`
		Amount     int64  `json:"amount"`
		Purpose    string `json:"purpose"`
	} `json:"transaction"`
}

TransactionPostStruct holds all values of an incoming POST request

type TransactionPutStruct

type TransactionPutStruct struct {
	TransactionPostStruct
}

TransactionPutStruct holds all values of an incoming PUT request

type TransactionResource

type TransactionResource struct {
	smolder.Resource
}

TransactionResource is the resource responsible for /transactions

func (*TransactionResource) Get

func (r *TransactionResource) Get(context smolder.APIContext, request *restful.Request, response *restful.Response, params map[string][]string)

Get sends out items matching the query parameters

func (*TransactionResource) GetAuthRequired

func (r *TransactionResource) GetAuthRequired() bool

GetAuthRequired returns true because all requests need authentication

func (*TransactionResource) GetByIDs

func (r *TransactionResource) GetByIDs(context smolder.APIContext, request *restful.Request, response *restful.Response, ids []string)

GetByIDs sends out all items matching a set of IDs

func (*TransactionResource) GetByIDsAuthRequired

func (r *TransactionResource) GetByIDsAuthRequired() bool

GetByIDsAuthRequired returns true because all requests need authentication

func (*TransactionResource) GetDoc

func (r *TransactionResource) GetDoc() string

GetDoc returns the description of this API endpoint

func (*TransactionResource) GetParams

func (r *TransactionResource) GetParams() []*restful.Parameter

GetParams returns the parameters supported by this API endpoint

func (*TransactionResource) Post

func (r *TransactionResource) Post(context smolder.APIContext, data interface{}, request *restful.Request, response *restful.Response)

Post processes an incoming POST (create) request

func (*TransactionResource) PostAuthRequired

func (r *TransactionResource) PostAuthRequired() bool

PostAuthRequired returns true because all requests need authentication

func (*TransactionResource) PostDoc

func (r *TransactionResource) PostDoc() string

PostDoc returns the description of this API endpoint

func (*TransactionResource) PostParams

func (r *TransactionResource) PostParams() []*restful.Parameter

PostParams returns the parameters supported by this API endpoint

func (*TransactionResource) Put

func (r *TransactionResource) Put(context smolder.APIContext, data interface{}, request *restful.Request, response *restful.Response)

Put processes an incoming PUT (update) request

func (*TransactionResource) PutAuthRequired

func (r *TransactionResource) PutAuthRequired() bool

PutAuthRequired returns true because all requests need authentication

func (*TransactionResource) PutDoc

func (r *TransactionResource) PutDoc() string

PutDoc returns the description of this API endpoint

func (*TransactionResource) PutParams

func (r *TransactionResource) PutParams() []*restful.Parameter

PutParams returns the parameters supported by this API endpoint

func (*TransactionResource) Reads

func (r *TransactionResource) Reads() interface{}

Reads returns the model that will be read by POST, PUT & PATCH operations

func (*TransactionResource) Register

func (r *TransactionResource) Register(container *restful.Container, config smolder.APIConfig, context smolder.APIContextFactory)

Register this resource with the container to setup all the routes

func (*TransactionResource) Returns

func (r *TransactionResource) Returns() interface{}

Returns returns the model that will be returned

func (*TransactionResource) Validate

func (r *TransactionResource) Validate(context smolder.APIContext, data interface{}, request *restful.Request) error

Validate checks an incoming request for data errors

type TransactionResponse

type TransactionResponse struct {
	smolder.Response

	Transactions []transactionInfoResponse `json:"transactions,omitempty"`
	// contains filtered or unexported fields
}

TransactionResponse is the common response to 'transaction' requests

func (*TransactionResponse) AddTransaction

func (r *TransactionResponse) AddTransaction(transaction db.Transaction)

AddTransaction adds a transaction to the response

func (*TransactionResponse) EmptyResponse

func (r *TransactionResponse) EmptyResponse() interface{}

EmptyResponse returns an empty API response for this endpoint if there's no data to respond with

func (*TransactionResponse) Init

func (r *TransactionResponse) 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