Files
gochat/internal/model/channel/api.go
T
2026-06-04 15:44:48 +08:00

25 lines
962 B
Go

package channel
import (
"time"
"github.com/gochat/gochat/internal/model"
)
// ChannelAPI represents a REST API channel configuration.
// Reference: Chatwoot Channel::Api + P2B M2 spec
type ChannelAPI struct {
ID uint `gorm:"primaryKey" json:"id"`
InboxID uint `gorm:"uniqueIndex;not null" json:"inbox_id"`
WebhookURL string `gorm:"size:512" json:"webhook_url"`
HMACToken string `gorm:"size:255" json:"hmac_token"`
Identifier string `gorm:"size:255" json:"identifier"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
Inbox model.Inbox `gorm:"foreignKey:InboxID" json:"inbox,omitempty"`
}
func (ChannelAPI) TableName() string { return "channel_api" }
func (c ChannelAPI) GetInboxID() uint { return c.InboxID }
func (c ChannelAPI) GetChannelType() model.InboxChannelType { return model.InboxChannelTypeAPI }