api

package
v2.0.0-...-274a74e Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 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/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

Index

Constants

This section is empty.

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 CreateLineageJSONBody

type CreateLineageJSONBody = LineageCreationRequest

CreateLineageJSONBody defines parameters for CreateLineage.

type CreateLineageJSONRequestBody

type CreateLineageJSONRequestBody = CreateLineageJSONBody

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 LeaseTicketJSONBody

type LeaseTicketJSONBody = TicketLeaseRequest

LeaseTicketJSONBody defines parameters for LeaseTicket.

type LeaseTicketJSONRequestBody

type LeaseTicketJSONRequestBody = LeaseTicketJSONBody

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

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.

type UpdateTicketJSONBody

type UpdateTicketJSONBody = TicketUpdateRequest

UpdateTicketJSONBody defines parameters for UpdateTicket.

type UpdateTicketJSONRequestBody

type UpdateTicketJSONRequestBody = UpdateTicketJSONBody

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