handler

package
v0.0.0-...-54f9ae5 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalanceResponse

type AccountBalanceResponse struct {
	Address     string `json:"address"`
	BalanceFiat string `json:"balanceFiat"`
	BalanceETH  string `json:"balanceETH"`
}

type CreateAccountRequest

type CreateAccountRequest struct {
	Password string `json:"password" validate:"required"`
}

type CreateAccountResponse

type CreateAccountResponse struct {
	Address string `json:"address"`
}

type CreateBillRequest

type CreateBillRequest struct {
	Address  string   `json:"address" validate:"required"`
	Payers   []string `json:"payers" validate:"required"`
	Amount   float64  `json:"amount" validate:"required"`
	Password string   `json:"password" validate:"required"`
}

type CreateBillResponse

type CreateBillResponse struct {
	BillAddress     string `json:"billAddress"`
	TransactionHash string `json:"transactionHash"`
	Success         bool   `json:"success"`
}

type CreateTransferRequest

type CreateTransferRequest struct {
	FromAddress string  `json:"fromAddress" validate:"required"`
	ToAddress   string  `json:"toAddress" validate:"required"`
	Amount      float64 `json:"amount" validate:"required"`
	Password    string  `json:"password" validate:"required"`
}

type CreateTransferResponse

type CreateTransferResponse struct {
	Success bool `json:"success"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func (*Handler) CreateAccount

func (h *Handler) CreateAccount(c *fiber.Ctx) error

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

func (h *Handler) CreateBill(c *fiber.Ctx) error

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

func (h *Handler) CurrentUser(c *fiber.Ctx) error

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

func (h *Handler) GetAccountBalance(c *fiber.Ctx) error

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

func (h *Handler) Login(c *fiber.Ctx) error

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

func (h *Handler) MakeTransfer(c *fiber.Ctx) error

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) Register

func (h *Handler) Register(r *fiber.App)

func (*Handler) SignUp

func (h *Handler) SignUp(c *fiber.Ctx) error

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]

type UserLoginRequest

type UserLoginRequest struct {
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required"`
}

type UserRegisterRequest

type UserRegisterRequest struct {
	Username string `json:"username" validate:"required"`
	Email    string `json: "email" validate:"required, email"`
	Password string `json:"password" validate:"required"`
}

type UserResponse

type UserResponse struct {
	Username string  `json:"username"`
	Email    string  `json:"email"`
	Image    *string `json:"image"`
	Token    string  `json:"token"`
}

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator() *Validator

func (*Validator) Validate

func (v *Validator) Validate(i interface{}) error

Jump to

Keyboard shortcuts

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