rest

package
v0.0.0-...-1ce29ab Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2022 License: Unlicense Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(log *logrus.Logger, provider TokenProvider, store ProfileStore, host, version string) chi.Router

Types

type JSONResponse

type JSONResponse struct {
	Data  interface{} `json:"data,omitempty"`
	Meta  *Meta       `json:"meta,omitempty"`
	Error *string     `json:"error,omitempty"`
	Code  *int        `json:"code,omitempty"`
}

type Meta

type Meta struct {
	Count int `json:"count"`
}

type ProfileStore

type ProfileStore interface {
	GetUser(ctx context.Context, phone string) (*models.User, error)
	UpsertUser(ctx context.Context, user *models.User) error
}

type TokenProvider

type TokenProvider interface {
	StartAuthentication(ctx context.Context, user *models.User) error
	SignIn(ctx context.Context, user *models.User, code string) (string, error)
	ParseToken(accessToken string) (string, error)
	GetToken(uuid string) (string, error)
}

Jump to

Keyboard shortcuts

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