Documentation ¶
Index ¶
- type AccountBalanceResponse
- type CreateAccountRequest
- type CreateAccountResponse
- type CreateBillRequest
- type CreateBillResponse
- type CreateTransferRequest
- type CreateTransferResponse
- type Handler
- func (h *Handler) CreateAccount(c *fiber.Ctx) error
- func (h *Handler) CreateBill(c *fiber.Ctx) error
- func (h *Handler) CurrentUser(c *fiber.Ctx) error
- func (h *Handler) GetAccountBalance(c *fiber.Ctx) error
- func (h *Handler) Login(c *fiber.Ctx) error
- func (h *Handler) MakeTransfer(c *fiber.Ctx) error
- func (h *Handler) Register(r *fiber.App)
- func (h *Handler) SignUp(c *fiber.Ctx) error
- type UserLoginRequest
- type UserRegisterRequest
- type UserResponse
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountBalanceResponse ¶
type CreateAccountRequest ¶
type CreateAccountRequest struct {
Password string `json:"password" validate:"required"`
}
type CreateAccountResponse ¶
type CreateAccountResponse struct {
Address string `json:"address"`
}
type CreateBillRequest ¶
type CreateBillResponse ¶
type CreateTransferRequest ¶
type CreateTransferResponse ¶
type CreateTransferResponse struct {
Success bool `json:"success"`
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(us users.UserService, bs bills.BillService, ts transfers.TransferService) *Handler
func (*Handler) CreateAccount ¶
CreateAccount godoc @Summary Creates a new account @Description Creates a new account @ID create-account @Tags accounts @Accept json @Produce json @Param account body CreateAccountRequest true "Info for creating account" @Success 201 {object} CreateAccountResponse @Failure 400 {object} errors.Error @Failure 404 {objects} errors.Error @Failure 500 {objects} errors.Error @Security ApiKeyAuth @Router /api/accounts/create [post]
func (*Handler) CreateBill ¶
CreateBill godoc @Summary Creates a new bill @Description Creates a new bill @ID create-bill @Tags bills @Accept json @Produce json @Param bill body CreateBillRequest true "Info for creating bill" @Success 201 {object} CreateBillResponse @Failure 400 {object} errors.Error @Failure 404 {objects} errors.Error @Failure 500 {objects} errors.Error @Security ApiKeyAuth @Router /api/bills/create [post]
func (*Handler) CurrentUser ¶
CurrentUser godoc @Summary Get the current user @Description Gets the currently logged-in user @ID current-user @Tags user @Accept json @Produce json @Success 200 {object} UserResponse @Failure 400 {object} errors.Error @Failure 401 {object} errors.Error @Failure 422 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Security ApiKeyAuth @Router /api/user [get]
func (*Handler) GetAccountBalance ¶
GetAccountBalance godoc @Summary Get the account balance @Description Get the account balance @ID get-account-balance @Tags accounts @Accept json @Produce json @Param address path string true "address of the account balance to get" @Success 200 {object} AccountBalanceResponse @Failure 400 {object} errors.Error @Failure 500 {object} errors.Error @Security ApiKeyAuth @Router /api/accounts/{address}/balance [get]
func (*Handler) Login ¶
Login godoc @Summary Login for existing user @Description Login for existing user @ID login @Tags user @Accept json @Produce json @Param user body UserLoginRequest true "Credentials to use" @Success 200 {object} UserResponse @Failure 400 {object} errors.Error @Failure 401 {object} errors.Error @Failure 422 {object} errors.Error @Failure 404 {object} errors.Error @Failure 500 {object} errors.Error @Router /api/user/login [post]
func (*Handler) MakeTransfer ¶
MakeTransfer godoc @Summary Creates a new transfer @Description Creates a new transfer @ID create-transfer @Tags transfers @Accept json @Produce json @Param transfer body CreateTransferRequest true "Info for creating transfer" @Success 201 {object} CreateTransferResponse @Failure 400 {object} errors.Error @Failure 404 {objects} errors.Error @Failure 500 {objects} errors.Error @Security ApiKeyAuth @Router /api/transfers/make [post]
func (*Handler) SignUp ¶
SignUp godoc @Summary Register a new user @Description Register a new user @ID sign-up @Tags user @Accept json @Produce json @Param user body UserRegisterRequest true "User info for registration" @Success 201 {object} UserResponse @Failure 400 {object} errors.Error @Failure 404 {objects} errors.Error @Failure 500 {objects} errors.Error @Router /api/user/signup [post]