web

package
v0.0.0-...-354f3a1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateUserHandler

type CreateUserHandler interface {
	Handle(req CreateUserRequest) *CreateUserResponse
}

* Create users *

func NewCreateUserHandler

func NewCreateUserHandler(idm entity.IDManager, createUserUseCase usecase.CreateUserUseCase) CreateUserHandler

type CreateUserRequest

type CreateUserRequest struct {
	User *UserDetail `json:"user"`
}

* Create users *

type CreateUserResponse

type CreateUserResponse struct {
	Status ResponseStatus
	User   *UserDetail  `json:"user,omitempty"`
	Error  *ErrorResult `json:"error,omitempty"`
}

* Create users *

type DeleteUserHandler

type DeleteUserHandler interface {
	Handle(req DeleteUserRequest) *DeleteUserResponse
}

* Delete user by ID *

func NewDeleteUserHandler

func NewDeleteUserHandler(idm entity.IDManager, deleteUserUseCase usecase.DeleteUserUseCase) DeleteUserHandler

type DeleteUserRequest

type DeleteUserRequest struct {
	ID string `json:"id"`
}

* Delete user by ID *

type DeleteUserResponse

type DeleteUserResponse struct {
	Status ResponseStatus
	Error  *ErrorResult `json:"error,omitempty"`
}

* Delete user by ID *

type ErrorResult

type ErrorResult struct {
	Message string      `json:"message"`
	Details interface{} `json:"details,omitempty"`
}

type GetUserHandler

type GetUserHandler interface {
	Handle(req GetUserRequest) *GetUserResponse
}

* Get user by ID *

func NewGetUserHandler

func NewGetUserHandler(idm entity.IDManager, getUserUseCase usecase.GetUserUseCase) GetUserHandler

type GetUserRequest

type GetUserRequest struct {
	ID string `json:"id"`
}

* Get user by ID *

type GetUserResponse

type GetUserResponse struct {
	Status ResponseStatus
	User   *UserDetail  `json:"user,omitempty"`
	Error  *ErrorResult `json:"error,omitempty"`
}

* Get user by ID *

type ListUsersHandler

type ListUsersHandler interface {
	Handle() *ListUsersResponse
}

* List users *

func NewListUsersHandler

func NewListUsersHandler(listUsersUseCase usecase.ListUsersUseCase) ListUsersHandler

type ListUsersResponse

type ListUsersResponse struct {
	Status ResponseStatus
	Users  []*UserDetail `json:"users,omitempty"`
	Error  *ErrorResult  `json:"error,omitempty"`
}

* List users *

type ResponseStatus

type ResponseStatus int
const (
	// 2XX
	ResponseStatusOK        ResponseStatus = http.StatusOK
	ResponseStatusCreated   ResponseStatus = http.StatusCreated
	ResponseStatusAccepted  ResponseStatus = http.StatusAccepted
	ResponseStatusNoContent ResponseStatus = http.StatusNoContent
	// 4XX
	ResponseStatusBadRequest   ResponseStatus = http.StatusBadRequest
	ResponseStatusUnauthorized ResponseStatus = http.StatusUnauthorized
	ResponseStatusForbidden    ResponseStatus = http.StatusForbidden
	ResponseStatusNotFound     ResponseStatus = http.StatusNotFound
	ResponseStatusConflict     ResponseStatus = http.StatusConflict
	// 5XX
	ResponseStatusInternalServerError ResponseStatus = http.StatusInternalServerError
)

func (ResponseStatus) Int

func (s ResponseStatus) Int() int

func (ResponseStatus) String

func (s ResponseStatus) String() string

type UserDetail

type UserDetail struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

Jump to

Keyboard shortcuts

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