Documentation ¶
Index ¶
- Constants
- Variables
- type AuthService
- func (s *AuthService) AuthorizeDevice(token string) (models.Device, error)
- func (s *AuthService) AuthorizeUser(username, password string) (models.User, error)
- func (s *AuthService) RegisterDevice(userID string, name, pushToken *string) (models.Device, error)
- func (s *AuthService) RegisterUser(login, password string) (models.User, error)
- func (s *AuthService) UpdateDevice(id, pushToken string) error
- type ErrValidation
- type MessagesEnqueueOptions
- type MessagesService
- func (s *MessagesService) Enqeue(device models.Device, message smsgateway.Message, opts MessagesEnqueueOptions) (smsgateway.MessageState, error)
- func (s *MessagesService) GetState(user models.User, ID string) (smsgateway.MessageState, error)
- func (s *MessagesService) HashProcessed() error
- func (s *MessagesService) SelectPending(deviceID string) ([]smsgateway.Message, error)
- func (s *MessagesService) UpdateState(deviceID string, message smsgateway.MessageState) error
- type MessagesServiceParams
- type PushService
- type PushServiceConfig
- type PushServiceParams
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 NewAuthService ¶
func NewAuthService(users *repositories.UsersRepository, devices *repositories.DevicesRepository) *AuthService
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 (*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 (s *MessagesService) Enqeue(device models.Device, message smsgateway.Message, opts MessagesEnqueueOptions) (smsgateway.MessageState, error)
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
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 PushServiceParams ¶ added in v1.5.1
type PushServiceParams struct { fx.In Config PushServiceConfig Logger *zap.Logger }
Click to show internal directories.
Click to hide internal directories.