router

package
v2.12.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachRoutes

func AttachRoutes(co controllers.Controller, group *gin.RouterGroup)

AttachRoutes attaches the API routes to the router group that is passed in Separating this from RouterConfig() allows us to attach it to different paths for different use cases, e.g. the standalone version.

func Config

func Config(url *url.URL) (*gin.Engine, error)

func GetRoot

func GetRoot(c *gin.Context)

GetRoot returns the link list for the API root

@Summary		API root
@Description	Entrypoint for the API, listing all endpoints
@Tags			General
@Success		200	{object}	RootResponse
@Router			/ [get]

func GetV1

func GetV1(c *gin.Context)

GetV1 returns the link list for v1

@Summary		v1 API
@Description	Returns general information about the v1 API
@Tags			v1
@Success		200	{object}	V1Response
@Router			/v1 [get]

func GetV2 added in v2.10.0

func GetV2(c *gin.Context)

GetV2 returns the link list for v2

@Summary		v2 API
@Description	Returns general information about the v2 API
@Tags			v2
@Success		200	{object}	V2Response
@Router			/v2 [get]

func GetVersion

func GetVersion(c *gin.Context)

GetVersion returns the API version object

@Summary		API version
@Description	Returns the software version of the API
@Tags			General
@Success		200	{object}	VersionResponse
@Router			/version [get]

func OptionsRoot

func OptionsRoot(c *gin.Context)

OptionsRoot returns the allowed HTTP methods

@Summary		Allowed HTTP verbs
@Description	Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
@Tags			General
@Success		204
@Router			/ [options]

func OptionsV1

func OptionsV1(c *gin.Context)

OptionsV1 returns the allowed HTTP methods

@Summary		Allowed HTTP verbs
@Description	Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
@Tags			v1
@Success		204
@Router			/v1 [options]

func OptionsV2 added in v2.10.0

func OptionsV2(c *gin.Context)

OptionsV2 returns the allowed HTTP methods

@Summary		Allowed HTTP verbs
@Description	Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
@Tags			v2
@Success		204
@Router			/v2 [options]

func OptionsVersion

func OptionsVersion(c *gin.Context)

OptionsVersion returns the allowed HTTP methods

@Summary		Allowed HTTP verbs
@Description	Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs
@Tags			General
@Success		204
@Router			/version [options]

func URLMiddleware

func URLMiddleware(url *url.URL) gin.HandlerFunc

Types

type RootLinks struct {
	Docs    string `json:"docs" example:"https://example.com/api/docs/index.html"` // Swagger API documentation
	Version string `json:"version" example:"https://example.com/api/version"`      // Endpoint returning the version of the backend
	V1      string `json:"v1" example:"https://example.com/api/v1"`                // List endpoint for all v1 endpoints
	V2      string `json:"v2" example:"https://example.com/api/v2"`                // List endpoint for all v2 endpoints
}

type RootResponse

type RootResponse struct {
	Links RootLinks `json:"links"`
}
type V1Links struct {
	Budgets      string `json:"budgets" example:"https://example.com/api/v1/budgets"`           // URL of budget list endpoint
	Accounts     string `json:"accounts" example:"https://example.com/api/v1/accounts"`         // URL of account list endpoint
	Categories   string `json:"categories" example:"https://example.com/api/v1/categories"`     // URL of category list endpoint
	Transactions string `json:"transactions" example:"https://example.com/api/v1/transactions"` // URL of transaction list endpoint
	Envelopes    string `json:"envelopes" example:"https://example.com/api/v1/envelopes"`       // URL of envelope list endpoint
	Allocations  string `json:"allocations" example:"https://example.com/api/v1/allocations"`   // URL of allocation list endpoint
	Months       string `json:"months" example:"https://example.com/api/v1/months"`             // URL of month list endpoint
	Import       string `json:"import" example:"https://example.com/api/v1/import"`             // URL of import list endpoint
}

type V1Response

type V1Response struct {
	Links V1Links `json:"links"` // Links for the v1 API
}
type V2Links struct {
	Transactions string `json:"transactions" example:"https://example.com/api/v2/transactions"` // URL of transaction list endpoint
	RenameRules  string `json:"rename-rules" example:"https://example.com/api/v2/rename-rules"` // URL of rename-rule list endpoint
}

type V2Response added in v2.10.0

type V2Response struct {
	Links V2Links `json:"links"` // Links for the v2 API
}

type VersionObject

type VersionObject struct {
	Version string `json:"version" example:"1.1.0"` // the running version of the Envelope Zero backend
}

type VersionResponse

type VersionResponse struct {
	Data VersionObject `json:"data"` // Data object for the version endpoint
}

Jump to

Keyboard shortcuts

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