model

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 1 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

View Source
const (
	IdempotencyStarted   = "started"
	IdempotencyCompleted = "completed"
)

Set while the request runs, so a concurrent repeat is rejected instead of sending a second message.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIToken

type APIToken struct {
	ID         string     `json:"id"`
	Name       string     `json:"name"`
	TokenHash  string     `json:"-"`
	UserID     string     `json:"userId"`
	LastUsedAt *time.Time `json:"lastUsedAt,omitempty"`
	ExpiresAt  *time.Time `json:"expiresAt,omitempty"`
	IsActive   bool       `json:"isActive"`
	CreatedAt  time.Time  `json:"createdAt"`
	UpdatedAt  time.Time  `json:"updatedAt"`
}

type Contact added in v1.0.10

type Contact struct {
	Phone     string    `json:"phone"`
	JID       string    `json:"jid"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type EventLog

type EventLog struct {
	ID          string     `json:"id"`
	InstanceID  string     `json:"instanceId"`
	Type        string     `json:"type"`
	Payload     string     `json:"payload"`
	DeliveredAt *time.Time `json:"deliveredAt,omitempty"`
	CreatedAt   time.Time  `json:"createdAt"`
}

type HistorySyncPayloadStatus

type HistorySyncPayloadStatus string
const (
	HistorySyncPayloadPending    HistorySyncPayloadStatus = "pending"
	HistorySyncPayloadProcessing HistorySyncPayloadStatus = "processing"
	HistorySyncPayloadDone       HistorySyncPayloadStatus = "done"
	HistorySyncPayloadError      HistorySyncPayloadStatus = "error"
)

type HistorySyncStatus

type HistorySyncStatus string
const (
	HistorySyncStatusPending   HistorySyncStatus = "pending"
	HistorySyncStatusRunning   HistorySyncStatus = "running"
	HistorySyncStatusCompleted HistorySyncStatus = "completed"
	HistorySyncStatusFailed    HistorySyncStatus = "failed"
)

type IdempotencyRecord added in v1.2.0

type IdempotencyRecord struct {
	InstanceID     string    `json:"instanceId"`
	Key            string    `json:"key"`
	RequestHash    string    `json:"requestHash"`
	Status         string    `json:"status"`
	ResponseStatus int       `json:"responseStatus"`
	ResponseBody   string    `json:"responseBody"`
	CreatedAt      time.Time `json:"createdAt"`
	ExpiresAt      time.Time `json:"expiresAt"`
}

IdempotencyRecord makes a retried send safe: the first request stores its result under the caller's key, and a repeat replays it instead of sending the message to WhatsApp twice.

type Instance

type Instance struct {
	ID                   string            `json:"id"`
	Name                 string            `json:"name"`
	OwnerUserID          string            `json:"ownerUserId"`
	OwnerEmail           string            `json:"ownerEmail,omitempty"`
	WhatsAppJID          string            `json:"whatsappJid,omitempty"`
	WebhookURL           string            `json:"webhookUrl,omitempty"`
	WebhookSecret        string            `json:"-"`
	TokenHash            string            `json:"-"`
	TokenUpdatedAt       *time.Time        `json:"tokenUpdatedAt,omitempty"`
	Status               InstanceStatus    `json:"status"`
	SessionBlob          []byte            `json:"-"`
	HistorySyncStatus    HistorySyncStatus `json:"historySyncStatus"`
	HistorySyncCycleID   string            `json:"historySyncCycleId"`
	HistorySyncUpdatedAt *time.Time        `json:"historySyncUpdatedAt,omitempty"`
	// CallsEnabled installs the VoIP engine on this instance's client. Off by default
	// because the engine preaccepts every incoming call it sees.
	CallsEnabled bool      `json:"callsEnabled"`
	CreatedAt    time.Time `json:"createdAt"`
	UpdatedAt    time.Time `json:"updatedAt"`
}

type InstanceStatus

type InstanceStatus string
const (
	InstanceStatusPending      InstanceStatus = "pending"
	InstanceStatusActive       InstanceStatus = "active"
	InstanceStatusError        InstanceStatus = "error"
	InstanceStatusDisconnected InstanceStatus = "disconnected"
)

type Message

type Message struct {
	ID          string     `json:"id"`
	InstanceID  string     `json:"instanceId"`
	WhatsAppID  string     `json:"whatsappId,omitempty"`
	To          string     `json:"to"`
	Type        string     `json:"type"`
	Payload     string     `json:"payload"`
	Status      string     `json:"status"`
	DeliveredAt *time.Time `json:"deliveredAt,omitempty"`
	CreatedAt   time.Time  `json:"createdAt"`
}

type User

type User struct {
	ID           string    `json:"id"`
	Email        string    `json:"email"`
	PasswordHash string    `json:"-"`
	Role         string    `json:"role"`
	CreatedAt    time.Time `json:"createdAt"`
}

type Webhook

type Webhook struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	URL       string    `json:"url"`
	Secret    string    `json:"secret"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type WhatsappHistorySync

type WhatsappHistorySync struct {
	ID          string                   `json:"id"`
	InstanceID  string                   `json:"instanceId"`
	PayloadType string                   `json:"payloadType"`
	Payload     []byte                   `json:"payload"`
	CycleID     string                   `json:"cycleId"`
	Status      HistorySyncPayloadStatus `json:"status"`
	CreatedAt   time.Time                `json:"createdAt"`
	ProcessedAt *time.Time               `json:"processedAt"`
}

Jump to

Keyboard shortcuts

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