instance

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidName = errors.New("nome da instância inválido")

Functions

This section is empty.

Types

type CreateInput

type CreateInput struct {
	Name          string
	WebhookURL    string
	WebhookSecret string
	OwnerUserID   string
}

type Service

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

func NewService

func NewService(repo storage.InstanceRepository) *Service

func NewServiceWithSession

func NewServiceWithSession(repo storage.InstanceRepository, session SessionManager) *Service

func NewServiceWithSessionAndMessages

func NewServiceWithSessionAndMessages(repo storage.InstanceRepository, messageRepo storage.MessageRepository, session SessionManager) *Service

func NewServiceWithSessionMessagesAndEventLogs

func NewServiceWithSessionMessagesAndEventLogs(repo storage.InstanceRepository, messageRepo storage.MessageRepository, eventLogRepo storage.EventLogRepository, session SessionManager) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, input CreateInput) (model.Instance, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

func (*Service) DeleteByUser

func (s *Service) DeleteByUser(ctx context.Context, id string, userID string, userRole string) error

func (*Service) Disconnect

func (s *Service) Disconnect(ctx context.Context, id string) error

func (*Service) DisconnectByUser

func (s *Service) DisconnectByUser(ctx context.Context, id string, userID string, userRole string) error

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (model.Instance, error)

func (*Service) GetByUser

func (s *Service) GetByUser(ctx context.Context, id string, userID string, userRole string) (model.Instance, error)

func (*Service) GetQR

func (s *Service) GetQR(ctx context.Context, id string) (string, error)

func (*Service) GetQRByUser

func (s *Service) GetQRByUser(ctx context.Context, id string, userID string, userRole string) (string, error)

func (*Service) List

func (s *Service) List(ctx context.Context) ([]model.Instance, error)

func (*Service) ListByUser

func (s *Service) ListByUser(ctx context.Context, userID string, userRole string) ([]model.Instance, error)

func (*Service) RotateToken

func (s *Service) RotateToken(ctx context.Context, id string) (string, error)

func (*Service) RotateTokenByUser

func (s *Service) RotateTokenByUser(ctx context.Context, id string, userID string, userRole string) (string, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, id string, input UpdateInput) (model.Instance, error)

func (*Service) UpdateByUser

func (s *Service) UpdateByUser(ctx context.Context, id string, input UpdateInput) (model.Instance, error)

func (*Service) UpdateStatus

func (s *Service) UpdateStatus(ctx context.Context, id string, status model.InstanceStatus) (model.Instance, error)

type SessionManager

type SessionManager interface {
	CreateSession(ctx context.Context, instanceID string) (string, error)
	GetQR(ctx context.Context, instanceID string) (string, error)
	RestoreSession(ctx context.Context, instanceID string, encryptedBlob []byte) error
	Disconnect(instanceID string) error
	DeleteSession(instanceID string) error
	SaveSessionBlob(instanceID string) ([]byte, error)
}

type UpdateInput

type UpdateInput struct {
	Name          string
	WebhookURL    string
	WebhookSecret string
	OwnerUserID   string
}

Jump to

Keyboard shortcuts

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