Documentation
¶
Index ¶
- Constants
- func GenericEndpointDefinition[Input any](systemID string, url string, method string, ...) endpoint.Definition
- func GenericEndpointHandler[Input any](systemID string, inputHandler endpoint.InputHandler[Input], ...) endpoint.Handler[Input]
- func HealthDefinition(systemID string) endpoint.Definition
- func HealthEndpointHandler(inputHandler endpoint.InputHandler[HealthInput], ...) endpoint.Handler[HealthInput]
- func SendHealthRequest(ctx context.Context, host string) (*json.Response[json.APIOutput[HealthOutput]], error)
- type HealthInput
- type HealthOutput
Constants ¶
const ( HealthURL = "/health" HealthMethod = http.MethodGet )
Health endpoint constants.
Variables ¶
This section is empty.
Functions ¶
func GenericEndpointDefinition ¶
func GenericEndpointDefinition[Input any]( systemID string, url string, method string, inputHandler endpoint.InputHandler[Input], expectedErrors errutil.ExpectedErrors, invokeFn endpoint.HandlerLogicFn[Input], ) endpoint.Definition
GenericEndpointDefinition builds the endpoint definition for any operation. It uses default handlers to handle the request.
Parameters:
- systemID: The system ID.
- url: The URL of the endpoint.
- method: The HTTP method of the endpoint.
- inputHandler: The input handler for the endpoint.
- expectedErrors: The expected errors for the endpoint.
- invokeFn: The function to invoke the endpoint.
Returns:
- endpoint.Definition: The endpoint definition.
func GenericEndpointHandler ¶
func GenericEndpointHandler[Input any]( systemID string, inputHandler endpoint.InputHandler[Input], expectedErrors errutil.ExpectedErrors, invokeFn endpoint.HandlerLogicFn[Input], ) endpoint.Handler[Input]
GenericEndpointHandler builds the endpoint handler for any operation. It uses default handlers to handle the request.
Parameters:
- systemID: The system ID.
- inputHandler: The input handler for the endpoint.
- expectedErrors: The expected errors for the endpoint.
- invokeFn: The function to invoke the endpoint.
Returns:
- endpoint.Handler: The endpoint handler.
func HealthDefinition ¶
func HealthDefinition(systemID string) endpoint.Definition
HealthDefinition returns the definition of a simple health endpoint. It uses default handlers to handle the request.
Parameters:
- systemID: The system ID.
Returns:
- endpoint.Definition: The definition of the health endpoint.
func HealthEndpointHandler ¶
func HealthEndpointHandler( inputHandler endpoint.InputHandler[HealthInput], emitterLogger event.EmitterLogger, systemID string, ) endpoint.Handler[HealthInput]
HealthEndpointHandler returns the handler for a simple health endpoint. It uses default handlers to handle the request.
Parameters:
- inputHandler: The input handler for the endpoint.
- emitterLogger: The emitter logger for the endpoint.
- systemID: The system ID.
Returns:
- endpoint.Handler: The handler for the health endpoint.
func SendHealthRequest ¶
func SendHealthRequest( ctx context.Context, host string, ) (*json.Response[json.APIOutput[HealthOutput]], error)
SendHealthRequest sends a request to the health endpoint.
Parameters:
- ctx: The context.
- host: The host.
Returns:
- *apijson.Response[apijson.APIOutput[HealthOutput]]: The response.
- error: The error.
Types ¶
type HealthInput ¶
type HealthInput struct{}
HealthInput is the input of the health endpoint.
func NewHealthInput ¶
func NewHealthInput() *HealthInput
NewHealthInput returns a new instance of HealthInput.
Returns:
- *HealthInput: A new instance of HealthInput.
type HealthOutput ¶
type HealthOutput struct{}
HealthOutput is the output of the health endpoint.
func NewHealthOutput ¶
func NewHealthOutput() *HealthOutput
NewHealthOutput returns a new instance of HealthOutput.
Returns:
- *HealthOutput: A new instance of HealthOutput.