api

package
v3.0.0-...-46f45df Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSpec

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

GetSpec returns the OpenAPI specification corresponding to the generated code in this file. External references in the spec are resolved through PathToRawSpec; externally-referenced files must be embedded in their corresponding Go packages (via the import-mapping feature). URL-based external refs are not supported.

func GetSpecJSON

func GetSpecJSON() ([]byte, error)

GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI specification: decompressed but not unmarshaled. External references are not resolved here; the bytes are the spec exactly as embedded by codegen. The result is cached at package init time, so repeated calls are cheap.

func GetSwagger deprecated

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

GetSwagger returns the OpenAPI specification corresponding to the generated code in this file.

Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger to openapi3.T. Use GetSpec instead. This wrapper is retained for backwards compatibility.

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)

RegisterHandlersWithBaseURL registers handlers and prepends BaseURL to the paths so the API can be served under a prefix.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router EchoRouter, si ServerInterface, options RegisterHandlersOptions)

RegisterHandlersWithOptions registers handlers using the supplied options, including any per-operation middleware.

Types

type CreateLineageJSONRequestBody

type CreateLineageJSONRequestBody = LineageCreationRequest

CreateLineageJSONRequestBody defines body for CreateLineage for application/json ContentType.

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 Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Error defines model for Error.

type GetLineageByExtIdParams

type GetLineageByExtIdParams struct {
	ExtId string `form:"extId" json:"extId"`
}

GetLineageByExtIdParams defines parameters for GetLineageByExtId.

type GetTicketsParams

type GetTicketsParams struct {
	TicketExtIds []string `form:"ticketExtIds" json:"ticketExtIds"`
}

GetTicketsParams defines parameters for GetTickets.

type LeaseTicketJSONRequestBody

type LeaseTicketJSONRequestBody = TicketLeaseRequest

LeaseTicketJSONRequestBody defines body for LeaseTicket for application/json ContentType.

type LineageCreationRequest

type LineageCreationRequest struct {
	ExtId               string `json:"extId"`
	MaxLeasedNonceCount int    `json:"maxLeasedNonceCount"`
	StartLeasingFrom    *int   `json:"startLeasingFrom,omitempty"`
}

LineageCreationRequest defines model for LineageCreationRequest.

type LineageCreationResponse

type LineageCreationResponse struct {
	ExtId string `json:"extId"`
	Id    string `json:"id"`
}

LineageCreationResponse defines model for LineageCreationResponse.

type LineageGetResponse

type LineageGetResponse struct {
	ExtId               string `json:"extId"`
	Id                  string `json:"id"`
	LeasedNonceCount    int    `json:"leasedNonceCount"`
	MaxLeasedNonceCount int    `json:"maxLeasedNonceCount"`
	MaxNonceValue       int    `json:"maxNonceValue"`
	NextNonce           int    `json:"nextNonce"`
	ReleasedNonceCount  int    `json:"releasedNonceCount"`
}

LineageGetResponse defines model for LineageGetResponse.

type RegisterHandlersOptions

type RegisterHandlersOptions struct {
	// BaseURL is prepended to every registered path so the API can be served
	// under a prefix.
	BaseURL string
	// OperationMiddlewares lets the caller attach per-operation middleware at
	// registration time. The map key is the OpenAPI `operationId` value as it
	// appears in the spec (the raw, un-normalized form). Operations that have
	// no entry are registered with no extra middleware. A nil map disables
	// per-operation middleware entirely.
	OperationMiddlewares map[string][]echo.MiddlewareFunc
}

RegisterHandlersOptions configures RegisterHandlersWithOptions.

type ServerInterface

type ServerInterface interface {

	// (GET /lineages)
	GetLineageByExtId(ctx echo.Context, params GetLineageByExtIdParams) error

	// (POST /lineages)
	CreateLineage(ctx echo.Context) error

	// (GET /lineages/{lineageId}/tickets)
	GetTickets(ctx echo.Context, lineageId string, params GetTicketsParams) error
	// Lease tickets
	// (POST /lineages/{lineageId}/tickets)
	LeaseTicket(ctx echo.Context, lineageId string) error

	// (GET /lineages/{lineageId}/tickets/{ticketExtId})
	GetTicket(ctx echo.Context, lineageId string, ticketExtId string) error

	// (PATCH /lineages/{lineageId}/tickets/{ticketExtId})
	UpdateTicket(ctx echo.Context, lineageId string, ticketExtId string) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) CreateLineage

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

CreateLineage converts echo context to params.

func (*ServerInterfaceWrapper) GetLineageByExtId

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

GetLineageByExtId converts echo context to params.

func (*ServerInterfaceWrapper) GetTicket

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

GetTicket converts echo context to params.

func (*ServerInterfaceWrapper) GetTickets

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

GetTickets converts echo context to params.

func (*ServerInterfaceWrapper) LeaseTicket

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

LeaseTicket converts echo context to params.

func (*ServerInterfaceWrapper) UpdateTicket

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

UpdateTicket converts echo context to params.

type TicketLease

type TicketLease struct {
	ExtId     string           `json:"extId"`
	LineageId string           `json:"lineageId"`
	Nonce     int              `json:"nonce"`
	State     TicketLeaseState `json:"state"`
}

TicketLease defines model for TicketLease.

type TicketLeaseRequest

type TicketLeaseRequest struct {
	ExtIds []string `json:"extIds"`
}

TicketLeaseRequest defines model for TicketLeaseRequest.

type TicketLeaseResponse

type TicketLeaseResponse struct {
	Leases *[]TicketLease `json:"leases,omitempty"`
}

TicketLeaseResponse defines model for TicketLeaseResponse.

type TicketLeaseState

type TicketLeaseState string

TicketLeaseState defines model for TicketLease.State.

const (
	TicketLeaseStateClosed TicketLeaseState = "closed"
	TicketLeaseStateLeased TicketLeaseState = "leased"
)

Defines values for TicketLeaseState.

func (TicketLeaseState) Valid

func (e TicketLeaseState) Valid() bool

Valid indicates whether the value is a known member of the TicketLeaseState enum.

type TicketUpdateRequest

type TicketUpdateRequest struct {
	State TicketUpdateRequestState `json:"state"`
}

TicketUpdateRequest defines model for TicketUpdateRequest.

type TicketUpdateRequestState

type TicketUpdateRequestState string

TicketUpdateRequestState defines model for TicketUpdateRequest.State.

const (
	TicketUpdateRequestStateClosed   TicketUpdateRequestState = "closed"
	TicketUpdateRequestStateReleased TicketUpdateRequestState = "released"
)

Defines values for TicketUpdateRequestState.

func (TicketUpdateRequestState) Valid

func (e TicketUpdateRequestState) Valid() bool

Valid indicates whether the value is a known member of the TicketUpdateRequestState enum.

type UpdateTicketJSONRequestBody

type UpdateTicketJSONRequestBody = TicketUpdateRequest

UpdateTicketJSONRequestBody defines body for UpdateTicket for application/json ContentType.

Jump to

Keyboard shortcuts

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