api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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