services

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorTTLExpired = "TTL expired"
)

Variables

View Source
var Module = fx.Module(
	"services",
	fx.Decorate(func(log *zap.Logger) *zap.Logger {
		return log.Named("services")
	}),
	fx.Provide(
		NewAuthService,
		NewMessagesService,
		NewPushService,
	),
)

Functions

This section is empty.

Types

type AuthService

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

func (*AuthService) AuthorizeDevice

func (s *AuthService) AuthorizeDevice(token string) (models.Device, error)

func (*AuthService) AuthorizeUser

func (s *AuthService) AuthorizeUser(username, password string) (models.User, error)

func (*AuthService) RegisterDevice

func (s *AuthService) RegisterDevice(userID string, name, pushToken *string) (models.Device, error)

func (*AuthService) RegisterUser

func (s *AuthService) RegisterUser(login, password string) (models.User, error)

func (*AuthService) UpdateDevice

func (s *AuthService) UpdateDevice(id, pushToken string) error

type ErrValidation

type ErrValidation string

func (ErrValidation) Error added in v1.4.0

func (e ErrValidation) Error() string

type MessagesEnqueueOptions added in v1.5.2

type MessagesEnqueueOptions struct {
	SkipPhoneValidation bool
}

type MessagesService

type MessagesService struct {
	Messages *repositories.MessagesRepository
	PushSvc  *PushService
	Logger   *zap.Logger
	// contains filtered or unexported fields
}

func NewMessagesService

func NewMessagesService(params MessagesServiceParams) *MessagesService

func (*MessagesService) Enqeue

func (*MessagesService) GetState

func (s *MessagesService) GetState(user models.User, ID string) (smsgateway.MessageState, error)

func (*MessagesService) HashProcessed added in v1.4.0

func (s *MessagesService) HashProcessed() error

func (*MessagesService) SelectPending

func (s *MessagesService) SelectPending(deviceID string) ([]smsgateway.Message, error)

func (*MessagesService) UpdateState

func (s *MessagesService) UpdateState(deviceID string, message smsgateway.MessageState) error

type MessagesServiceParams added in v1.5.1

type MessagesServiceParams struct {
	fx.In

	Messages *repositories.MessagesRepository
	PushSvc  *PushService
	Logger   *zap.Logger
}

type PushService

type PushService struct {
	Config PushServiceConfig

	Logger *zap.Logger
	// contains filtered or unexported fields
}

func NewPushService

func NewPushService(params PushServiceParams) *PushService

NewPushService creates a new PushService.

func (*PushService) Enqueue added in v1.5.1

func (s *PushService) Enqueue(ctx context.Context, token string, data map[string]string) error

Enqueue adds the data to the cache and immediately sends all messages if the debounce is 0.

func (*PushService) Run added in v1.5.1

func (s *PushService) Run(ctx context.Context)

Run runs the service with the provided context if a debounce is set.

type PushServiceConfig

type PushServiceConfig struct {
	CredentialsJSON string
	Debounce        time.Duration
	Timeout         time.Duration
}

type PushServiceParams added in v1.5.1

type PushServiceParams struct {
	fx.In

	Config PushServiceConfig
	Logger *zap.Logger
}

Jump to

Keyboard shortcuts

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