port

package
v0.0.0-...-ae0e7a4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package port contains the HTTP server and gRPC server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(srv *HTTPServer, auth *middleware.Authenticator) *chi.Mux

NewRouter returns a new chi.Mux

Types

type CreateUserParams

type CreateUserParams struct {
	Payload *NewUserPayload `json:"payload"`
}

CreateUserParams ...

func (*CreateUserParams) Bind

func (cup *CreateUserParams) Bind(_ *http.Request) error

Bind validate create user request

type CreateUserResponse

type CreateUserResponse struct {
	Payload *UserPayload `json:"payload"`
	Barcode string       `json:"otp_barcode"`
	URL     string       `json:"otp_url"`
	Elapsed int64        `json:"elapsed"`
}

CreateUserResponse ...

type DeleteUserResponse

type DeleteUserResponse struct {
	Message string `json:"message"`
}

DeleteUserResponse ...

type ErrResponse

type ErrResponse struct {
	Code    int    `json:"code"`
	Field   string `json:"field"`
	Message string `json:"message"`
}

ErrResponse ...

type GetUserResponse

type GetUserResponse struct {
	Payload *UserPayload `json:"payload"`
	Elapsed int64        `json:"elapsed"`
}

GetUserResponse

type HTTPServer

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

HTTPServer exposed http endpoints

func NewHTTPServer

func NewHTTPServer(log *zap.Logger, authService *domain.AuthService, privateKey *rsa.PrivateKey) (*HTTPServer, error)

NewHTTPServer returns a new HTTPServer

type LoginParams

type LoginParams struct {
	Payload *LoginPayload `json:"payload"`
}

LoginParams ...

func (*LoginParams) Bind

func (lp *LoginParams) Bind(_ *http.Request) error

Bind validate login request

type LoginPayload

type LoginPayload struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

LoginPayload ...

type LoginResponse

type LoginResponse struct {
	Elapsed int64 `json:"elapsed"`
}

LoginResponse ...

type NewUserPayload

type NewUserPayload struct {
	Email     string `json:"email"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Password  string `json:"password"`
}

NewUserPayload ...

type UpdateUerPaylod

type UpdateUerPaylod struct {
	Email     string `json:"email"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
}

UpdateUerPaylod ...

type UpdateUserParams

type UpdateUserParams struct {
	Payload *UpdateUerPaylod `json:"payload"`
}

UpdateUserParams ...

func (*UpdateUserParams) Bind

func (uup *UpdateUserParams) Bind(_ *http.Request) error

Bind validate update user request

type UpdateUserPasswordParams

type UpdateUserPasswordParams struct {
	Payload *UpdateUserPasswordPayload `json:"payload"`
}

UpdateUserPasswordParams ...

func (*UpdateUserPasswordParams) Bind

func (uupp *UpdateUserPasswordParams) Bind(_ *http.Request) error

Bind validate update user password request

type UpdateUserPasswordPayload

type UpdateUserPasswordPayload struct {
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

UpdateUserPasswordPayload ...

type UpdateUserPasswordResponse

type UpdateUserPasswordResponse struct {
	Message string `json:"message"`
}

UpdateUserPasswordResponse ...

type UpdateUserResponse

type UpdateUserResponse struct {
	Payload *UserPayload `json:"payload"`
}

UpdateUserResponse ...

type UserPayload

type UserPayload struct {
	Email     string `json:"email"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

UserPayload ...

type VerifyTOTPParams

type VerifyTOTPParams struct {
	Payload *VerifyTOTPPayload `json:"payload"`
}

VerifyTOTPParams ...

func (*VerifyTOTPParams) Bind

func (vtp *VerifyTOTPParams) Bind(_ *http.Request) error

Bind validate verify totp request

type VerifyTOTPPayload

type VerifyTOTPPayload struct {
	OTPCode string `json:"otp_code"`
}

VerifyTOTPPayload ...

type VerifyTOTPResponse

type VerifyTOTPResponse struct {
	Message string `json:"message"`
	Elapsed int64  `json:"elapsed"`
}

VerifyTOTPResponse ...

Jump to

Keyboard shortcuts

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