client

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CodeSuccess = 0

Variables

This section is empty.

Functions

func Init

func Init(endpoint string)

Types

type Client

type Client interface {
	AuthMiddleware(eng gin.IRouter, config *MiddlewareConfig) gin.IRouter
	UserOperation
}

func Default

func Default() Client

func Ins

func Ins() Client

func New

func New(endpoint string) Client

type MiddlewareConfig

type MiddlewareConfig struct {
	Realm                string
	GetUserByPhoneNumber func(phoneNumber string) (repo.User, error)
	Unauthorized         func(c *gin.Context, code int, message string)
	NoRoute              func(*gin.Context)
}

type UserOperation

type UserOperation interface {
	GetRegisterCode(phoneNumber string) (string, error)
	RegisterUser(phoneNumber string, code string, data repo.User) (repo.User, error)
	GetUserById(id string) (repo.User, error)
	GetUserByPhoneNumber(phoneNumber string) (repo.User, error)
	UpdateUserById(id string, data repo.User) error
	DeleteUserById(id string) error
}

Jump to

Keyboard shortcuts

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