1
0
api/ent/ogent/oas_server_gen.go
2023-04-06 12:39:26 +09:00

151 lines
4.5 KiB
Go

// Code generated by ogen, DO NOT EDIT.
package ogent
import (
"context"
)
// Handler handles operations described by OpenAPI v3 specification.
type Handler interface {
// CreateCard implements createCard operation.
//
// Creates a new Card and persists it to storage.
//
// POST /cards
CreateCard(ctx context.Context, req *CreateCardReq) (CreateCardRes, error)
// CreateGroup implements createGroup operation.
//
// Creates a new Group and persists it to storage.
//
// POST /groups
CreateGroup(ctx context.Context, req *CreateGroupReq) (CreateGroupRes, error)
// CreateUser implements createUser operation.
//
// Creates a new User and persists it to storage.
//
// POST /users
CreateUser(ctx context.Context, req *CreateUserReq) (CreateUserRes, error)
// DeleteCard implements deleteCard operation.
//
// Deletes the Card with the requested ID.
//
// DELETE /cards/{id}
DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error)
// DeleteGroup implements deleteGroup operation.
//
// Deletes the Group with the requested ID.
//
// DELETE /groups/{id}
DeleteGroup(ctx context.Context, params DeleteGroupParams) (DeleteGroupRes, error)
// DeleteUser implements deleteUser operation.
//
// Deletes the User with the requested ID.
//
// DELETE /users/{id}
DeleteUser(ctx context.Context, params DeleteUserParams) (DeleteUserRes, error)
// DrawDone implements drawDone operation.
//
// Draws a card item as done.
//
// PUT /cards/{id}/d
DrawDone(ctx context.Context, params DrawDoneParams) error
// DrawStart implements drawStart operation.
//
// Draws a card item as done.
//
// PATCH /users/{id}/card/start
DrawStart(ctx context.Context, params DrawStartParams) error
// ListCard implements listCard operation.
//
// List Cards.
//
// GET /cards
ListCard(ctx context.Context, params ListCardParams) (ListCardRes, error)
// ListGroup implements listGroup operation.
//
// List Groups.
//
// GET /groups
ListGroup(ctx context.Context, params ListGroupParams) (ListGroupRes, error)
// ListGroupUsers implements listGroupUsers operation.
//
// List attached Users.
//
// GET /groups/{id}/users
ListGroupUsers(ctx context.Context, params ListGroupUsersParams) (ListGroupUsersRes, error)
// ListUser implements listUser operation.
//
// List Users.
//
// GET /users
ListUser(ctx context.Context, params ListUserParams) (ListUserRes, error)
// ListUserCard implements listUserCard operation.
//
// List attached Cards.
//
// GET /users/{id}/card
ListUserCard(ctx context.Context, params ListUserCardParams) (ListUserCardRes, error)
// ReadCard implements readCard operation.
//
// Finds the Card with the requested ID and returns it.
//
// GET /cards/{id}
ReadCard(ctx context.Context, params ReadCardParams) (ReadCardRes, error)
// ReadCardOwner implements readCardOwner operation.
//
// Find the attached User of the Card with the given ID.
//
// GET /cards/{id}/owner
ReadCardOwner(ctx context.Context, params ReadCardOwnerParams) (ReadCardOwnerRes, error)
// ReadGroup implements readGroup operation.
//
// Finds the Group with the requested ID and returns it.
//
// GET /groups/{id}
ReadGroup(ctx context.Context, params ReadGroupParams) (ReadGroupRes, error)
// ReadUser implements readUser operation.
//
// Finds the User with the requested ID and returns it.
//
// GET /users/{id}
ReadUser(ctx context.Context, params ReadUserParams) (ReadUserRes, error)
// UpdateCard implements updateCard operation.
//
// Updates a Card and persists changes to storage.
//
// PATCH /cards/{id}
UpdateCard(ctx context.Context, req *UpdateCardReq, params UpdateCardParams) (UpdateCardRes, error)
// UpdateGroup implements updateGroup operation.
//
// Updates a Group and persists changes to storage.
//
// PATCH /groups/{id}
UpdateGroup(ctx context.Context, req *UpdateGroupReq, params UpdateGroupParams) (UpdateGroupRes, error)
// UpdateUser implements updateUser operation.
//
// Updates a User and persists changes to storage.
//
// PATCH /users/{id}
UpdateUser(ctx context.Context, req *UpdateUserReq, params UpdateUserParams) (UpdateUserRes, error)
}
// Server implements http server based on OpenAPI v3 specification and
// calls Handler to handle requests.
type Server struct {
h Handler
baseServer
}
// NewServer creates new Server.
func NewServer(h Handler, opts ...ServerOption) (*Server, error) {
s, err := newServerConfig(opts...).baseServer()
if err != nil {
return nil, err
}
return &Server{
h: h,
baseServer: s,
}, nil
}