usecase

package
v0.0.0-...-8fdf812 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthCodeExpiredError int = 10001
	TokenInvalidError    int = 10002
	TokenExpiredError    int = 10003
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth interface {
	GenerateAuthCode(ctx Context, identifier string) error
	GetAuthToken(ctx Context, authCode string) (*Token, error)
	RefereshToken(ctx Context, refreshToken string) (*Token, error)
	Authenticate(ctx Context, token string) (string, error)
}

func NewAuth

func NewAuth(authCodes repository.AuthCodes, cfg *config.Config) Auth

type Context

type Context interface {
	GetLogger() logrus.FieldLogger
	GetUserID() string
	GetContext() context.Context
}

func NewContext

func NewContext(ctx context.Context) Context

type Messages

type Messages interface {
	SendMessage(ctx Context, recipientID string, text string) (*entity.Message, error)
	ListConversations(ctx Context) ([]*entity.Conversation, error)
	ListMessages(ctx Context, forConversation string) ([]*entity.Message, error)
}

func NewMessages

func NewMessages(messages repository.Messages, users repository.Users) Messages

type Token

type Token struct {
	AuthToken    string    `json:"auth_token"`
	RefreshToken string    `json:"refresh_token"`
	ExpiresAt    time.Time `json:"expires_at"`
}

type UsecaseError

type UsecaseError struct {
	ErrorCode int
	Message   string
}

func GetUsecaseError

func GetUsecaseError(err error) *UsecaseError

func (*UsecaseError) Error

func (u *UsecaseError) Error() string

type Users

type Users interface {
	CreateUser(ctx Context, firstName string, lastName string) (*entity.User, error)
}

func NewUsers

func NewUsers(repo repository.Users) Users

Jump to

Keyboard shortcuts

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