budgets

package
v0.0.0-...-1ad76dd Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BudgetInfoResponse

type BudgetInfoResponse struct {
	ID          string `json:"id"`
	Project     string `json:"project"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Balance     int64  `json:"balance"`
	Code        string `json:"code"`
}

func PrepareBudgetResponse

func PrepareBudgetResponse(context smolder.APIContext, budget *db.Budget) BudgetInfoResponse

type BudgetPostStruct

type BudgetPostStruct struct {
	Budget struct {
		Project        string `json:"project"`
		ParentID       int64  `json:"parent_id"`
		Name           string `json:"name"`
		Description    string `json:"description"`
		Private        bool   `json:"private"`
		PrivateBalance bool   `json:"private_balance"`
	} `json:"budget"`
}

BudgetPostStruct holds all values of an incoming POST request

type BudgetPutStruct

type BudgetPutStruct struct {
	BudgetPostStruct
}

BudgetPutStruct holds all values of an incoming PUT request

type BudgetResource

type BudgetResource struct {
	smolder.Resource
}

BudgetResource is the resource responsible for /budgets

func (*BudgetResource) Delete

func (r *BudgetResource) Delete(context smolder.APIContext, request *restful.Request, response *restful.Response)

Post processes an incoming POST (create) request

func (*BudgetResource) DeleteAuthRequired

func (r *BudgetResource) DeleteAuthRequired() bool

DeleteAuthRequired returns true because all requests need authentication

func (*BudgetResource) DeleteDoc

func (r *BudgetResource) DeleteDoc() string

DeleteDoc returns the description of this API endpoint

func (*BudgetResource) DeleteParams

func (r *BudgetResource) DeleteParams() []*restful.Parameter

DeleteParams returns the parameters supported by this API endpoint

func (*BudgetResource) Get

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

Get sends out items matching the query parameters

func (*BudgetResource) GetAuthRequired

func (r *BudgetResource) GetAuthRequired() bool

GetAuthRequired returns true because all requests need authentication

func (*BudgetResource) GetByIDs

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

GetByIDs sends out all items matching a set of IDs

func (*BudgetResource) GetByIDsAuthRequired

func (r *BudgetResource) GetByIDsAuthRequired() bool

GetByIDsAuthRequired returns true because all requests need authentication

func (*BudgetResource) GetDoc

func (r *BudgetResource) GetDoc() string

GetDoc returns the description of this API endpoint

func (*BudgetResource) GetParams

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

GetParams returns the parameters supported by this API endpoint

func (*BudgetResource) Post

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

Post processes an incoming POST (create) request

func (*BudgetResource) PostAuthRequired

func (r *BudgetResource) PostAuthRequired() bool

PostAuthRequired returns true because all requests need authentication

func (*BudgetResource) PostDoc

func (r *BudgetResource) PostDoc() string

PostDoc returns the description of this API endpoint

func (*BudgetResource) PostParams

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

PostParams returns the parameters supported by this API endpoint

func (*BudgetResource) Put

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

Put processes an incoming PUT (update) request

func (*BudgetResource) PutAuthRequired

func (r *BudgetResource) PutAuthRequired() bool

PutAuthRequired returns true because all requests need authentication

func (*BudgetResource) PutDoc

func (r *BudgetResource) PutDoc() string

PutDoc returns the description of this API endpoint

func (*BudgetResource) PutParams

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

PutParams returns the parameters supported by this API endpoint

func (*BudgetResource) Reads

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

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

func (*BudgetResource) Register

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

Register this resource with the container to setup all the routes

func (*BudgetResource) Returns

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

Returns returns the model that will be returned

func (*BudgetResource) Validate

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

Validate checks an incoming request for data errors

type BudgetResponse

type BudgetResponse struct {
	smolder.Response

	Budgets []BudgetInfoResponse `json:"budgets,omitempty"`

	Projects []projects.ProjectInfoResponse `json:"projects,omitempty"`
	// contains filtered or unexported fields
}

BudgetResponse is the common response to 'budget' requests

func (*BudgetResponse) AddBudget

func (r *BudgetResponse) AddBudget(budget *db.Budget)

AddBudget adds a budget to the response

func (*BudgetResponse) EmptyResponse

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

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

func (*BudgetResponse) Init

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