api

package
v0.0.0-...-093553d Latest Latest
Warning

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

Go to latest
Published: May 14, 2025 License: MIT Imports: 14 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.4.1 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 ContentID

type ContentID = string

ContentID コンテンツを一意に識別するID(フォーマットはUUID v7)

type ContentName

type ContentName = string

ContentName コンテンツ名

type ContentRequest

type ContentRequest struct {
	// Name コンテンツ名
	Name     ContentName      `json:"name"`
	Programs []ProgramRequest `json:"programs"`
}

ContentRequest defines model for ContentRequest.

type ContentResponse

type ContentResponse struct {
	// ContentID コンテンツを一意に識別するID(フォーマットはUUID v7)
	ContentID ContentID `json:"id"`

	// Name コンテンツ名
	Name     ContentName       `json:"name"`
	Programs []ProgramResponse `json:"programs"`
}

ContentResponse defines model for ContentResponse.

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 ErrorMessage

type ErrorMessage = string

ErrorMessage エラーメッセージ

type GetContents200JSONResponse

type GetContents200JSONResponse []ContentResponse

func (GetContents200JSONResponse) VisitGetContentsResponse

func (response GetContents200JSONResponse) VisitGetContentsResponse(w http.ResponseWriter) error

type GetContents500JSONResponse

type GetContents500JSONResponse N500InternalServerError

func (GetContents500JSONResponse) VisitGetContentsResponse

func (response GetContents500JSONResponse) VisitGetContentsResponse(w http.ResponseWriter) error

type GetContentsByID200JSONResponse

type GetContentsByID200JSONResponse ContentResponse

func (GetContentsByID200JSONResponse) VisitGetContentsByIDResponse

func (response GetContentsByID200JSONResponse) VisitGetContentsByIDResponse(w http.ResponseWriter) error

type GetContentsByID400JSONResponse

type GetContentsByID400JSONResponse N400BadRequest

func (GetContentsByID400JSONResponse) VisitGetContentsByIDResponse

func (response GetContentsByID400JSONResponse) VisitGetContentsByIDResponse(w http.ResponseWriter) error

type GetContentsByID404JSONResponse

type GetContentsByID404JSONResponse N404NotFound

func (GetContentsByID404JSONResponse) VisitGetContentsByIDResponse

func (response GetContentsByID404JSONResponse) VisitGetContentsByIDResponse(w http.ResponseWriter) error

type GetContentsByID500JSONResponse

type GetContentsByID500JSONResponse N500InternalServerError

func (GetContentsByID500JSONResponse) VisitGetContentsByIDResponse

func (response GetContentsByID500JSONResponse) VisitGetContentsByIDResponse(w http.ResponseWriter) error

type GetContentsByIDRequestObject

type GetContentsByIDRequestObject struct {
	ID ID `json:"id"`
}

type GetContentsByIDResponseObject

type GetContentsByIDResponseObject interface {
	VisitGetContentsByIDResponse(w http.ResponseWriter) error
}

type GetContentsRequestObject

type GetContentsRequestObject struct {
}

type GetContentsResponseObject

type GetContentsResponseObject interface {
	VisitGetContentsResponse(w http.ResponseWriter) error
}

type ID

type ID = ContentID

ID コンテンツを一意に識別するID(フォーマットはUUID v7)

type InquiryID

type InquiryID = string

InquiryID 問い合わせ用ID

type N400BadRequest

type N400BadRequest struct {
	// Message エラーメッセージ
	Message ErrorMessage `json:"message"`
}

N400BadRequest defines model for 400-BadRequest.

type N404NotFound

type N404NotFound struct {
	// Message エラーメッセージ
	Message *ErrorMessage `json:"message,omitempty"`
}

N404NotFound defines model for 404-NotFound.

type N500InternalServerError

type N500InternalServerError struct {
	// InquiryID 問い合わせ用ID
	InquiryID InquiryID `json:"inquiryId"`

	// Message エラーメッセージ
	Message ErrorMessage `json:"message"`
}

N500InternalServerError defines model for 500-InternalServerError.

type PostContents201JSONResponse

type PostContents201JSONResponse ContentResponse

func (PostContents201JSONResponse) VisitPostContentsResponse

func (response PostContents201JSONResponse) VisitPostContentsResponse(w http.ResponseWriter) error

type PostContents400JSONResponse

type PostContents400JSONResponse N400BadRequest

func (PostContents400JSONResponse) VisitPostContentsResponse

func (response PostContents400JSONResponse) VisitPostContentsResponse(w http.ResponseWriter) error

type PostContents500JSONResponse

type PostContents500JSONResponse N500InternalServerError

func (PostContents500JSONResponse) VisitPostContentsResponse

func (response PostContents500JSONResponse) VisitPostContentsResponse(w http.ResponseWriter) error

type PostContentsJSONRequestBody

type PostContentsJSONRequestBody = ContentRequest

PostContentsJSONRequestBody defines body for PostContents for application/json ContentType.

type PostContentsRequestObject

type PostContentsRequestObject struct {
	Body *PostContentsJSONRequestBody
}

type PostContentsResponseObject

type PostContentsResponseObject interface {
	VisitPostContentsResponse(w http.ResponseWriter) error
}

type ProgramAnswer

type ProgramAnswer = string

ProgramAnswer 解答

type ProgramID

type ProgramID = string

ProgramID 問題を一意に識別するID(フォーマットはUUID v7)

type ProgramQuestion

type ProgramQuestion = string

ProgramQuestion 問題

type ProgramRequest

type ProgramRequest struct {
	// Answer 解答
	Answer ProgramAnswer `json:"answer"`

	// Question 問題
	Question ProgramQuestion `json:"question"`
}

ProgramRequest defines model for ProgramRequest.

type ProgramResponse

type ProgramResponse struct {
	// Answer 解答
	Answer *ProgramAnswer `json:"answer,omitempty"`

	// ProgramID 問題を一意に識別するID(フォーマットはUUID v7)
	ProgramID ProgramID `json:"id"`

	// Question 問題
	Question *ProgramQuestion `json:"question,omitempty"`
}

ProgramResponse defines model for ProgramResponse.

type ServerInterface

type ServerInterface interface {
	// コンテンツ一覧取得
	// (GET /contents)
	GetContents(ctx echo.Context) error
	// コンテンツ新規登録
	// (POST /contents)
	PostContents(ctx echo.Context) error
	// 指定コンテンツ取得
	// (GET /contents/{id})
	GetContentsByID(ctx echo.Context, id ID) 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) GetContents

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

GetContents converts echo context to params.

func (*ServerInterfaceWrapper) GetContentsByID

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

GetContentsByID converts echo context to params.

func (*ServerInterfaceWrapper) PostContents

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

PostContents converts echo context to params.

type StrictHandlerFunc

type StrictHandlerFunc = strictecho.StrictEchoHandlerFunc

type StrictMiddlewareFunc

type StrictMiddlewareFunc = strictecho.StrictEchoMiddlewareFunc

type StrictServerInterface

type StrictServerInterface interface {
	// コンテンツ一覧取得
	// (GET /contents)
	GetContents(ctx context.Context, request GetContentsRequestObject) (GetContentsResponseObject, error)
	// コンテンツ新規登録
	// (POST /contents)
	PostContents(ctx context.Context, request PostContentsRequestObject) (PostContentsResponseObject, error)
	// 指定コンテンツ取得
	// (GET /contents/{id})
	GetContentsByID(ctx context.Context, request GetContentsByIDRequestObject) (GetContentsByIDResponseObject, error)
}

StrictServerInterface represents all server handlers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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