Documentation ¶
Overview ¶
Package apihandler defines haul's v1 API endpoint logic
It defines the APIHandler struct that allows more a efficient reuse of single *db.PostgresClient.
The APIHandler also implements the Declare method for activation of the `/v1/*` routes by cmd.apiCmd
This package is a work-in-progress during haul's migration from the old `/v1/*` routes (which now reside at `/v0/*`) to the ones declared here.
Index ¶
- func Declare(e *echo.Group, h *APIHandler)
- type APIHandler
- func (h *APIHandler) AssetAttributesGET(c echo.Context) (err error)
- func (h *APIHandler) AssetDELETE(c echo.Context) (err error)
- func (h *APIHandler) AssetDescriptionGET(c echo.Context) (err error)
- func (h *APIHandler) AssetDescriptionPUT(c echo.Context) (err error)
- func (h *APIHandler) AssetGET(c echo.Context) (err error)
- func (h *APIHandler) AssetRestorePOST(c echo.Context) (err error)
- func (h *APIHandler) AssetStatusDELETE(c echo.Context) (err error)
- func (h *APIHandler) AssetStatusGET(c echo.Context) (err error)
- func (h *APIHandler) AssetStatusPUT(c echo.Context) (err error)
- func (h *APIHandler) AssetTargetDELETE(c echo.Context) (err error)
- func (h *APIHandler) AssetTargetGET(c echo.Context) (err error)
- func (h *APIHandler) AssetTargetPUT(c echo.Context) (err error)
- func (h *APIHandler) AssetsAllGET(c echo.Context) (err error)
- func (h *APIHandler) AssetsDELETE(c echo.Context) error
- func (h *APIHandler) AssetsDetailedGET(c echo.Context) (err error)
- func (h *APIHandler) AssetsGET(c echo.Context) (err error)
- func (h *APIHandler) AssetsPOST(c echo.Context) (err error)
- func (h *APIHandler) AssetsRestorePOST(c echo.Context) (err error)
- func (h *APIHandler) AttributeAllowEmptyValuePUT(c echo.Context) (err error)
- func (h *APIHandler) AttributeAssetsGET(c echo.Context) (err error)
- func (h *APIHandler) AttributeDELETE(c echo.Context) (err error)
- func (h *APIHandler) AttributeGET(c echo.Context) (err error)
- func (h *APIHandler) AttributeKeyPUT(c echo.Context) (err error)
- func (h *APIHandler) AttributeRestorePOST(c echo.Context) (err error)
- func (h *APIHandler) AttributesDELETE(c echo.Context) (err error)
- func (h *APIHandler) AttributesGET(c echo.Context) (err error)
- func (h *APIHandler) AttributesPOST(c echo.Context) (err error)
- func (h *APIHandler) EventsGET(c echo.Context) (err error)
- func (h *APIHandler) HealthGET(c echo.Context) (err error)
- func (h *APIHandler) SeedPOST(c echo.Context) (err error)
- func (h *APIHandler) TagDELETE(c echo.Context) (err error)
- func (h *APIHandler) TagDetailedGET(c echo.Context) (err error)
- func (h *APIHandler) TagGET(c echo.Context) (err error)
- func (h *APIHandler) TagValueGET(c echo.Context) (err error)
- func (h *APIHandler) TagValuePUT(c echo.Context) (err error)
- func (h *APIHandler) TagsDELETE(c echo.Context) (err error)
- func (h *APIHandler) TagsGET(c echo.Context) (err error)
- func (h *APIHandler) TagsPOST(c echo.Context) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Declare ¶
func Declare(e *echo.Group, h *APIHandler)
Declare adds routes defined in its scope to the specified *echo.Group
It is used by cmd.apiCmd to declare the `/v1/*` routes.
Types ¶
type APIHandler ¶
type APIHandler struct { APIClient *apiclient.APIClient PostgresClient *db.PostgresClient }
func New ¶
func New(postgresClient *db.PostgresClient) *APIHandler
func NewWithAPIClient ¶ added in v0.66.0
func NewWithAPIClient(apiClient *apiclient.APIClient, postgresClient *db.PostgresClient) *APIHandler
func (*APIHandler) AssetAttributesGET ¶ added in v0.63.0
func (h *APIHandler) AssetAttributesGET(c echo.Context) (err error)
AssetAttributesGET is the handler for `GET /v1/assets/{asset_id}/attributes`
func (*APIHandler) AssetDELETE ¶ added in v0.63.0
func (h *APIHandler) AssetDELETE(c echo.Context) (err error)
AssetDELETE is the handler for `DELETE /v1/assets/{asset_id}`
func (*APIHandler) AssetDescriptionGET ¶ added in v0.63.0
func (h *APIHandler) AssetDescriptionGET(c echo.Context) (err error)
AssetDescriptionGET is the handler for `GET /v1/assets/{asset_id}/description`
func (*APIHandler) AssetDescriptionPUT ¶ added in v0.63.0
func (h *APIHandler) AssetDescriptionPUT(c echo.Context) (err error)
AssetDescriptionPUT is the handler for `PUT /v1/assets/{asset_id}/description`
func (*APIHandler) AssetGET ¶ added in v0.63.0
func (h *APIHandler) AssetGET(c echo.Context) (err error)
AssetGET is the handler for `GET /v1/assets/{asset_id}`
func (*APIHandler) AssetRestorePOST ¶ added in v0.63.0
func (h *APIHandler) AssetRestorePOST(c echo.Context) (err error)
AssetRestorePOST is the handler for `POST /v1/assets/{asset_id}/restore`
func (*APIHandler) AssetStatusDELETE ¶ added in v0.63.0
func (h *APIHandler) AssetStatusDELETE(c echo.Context) (err error)
AssetStatusDELETE is the handler for `DELETE /v1/assets/{asset_id}/status`
func (*APIHandler) AssetStatusGET ¶ added in v0.63.0
func (h *APIHandler) AssetStatusGET(c echo.Context) (err error)
AssetStatusGET is the handler for `GET /v1/assets/{asset_id}/status`
func (*APIHandler) AssetStatusPUT ¶ added in v0.63.0
func (h *APIHandler) AssetStatusPUT(c echo.Context) (err error)
AssetStatusPUT is the handler for `PUT /v1/assets/{asset_id}/status`
func (*APIHandler) AssetTargetDELETE ¶ added in v0.63.0
func (h *APIHandler) AssetTargetDELETE(c echo.Context) (err error)
AssetTargetDELETE is the handler for `DELETE /v1/assets/{asset_id}/target`
func (*APIHandler) AssetTargetGET ¶ added in v0.63.0
func (h *APIHandler) AssetTargetGET(c echo.Context) (err error)
AssetTargetGET is the handler for `GET /v1/assets/{asset_id}/target`
func (*APIHandler) AssetTargetPUT ¶ added in v0.63.0
func (h *APIHandler) AssetTargetPUT(c echo.Context) (err error)
AssetTargetPUT is the handler for `PUT /v1/assets/{asset_id}/target`
func (*APIHandler) AssetsAllGET ¶ added in v0.60.0
func (h *APIHandler) AssetsAllGET(c echo.Context) (err error)
AssetsAllGET is the handler for `GET /v1/assets/all`
func (*APIHandler) AssetsDELETE ¶ added in v0.63.0
func (h *APIHandler) AssetsDELETE(c echo.Context) error
AssetsDELETE is the handler for `DELETE /v1/assets`
func (*APIHandler) AssetsDetailedGET ¶ added in v0.74.0
func (h *APIHandler) AssetsDetailedGET(c echo.Context) (err error)
AssetsDetailedGET is the handler for `GET /v1/assets/detailed`
func (*APIHandler) AssetsGET ¶ added in v0.63.0
func (h *APIHandler) AssetsGET(c echo.Context) (err error)
AssetsGET is the handler for `GET /v1/assets`
func (*APIHandler) AssetsPOST ¶ added in v0.63.0
func (h *APIHandler) AssetsPOST(c echo.Context) (err error)
AssetsPOST is the handler for `POST /v1/assets`
func (*APIHandler) AssetsRestorePOST ¶ added in v0.67.0
func (h *APIHandler) AssetsRestorePOST(c echo.Context) (err error)
AssetsRestorePOST is the handler for `POST /v1/assets/restore`
func (*APIHandler) AttributeAllowEmptyValuePUT ¶ added in v0.75.0
func (h *APIHandler) AttributeAllowEmptyValuePUT(c echo.Context) (err error)
AttributeAllowEmptyValuePUT
func (*APIHandler) AttributeAssetsGET ¶ added in v0.63.0
func (h *APIHandler) AttributeAssetsGET(c echo.Context) (err error)
AttributeAssetsGET is the handler for `GET /v1/attributes/{attribute_id}/assets`
func (*APIHandler) AttributeDELETE ¶ added in v0.63.0
func (h *APIHandler) AttributeDELETE(c echo.Context) (err error)
AttributeDELETE is the handler for `DELETE /v1/attributes/{attribute_id}`
func (*APIHandler) AttributeGET ¶ added in v0.63.0
func (h *APIHandler) AttributeGET(c echo.Context) (err error)
AttributeGET is the handler for `GET /v1/attributes/{attribute_id}`
func (*APIHandler) AttributeKeyPUT ¶ added in v0.75.0
func (h *APIHandler) AttributeKeyPUT(c echo.Context) (err error)
AttributeKeyPUT
func (*APIHandler) AttributeRestorePOST ¶ added in v0.63.0
func (h *APIHandler) AttributeRestorePOST(c echo.Context) (err error)
AttributeRestorePOST
func (*APIHandler) AttributesDELETE ¶ added in v0.77.0
func (h *APIHandler) AttributesDELETE(c echo.Context) (err error)
AttributesDELETE
func (*APIHandler) AttributesGET ¶ added in v0.63.0
func (h *APIHandler) AttributesGET(c echo.Context) (err error)
AttributesGET is the handler for `GET /v1/attributes`
func (*APIHandler) AttributesPOST ¶ added in v0.63.0
func (h *APIHandler) AttributesPOST(c echo.Context) (err error)
AttributesPOST is the handler for `POST /v1/attributes`
func (*APIHandler) EventsGET ¶ added in v0.62.0
func (h *APIHandler) EventsGET(c echo.Context) (err error)
EventsGET is the handler for `GET /events`
func (*APIHandler) HealthGET ¶
func (h *APIHandler) HealthGET(c echo.Context) (err error)
HealthGET is the handler for `GET /v1/health`
func (*APIHandler) SeedPOST ¶ added in v0.61.0
func (h *APIHandler) SeedPOST(c echo.Context) (err error)
SeedPOST is the handler for `POST /v1/seed`
func (*APIHandler) TagDELETE ¶ added in v0.78.0
func (h *APIHandler) TagDELETE(c echo.Context) (err error)
TagDELETE is the handler for `DELETE /v1/tags/{tag_id}`
func (*APIHandler) TagDetailedGET ¶ added in v0.78.0
func (h *APIHandler) TagDetailedGET(c echo.Context) (err error)
func (*APIHandler) TagGET ¶ added in v0.78.0
func (h *APIHandler) TagGET(c echo.Context) (err error)
TagGET is the handler for `GET /v1/tags/{tag_id}`
func (*APIHandler) TagValueGET ¶ added in v0.78.0
func (h *APIHandler) TagValueGET(c echo.Context) (err error)
func (*APIHandler) TagValuePUT ¶ added in v0.78.0
func (h *APIHandler) TagValuePUT(c echo.Context) (err error)
func (*APIHandler) TagsDELETE ¶ added in v0.78.0
func (h *APIHandler) TagsDELETE(c echo.Context) (err error)
TagsDELETE is the handler for `DELETE /v1/tags`
func (*APIHandler) TagsGET ¶ added in v0.78.0
func (h *APIHandler) TagsGET(c echo.Context) (err error)
TagsGET is the handler for `GET /v1/tags`
func (*APIHandler) TagsPOST ¶ added in v0.78.0
func (h *APIHandler) TagsPOST(c echo.Context) (err error)
TagsPOST is `POST /tags`