REST

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package REST provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT.

Index

Constants

View Source
const (
	DeviceAuthScopes = "deviceAuth.Scopes"
)

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type CreateModuleParams

type CreateModuleParams struct {
	// XDeviceID Unique Identifier of the calling Device. If calling Data endpoints, must be presented in order
	// to be properly authenticated.
	XDeviceID XDeviceID `json:"X-Device-ID"`
}

CreateModuleParams defines parameters for CreateModule.

type DeleteModulesParams

type DeleteModulesParams struct {
	// DeviceId Device Identifier to use for the Query. If given, takes precedence over X-Device-ID or other hints.
	// Use to query data from devices in your account from another account.
	DeviceId *DeviceIDQuery `form:"device-id,omitempty" json:"device-id,omitempty"`

	// XDeviceID Unique Identifier of the calling Device. If calling Data endpoints, must be presented in order
	// to be properly authenticated.
	XDeviceID XDeviceID `json:"X-Device-ID"`
}

DeleteModulesParams defines parameters for DeleteModules.

type Device

type Device struct {
	// Id Device ID is the unique identifier for a remote device
	Id DeviceID `json:"id"`
}

Device a device

type DeviceID

type DeviceID = openapi_types.UUID

DeviceID Device ID is the unique identifier for a remote device

type DeviceIDQuery

type DeviceIDQuery = DeviceID

DeviceIDQuery Device ID is the unique identifier for a remote device

type DeviceList

type DeviceList struct {
	// Count Amount of Items contained in List
	Count ListItemCount `json:"count"`

	// Items array of devices, it will always at least contain the device of the authenticated user
	Items []Device `json:"items"`
}

DeviceList list of devices

type DeviceListResponse

type DeviceListResponse = DeviceList

DeviceListResponse list of devices

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type GetDevicesParams

type GetDevicesParams struct {
	// XDeviceID Unique Identifier of the calling Device. If calling Data endpoints, must be presented in order
	// to be properly authenticated.
	XDeviceID XDeviceID `json:"X-Device-ID"`
}

GetDevicesParams defines parameters for GetDevices.

type GetModuleParams

type GetModuleParams struct {
	// DeviceId Device Identifier to use for the Query. If given, takes precedence over X-Device-ID or other hints.
	// Use to query data from devices in your account from another account.
	DeviceId *DeviceIDQuery `form:"device-id,omitempty" json:"device-id,omitempty"`

	// XDeviceID Unique Identifier of the calling Device. If calling Data endpoints, must be presented in order
	// to be properly authenticated.
	XDeviceID XDeviceID `json:"X-Device-ID"`
}

GetModuleParams defines parameters for GetModule.

type HealthAggregation

type HealthAggregation struct {
	// Components The different Components of the Server
	Components *[]HealthAggregationComponent `json:"components,omitempty"`

	// Health A Health Check Result
	Health HealthResult `json:"health"`
}

HealthAggregation defines model for HealthAggregation.

type HealthAggregationComponent

type HealthAggregationComponent struct {
	// Health A Health Check Result
	Health HealthResult `json:"health"`

	// Name The Name of the Component to be Health Checked
	Name string `json:"name"`
}

HealthAggregationComponent defines model for HealthAggregationComponent.

type HealthResult

type HealthResult string

HealthResult A Health Check Result

const (
	Down HealthResult = "Down"
	Up   HealthResult = "Up"
)

Defines values for HealthResult.

type ListItemCount

type ListItemCount = int

ListItemCount Amount of Items contained in List

type ModifiedAtTimestamp

type ModifiedAtTimestamp = time.Time

ModifiedAtTimestamp A Timestamp indicating when a datum was last modified

type ModuleDataAccepted

type ModuleDataAccepted = interface{}

ModuleDataAccepted An Empty JSON

type ModuleDataStream

type ModuleDataStream = openapi_types.File

ModuleDataStream Module Data Stream

type ModuleDeletionAccepted

type ModuleDeletionAccepted = interface{}

ModuleDeletionAccepted An Empty JSON

type ModuleName

type ModuleName = string

ModuleName Module Name

type RegisterParams

type RegisterParams struct {
	// Share The Share Code from the Share API. If presented in combination with a new Device ID,
	// it can be used to add new devices to an account.
	Share *ShareCode `form:"share,omitempty" json:"share,omitempty"`

	// XDeviceID Unique Identifier of the calling Device. If calling Data endpoints, must be presented in order
	// to be properly authenticated.
	XDeviceID XDeviceID `json:"X-Device-ID"`
}

RegisterParams defines parameters for Register.

type RegistrationResult

type RegistrationResult struct {
	Password string `json:"password"`
	Username string `json:"username"`
}

RegistrationResult defines model for RegistrationResult.

type ServerInterface

type ServerInterface interface {
	// Register A Device
	// (POST /auth/register)
	Register(ctx echo.Context, params RegisterParams) error
	// Share your Account
	// (POST /auth/share)
	Share(ctx echo.Context, params ShareParams) error
	// Get All registered Devices for your Account
	// (GET /devices)
	GetDevices(ctx echo.Context, params GetDevicesParams) error
	// Checks if the Service is Available for Processing Request
	// (GET /health)
	IsHealthy(ctx echo.Context) error
	// Clears Module Data for a Device
	// (DELETE /module)
	DeleteModules(ctx echo.Context, params DeleteModulesParams) error
	// Get Module Data
	// (GET /module/{name})
	GetModule(ctx echo.Context, name ModuleName, params GetModuleParams) error
	// Create/Update Module Data
	// (POST /module/{name})
	CreateModule(ctx echo.Context, name ModuleName, params CreateModuleParams) error
	// Checks if the Service is Operational
	// (GET /ready)
	IsReady(ctx echo.Context) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) CreateModule

func (w *ServerInterfaceWrapper) CreateModule(ctx echo.Context) error

CreateModule converts echo context to params.

func (*ServerInterfaceWrapper) DeleteModules

func (w *ServerInterfaceWrapper) DeleteModules(ctx echo.Context) error

DeleteModules converts echo context to params.

func (*ServerInterfaceWrapper) GetDevices

func (w *ServerInterfaceWrapper) GetDevices(ctx echo.Context) error

GetDevices converts echo context to params.

func (*ServerInterfaceWrapper) GetModule

func (w *ServerInterfaceWrapper) GetModule(ctx echo.Context) error

GetModule converts echo context to params.

func (*ServerInterfaceWrapper) IsHealthy

func (w *ServerInterfaceWrapper) IsHealthy(ctx echo.Context) error

IsHealthy converts echo context to params.

func (*ServerInterfaceWrapper) IsReady

func (w *ServerInterfaceWrapper) IsReady(ctx echo.Context) error

IsReady converts echo context to params.

func (*ServerInterfaceWrapper) Register

func (w *ServerInterfaceWrapper) Register(ctx echo.Context) error

Register converts echo context to params.

func (*ServerInterfaceWrapper) Share

func (w *ServerInterfaceWrapper) Share(ctx echo.Context) error

Share converts echo context to params.

type ShareCode

type ShareCode = string

ShareCode defines model for ShareCode.

type ShareParams

type ShareParams struct {
	// XDeviceID Unique Identifier of the calling Device. If calling Data endpoints, must be presented in order
	// to be properly authenticated.
	XDeviceID XDeviceID `json:"X-Device-ID"`
}

ShareParams defines parameters for Share.

type ShareResponse

type ShareResponse struct {
	ShareCode *string `json:"shareCode,omitempty"`
}

ShareResponse defines model for ShareResponse.

type XDeviceID

type XDeviceID = DeviceID

XDeviceID Device ID is the unique identifier for a remote device

Jump to

Keyboard shortcuts

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