api

package
v0.0.0-...-30229d2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildOpenApiValidator

func BuildOpenApiValidator(raw []byte) (echo.MiddlewareFunc, error)

func DefaultErrorHandler

func DefaultErrorHandler(err error, c echo.Context)

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 CreateTodo

type CreateTodo struct {
	// Details The longer rich text content of the TODO item.
	Details *string `json:"details,omitempty"`

	// GroupId The workspace this TODO should be created in
	GroupId *string `json:"group_id,omitempty"`

	// Title The title of the TODO item.
	Title string `json:"title"`
}

CreateTodo defines model for CreateTodo.

type CreateTodo201JSONResponse

type CreateTodo201JSONResponse Todo

func (CreateTodo201JSONResponse) VisitCreateTodoResponse

func (response CreateTodo201JSONResponse) VisitCreateTodoResponse(w http.ResponseWriter) error

type CreateTodo400JSONResponse

type CreateTodo400JSONResponse struct {
	StandardBadRequestProblemJSONResponse
}

func (CreateTodo400JSONResponse) VisitCreateTodoResponse

func (response CreateTodo400JSONResponse) VisitCreateTodoResponse(w http.ResponseWriter) error

type CreateTodo404JSONResponse

type CreateTodo404JSONResponse struct {
	StandardNotFoundProblemJSONResponse
}

func (CreateTodo404JSONResponse) VisitCreateTodoResponse

func (response CreateTodo404JSONResponse) VisitCreateTodoResponse(w http.ResponseWriter) error

type CreateTodoJSONRequestBody

type CreateTodoJSONRequestBody = CreateTodo

CreateTodoJSONRequestBody defines body for CreateTodo for application/json ContentType.

type CreateTodoRequestObject

type CreateTodoRequestObject struct {
	WorkspaceId string `json:"workspaceId"`
	Body        *CreateTodoJSONRequestBody
}

type CreateTodoResponseObject

type CreateTodoResponseObject interface {
	VisitCreateTodoResponse(w http.ResponseWriter) error
}

type CreateTododefaultJSONResponse

type CreateTododefaultJSONResponse struct {
	Body       Problem
	StatusCode int
}

func (CreateTododefaultJSONResponse) VisitCreateTodoResponse

func (response CreateTododefaultJSONResponse) VisitCreateTodoResponse(w http.ResponseWriter) error

type DefaultJsonSerializer

type DefaultJsonSerializer struct {
}

func (*DefaultJsonSerializer) Deserialize

func (d *DefaultJsonSerializer) Deserialize(c echo.Context, i interface{}) error

func (*DefaultJsonSerializer) Serialize

func (d *DefaultJsonSerializer) Serialize(c echo.Context, i interface{}, indent string) error

type DeleteTodo204Response

type DeleteTodo204Response struct {
}

func (DeleteTodo204Response) VisitDeleteTodoResponse

func (response DeleteTodo204Response) VisitDeleteTodoResponse(w http.ResponseWriter) error

type DeleteTodo400JSONResponse

type DeleteTodo400JSONResponse struct {
	StandardBadRequestProblemJSONResponse
}

func (DeleteTodo400JSONResponse) VisitDeleteTodoResponse

func (response DeleteTodo400JSONResponse) VisitDeleteTodoResponse(w http.ResponseWriter) error

type DeleteTodo404JSONResponse

type DeleteTodo404JSONResponse struct {
	StandardNotFoundProblemJSONResponse
}

func (DeleteTodo404JSONResponse) VisitDeleteTodoResponse

func (response DeleteTodo404JSONResponse) VisitDeleteTodoResponse(w http.ResponseWriter) error

type DeleteTodoRequestObject

type DeleteTodoRequestObject struct {
	WorkspaceId string `json:"workspaceId"`
	TodoId      string `json:"todoId"`
}

type DeleteTodoResponseObject

type DeleteTodoResponseObject interface {
	VisitDeleteTodoResponse(w http.ResponseWriter) error
}

type DeleteTododefaultJSONResponse

type DeleteTododefaultJSONResponse struct {
	Body       Problem
	StatusCode int
}

func (DeleteTododefaultJSONResponse) VisitDeleteTodoResponse

func (response DeleteTododefaultJSONResponse) VisitDeleteTodoResponse(w http.ResponseWriter) error

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 ErrCouldNotParseRequest

type ErrCouldNotParseRequest struct {
	// contains filtered or unexported fields
}

func NewErrCouldNotParseRequest

func NewErrCouldNotParseRequest(reason string, inner error) *ErrCouldNotParseRequest

func (*ErrCouldNotParseRequest) Error

func (e *ErrCouldNotParseRequest) Error() string

func (*ErrCouldNotParseRequest) String

func (e *ErrCouldNotParseRequest) String() string

func (*ErrCouldNotParseRequest) Unwrap

func (e *ErrCouldNotParseRequest) Unwrap() error

type GetHealthZ200JSONResponse

type GetHealthZ200JSONResponse HealthZ

func (GetHealthZ200JSONResponse) VisitGetHealthZResponse

func (response GetHealthZ200JSONResponse) VisitGetHealthZResponse(w http.ResponseWriter) error

type GetHealthZRequestObject

type GetHealthZRequestObject struct {
}

type GetHealthZResponseObject

type GetHealthZResponseObject interface {
	VisitGetHealthZResponse(w http.ResponseWriter) error
}

type GetHealthZdefaultJSONResponse

type GetHealthZdefaultJSONResponse struct {
	Body       Problem
	StatusCode int
}

func (GetHealthZdefaultJSONResponse) VisitGetHealthZResponse

func (response GetHealthZdefaultJSONResponse) VisitGetHealthZResponse(w http.ResponseWriter) error

type GetTodo200JSONResponse

type GetTodo200JSONResponse Todo

func (GetTodo200JSONResponse) VisitGetTodoResponse

func (response GetTodo200JSONResponse) VisitGetTodoResponse(w http.ResponseWriter) error

type GetTodo400JSONResponse

type GetTodo400JSONResponse struct {
	StandardBadRequestProblemJSONResponse
}

func (GetTodo400JSONResponse) VisitGetTodoResponse

func (response GetTodo400JSONResponse) VisitGetTodoResponse(w http.ResponseWriter) error

type GetTodo404JSONResponse

type GetTodo404JSONResponse struct {
	StandardNotFoundProblemJSONResponse
}

func (GetTodo404JSONResponse) VisitGetTodoResponse

func (response GetTodo404JSONResponse) VisitGetTodoResponse(w http.ResponseWriter) error

type GetTodoRequestObject

type GetTodoRequestObject struct {
	WorkspaceId string `json:"workspaceId"`
	TodoId      string `json:"todoId"`
}

type GetTodoResponseObject

type GetTodoResponseObject interface {
	VisitGetTodoResponse(w http.ResponseWriter) error
}

type GetTododefaultJSONResponse

type GetTododefaultJSONResponse struct {
	Body       Problem
	StatusCode int
}

func (GetTododefaultJSONResponse) VisitGetTodoResponse

func (response GetTododefaultJSONResponse) VisitGetTodoResponse(w http.ResponseWriter) error

type HealthZ

type HealthZ = map[string]interface{}

HealthZ defines model for HealthZ.

type ListTodos200JSONResponse

type ListTodos200JSONResponse TodoPage

func (ListTodos200JSONResponse) VisitListTodosResponse

func (response ListTodos200JSONResponse) VisitListTodosResponse(w http.ResponseWriter) error

type ListTodos400JSONResponse

type ListTodos400JSONResponse struct {
	StandardBadRequestProblemJSONResponse
}

func (ListTodos400JSONResponse) VisitListTodosResponse

func (response ListTodos400JSONResponse) VisitListTodosResponse(w http.ResponseWriter) error

type ListTodos404JSONResponse

type ListTodos404JSONResponse struct {
	StandardNotFoundProblemJSONResponse
}

func (ListTodos404JSONResponse) VisitListTodosResponse

func (response ListTodos404JSONResponse) VisitListTodosResponse(w http.ResponseWriter) error

type ListTodosParams

type ListTodosParams struct {
	// Page The page token to request.
	Page *string `form:"page,omitempty" json:"page,omitempty"`

	// PageSize The page size to limit the response to.
	PageSize *int `form:"page_size,omitempty" json:"page_size,omitempty"`

	// Status Filter by a status.
	Status *string `form:"status,omitempty" json:"status,omitempty"`

	// SortUpdatedAt Sort by updated at
	SortUpdatedAt *ListTodosParamsSortUpdatedAt `form:"sort_updated_at,omitempty" json:"sort_updated_at,omitempty"`
}

ListTodosParams defines parameters for ListTodos.

type ListTodosParamsSortUpdatedAt

type ListTodosParamsSortUpdatedAt string

ListTodosParamsSortUpdatedAt defines parameters for ListTodos.

const (
	Asc  ListTodosParamsSortUpdatedAt = "asc"
	Desc ListTodosParamsSortUpdatedAt = "desc"
)

Defines values for ListTodosParamsSortUpdatedAt.

type ListTodosRequestObject

type ListTodosRequestObject struct {
	WorkspaceId string `json:"workspaceId"`
	Params      ListTodosParams
}

type ListTodosResponseObject

type ListTodosResponseObject interface {
	VisitListTodosResponse(w http.ResponseWriter) error
}

type ListTodosdefaultJSONResponse

type ListTodosdefaultJSONResponse struct {
	Body       Problem
	StatusCode int
}

func (ListTodosdefaultJSONResponse) VisitListTodosResponse

func (response ListTodosdefaultJSONResponse) VisitListTodosResponse(w http.ResponseWriter) error

type Problem

type Problem struct {
	// Detail A longer human-readable explanation specific to this occurrence of the Problem.
	Detail string `json:"detail"`

	// Instance A URI reference that identifies the specific occurrence of the Problem.
	Instance *string `json:"instance,omitempty"`

	// Status The HTTP status code generated by the origin server for this occurrence of the Problem.
	Status int `json:"status"`

	// Title A short human-readable summary of the problem type.
	Title string `json:"title"`

	// Type A URI reference that identifies the problem type or class.
	Type string `json:"type"`
}

Problem An https://datatracker.ietf.org/doc/html/rfc9457 Problem response.

type Server

type Server struct {
	Database model.Modelling
}

func (*Server) CreateTodo

func (*Server) DeleteTodo

func (*Server) GetHealthZ

func (*Server) GetTodo

func (*Server) ListTodos

type ServerInterface

type ServerInterface interface {
	// Get the health status of the TODOs application
	// (GET /healthz)
	GetHealthZ(ctx echo.Context) error
	// List TODOs in the current workspace.
	// (GET /workspace/{workspaceId}/todos)
	ListTodos(ctx echo.Context, workspaceId string, params ListTodosParams) error
	// Create a new TODO in the workspace.
	// (POST /workspace/{workspaceId}/todos)
	CreateTodo(ctx echo.Context, workspaceId string) error
	// Delete a TODO item by id.
	// (DELETE /workspace/{workspaceId}/todos/{todoId})
	DeleteTodo(ctx echo.Context, workspaceId string, todoId string) error
	// Get a TODO item by id.
	// (GET /workspace/{workspaceId}/todos/{todoId})
	GetTodo(ctx echo.Context, workspaceId string, todoId string) error
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) CreateTodo

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

CreateTodo converts echo context to params.

func (*ServerInterfaceWrapper) DeleteTodo

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

DeleteTodo converts echo context to params.

func (*ServerInterfaceWrapper) GetHealthZ

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

GetHealthZ converts echo context to params.

func (*ServerInterfaceWrapper) GetTodo

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

GetTodo converts echo context to params.

func (*ServerInterfaceWrapper) ListTodos

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

ListTodos converts echo context to params.

type StandardBadRequestProblem

type StandardBadRequestProblem = Problem

StandardBadRequestProblem An https://datatracker.ietf.org/doc/html/rfc9457 Problem response.

type StandardBadRequestProblemJSONResponse

type StandardBadRequestProblemJSONResponse Problem

type StandardNotFoundProblem

type StandardNotFoundProblem = Problem

StandardNotFoundProblem An https://datatracker.ietf.org/doc/html/rfc9457 Problem response.

type StandardNotFoundProblemJSONResponse

type StandardNotFoundProblemJSONResponse Problem

type StandardProblemResponse

type StandardProblemResponse = Problem

StandardProblemResponse An https://datatracker.ietf.org/doc/html/rfc9457 Problem response.

type StandardProblemResponseJSONResponse

type StandardProblemResponseJSONResponse Problem

type StrictHandlerFunc

type StrictHandlerFunc = strictecho.StrictEchoHandlerFunc

type StrictMiddlewareFunc

type StrictMiddlewareFunc = strictecho.StrictEchoMiddlewareFunc

type StrictServerInterface

type StrictServerInterface interface {
	// Get the health status of the TODOs application
	// (GET /healthz)
	GetHealthZ(ctx context.Context, request GetHealthZRequestObject) (GetHealthZResponseObject, error)
	// List TODOs in the current workspace.
	// (GET /workspace/{workspaceId}/todos)
	ListTodos(ctx context.Context, request ListTodosRequestObject) (ListTodosResponseObject, error)
	// Create a new TODO in the workspace.
	// (POST /workspace/{workspaceId}/todos)
	CreateTodo(ctx context.Context, request CreateTodoRequestObject) (CreateTodoResponseObject, error)
	// Delete a TODO item by id.
	// (DELETE /workspace/{workspaceId}/todos/{todoId})
	DeleteTodo(ctx context.Context, request DeleteTodoRequestObject) (DeleteTodoResponseObject, error)
	// Get a TODO item by id.
	// (GET /workspace/{workspaceId}/todos/{todoId})
	GetTodo(ctx context.Context, request GetTodoRequestObject) (GetTodoResponseObject, error)
}

StrictServerInterface represents all server handlers.

type Todo

type Todo struct {
	// Details The longer rich text content of the TODO item.
	Details  *string      `json:"details,omitempty"`
	Metadata TodoMetadata `json:"metadata"`

	// Status The current status of the TODO item.
	Status string `json:"status"`

	// Title The title of the TODO item.
	Title string `json:"title"`
}

Todo defines model for Todo.

type TodoMetadata

type TodoMetadata struct {
	// CreatedAt The time that the TODO item was first created.
	CreatedAt time.Time `json:"created_at"`

	// Epoch A unique epoch for this TODO item.
	Epoch int `json:"epoch"`

	// GroupEpoch The epoch of the workspace this TODO item is tied to.
	GroupEpoch int `json:"group_epoch"`

	// GroupId The workspace this TODO item exists in
	GroupId string `json:"group_id"`

	// Id A unique identifier for this TODO item.
	Id string `json:"id"`

	// Revision A monotonic revision number associated with this TODO item.
	Revision int `json:"revision"`

	// UpdatedAt The time that the TODO item was last updated.
	UpdatedAt time.Time `json:"updated_at"`

	// WorkspaceEpoch The epoch of the workspace this TODO item is tied to.
	WorkspaceEpoch int `json:"workspace_epoch"`

	// WorkspaceId The workspace this TODO item exists in
	WorkspaceId string `json:"workspace_id"`
}

TodoMetadata defines model for TodoMetadata.

type TodoPage

type TodoPage struct {
	Items          []Todo  `json:"items"`
	NextPageToken  *string `json:"next_page_token,omitempty"`
	RemainingItems int     `json:"remaining_items"`
}

TodoPage defines model for TodoPage.

Jump to

Keyboard shortcuts

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