endpoints

package
v0.0.0-...-234d524 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func DecodeAuthUserRequest

func DecodeAuthUserRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeGetAllRequest

func DecodeGetAllRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeLoginRequest

func DecodeLoginRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeRegisterRequest

func DecodeRegisterRequest(ctx context.Context, r *http.Request) (interface{}, error)

func EncodeResponse

func EncodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error

func GetAuthToken

func GetAuthToken(r *http.Request) (string, error)

func HashPassword

func HashPassword(password string) (string, error)

func MakeAuthUserEndpoint

func MakeAuthUserEndpoint(svc service.Service) endpoint.Endpoint

func MakeGetAllEndpoint

func MakeGetAllEndpoint(svc service.Service) endpoint.Endpoint

func MakeLoginEndpoint

func MakeLoginEndpoint(svc service.Service) endpoint.Endpoint

func MakeRegisterEndpoint

func MakeRegisterEndpoint(svc service.Service) endpoint.Endpoint

Types

type AuthUserRequest

type AuthUserRequest struct {
}

type AuthUserResponse

type AuthUserResponse struct {
	User database.UserOut `json:"user,omitempty"`
}

type EndpointSet

type EndpointSet struct {
	LoginEndpoint    endpoint.Endpoint
	RegisterEndpoint endpoint.Endpoint
	GetAllEndpoint   endpoint.Endpoint
	AuthUserEndpoint endpoint.Endpoint
}

func NewEndpointSet

func NewEndpointSet(svc service.Service) EndpointSet

type GetAllRequest

type GetAllRequest struct {
}

type GetAllResponse

type GetAllResponse struct {
	Users []database.UserOut `json:"users"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	User    database.UserOut `json:"user,omitempty"`
	Token   string           `json:"token,omitempty"`
	Message string           `json:"message"`
}

type RegisterRequest

type RegisterRequest struct {
	Username string `json:"username"`
	Fullname string `json:"fullname"`
	Password string `json:"password"`
	Email    string `json:"email"`
	IsAdmin  bool   `json:"isAdmin"`
}

type RegisterResponse

type RegisterResponse struct {
	//ID uint `json:"id"`
	Username string `json:"username"`
	Message  string `json:"message"`
}

Jump to

Keyboard shortcuts

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