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 ContentPartialNameQuery

type ContentPartialNameQuery = ContentName

ContentPartialNameQuery コンテンツ名

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 CourseID

type CourseID = string

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

type CourseLevel

type CourseLevel string

CourseLevel コースレベル

const (
	High   CourseLevel = "high"
	Low    CourseLevel = "low"
	Middle CourseLevel = "middle"
)

Defines values for CourseLevel.

type CourseLevelQuery

type CourseLevelQuery = CourseLevel

CourseLevelQuery コースレベル

type CourseName

type CourseName = string

CourseName コース名

type CourseRequest

type CourseRequest struct {
	// Level コースレベル
	Level CourseLevel `json:"level"`

	// Name コース名
	Name CourseName `json:"name"`
}

CourseRequest defines model for CourseRequest.

type CourseResponse

type CourseResponse struct {
	// CourseID コースを一意に識別するID(フォーマットはUUID v7)
	CourseID CourseID `json:"id"`

	// Level コースレベル
	Level CourseLevel `json:"level"`

	// Name コース名
	Name CourseName `json:"name"`
}

CourseResponse defines model for CourseResponse.

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 {
	ContentID ContentID `json:"id"`
}

type GetContentsByIDResponseObject

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

type GetContentsParams

type GetContentsParams struct {
	// PartialName コンテンツ名の部分一致検索用文字列
	PartialName *ContentPartialNameQuery `form:"partialName,omitempty" json:"partialName,omitempty"`
}

GetContentsParams defines parameters for GetContents.

type GetContentsRequestObject

type GetContentsRequestObject struct {
	Params GetContentsParams
}

type GetContentsResponseObject

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

type GetCourses200JSONResponse

type GetCourses200JSONResponse []CourseResponse

func (GetCourses200JSONResponse) VisitGetCoursesResponse

func (response GetCourses200JSONResponse) VisitGetCoursesResponse(w http.ResponseWriter) error

type GetCourses400JSONResponse

type GetCourses400JSONResponse N400BadRequest

func (GetCourses400JSONResponse) VisitGetCoursesResponse

func (response GetCourses400JSONResponse) VisitGetCoursesResponse(w http.ResponseWriter) error

type GetCourses500JSONResponse

type GetCourses500JSONResponse N500InternalServerError

func (GetCourses500JSONResponse) VisitGetCoursesResponse

func (response GetCourses500JSONResponse) VisitGetCoursesResponse(w http.ResponseWriter) error

type GetCoursesParams

type GetCoursesParams struct {
	// CourseLevel コースレベル一致検索用文字列
	CourseLevel *CourseLevelQuery `form:"courseLevel,omitempty" json:"courseLevel,omitempty"`
}

GetCoursesParams defines parameters for GetCourses.

type GetCoursesRequestObject

type GetCoursesRequestObject struct {
	Params GetCoursesParams
}

type GetCoursesResponseObject

type GetCoursesResponseObject interface {
	VisitGetCoursesResponse(w http.ResponseWriter) error
}

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 PostCourses201JSONResponse

type PostCourses201JSONResponse CourseResponse

func (PostCourses201JSONResponse) VisitPostCoursesResponse

func (response PostCourses201JSONResponse) VisitPostCoursesResponse(w http.ResponseWriter) error

type PostCourses400JSONResponse

type PostCourses400JSONResponse N400BadRequest

func (PostCourses400JSONResponse) VisitPostCoursesResponse

func (response PostCourses400JSONResponse) VisitPostCoursesResponse(w http.ResponseWriter) error

type PostCourses500JSONResponse

type PostCourses500JSONResponse N500InternalServerError

func (PostCourses500JSONResponse) VisitPostCoursesResponse

func (response PostCourses500JSONResponse) VisitPostCoursesResponse(w http.ResponseWriter) error

type PostCoursesJSONRequestBody

type PostCoursesJSONRequestBody = CourseRequest

PostCoursesJSONRequestBody defines body for PostCourses for application/json ContentType.

type PostCoursesRequestObject

type PostCoursesRequestObject struct {
	Body *PostCoursesJSONRequestBody
}

type PostCoursesResponseObject

type PostCoursesResponseObject interface {
	VisitPostCoursesResponse(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"`

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

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

ProgramResponse defines model for ProgramResponse.

type ServerInterface

type ServerInterface interface {
	// コンテンツ一覧取得
	// (GET /contents)
	GetContents(ctx echo.Context, params GetContentsParams) error
	// コンテンツ新規登録
	// (POST /contents)
	PostContents(ctx echo.Context) error
	// 指定コンテンツ取得
	// (GET /contents/{id})
	GetContentsByID(ctx echo.Context, contentID ContentID) error
	// コース一覧取得
	// (GET /courses)
	GetCourses(ctx echo.Context, params GetCoursesParams) error
	// コース新規登録
	// (POST /courses)
	PostCourses(ctx echo.Context) 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) GetCourses

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

GetCourses converts echo context to params.

func (*ServerInterfaceWrapper) PostContents

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

PostContents converts echo context to params.

func (*ServerInterfaceWrapper) PostCourses

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

PostCourses 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)
	// コース一覧取得
	// (GET /courses)
	GetCourses(ctx context.Context, request GetCoursesRequestObject) (GetCoursesResponseObject, error)
	// コース新規登録
	// (POST /courses)
	PostCourses(ctx context.Context, request PostCoursesRequestObject) (PostCoursesResponseObject, 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