instance

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, searchQuery string, limit, offset int) ([]model.Instance, int, error)

func (*Service) ListByUser

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

func (*Service) ListEvents added in v1.0.11

func (s *Service) ListEvents(ctx context.Context, instanceID string, limit int) ([]model.EventLog, 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
	CallsEnabled  *bool
	OwnerUserID   string
}

UpdateInput describes a partial instance update. Nil pointer fields are preserved as-is.

Jump to

Keyboard shortcuts

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