databag/net/server/internal/models.go

568 lines
11 KiB
Go
Raw Normal View History

2022-01-15 21:28:28 +00:00
package databag
2022-07-23 05:47:09 +00:00
//AccountProfile account profile view retrieved by admin
2022-03-10 05:19:05 +00:00
type AccountProfile struct {
2022-07-22 23:10:19 +00:00
AccountID uint32 `json:"accountId"`
2022-02-08 20:24:42 +00:00
2022-07-22 19:28:14 +00:00
GUID string `json:"guid"`
2022-02-08 20:24:42 +00:00
2022-07-22 19:28:14 +00:00
Handle string `json:"handle,omitempty"`
2022-03-10 05:19:05 +00:00
2022-07-22 19:28:14 +00:00
Name string `json:"name,omitempty"`
2022-03-10 05:19:05 +00:00
2022-07-22 19:28:14 +00:00
Description string `json:"description,omitempty"`
2022-03-10 05:19:05 +00:00
2022-07-22 19:28:14 +00:00
Location string `json:"location,omitempty"`
2022-03-10 05:19:05 +00:00
2022-07-22 19:28:14 +00:00
ImageSet bool `json:"imageSet,omitempty"`
2022-02-08 20:24:42 +00:00
Seal string `json:"seal,emitempty"`
2022-01-15 21:28:28 +00:00
Disabled bool `json:"disabled"`
2023-07-11 05:15:02 +00:00
StorageUsed int64 `json:"storageUsed"`
2022-01-15 21:28:28 +00:00
}
2022-07-23 05:47:09 +00:00
//AccountStatus server settings for account
2022-01-15 21:28:28 +00:00
type AccountStatus struct {
Disabled bool `json:"disabled"`
2022-02-08 20:24:42 +00:00
2022-03-08 21:31:04 +00:00
StorageUsed int64 `json:"storageUsed"`
2022-02-08 20:24:42 +00:00
2022-03-08 21:31:04 +00:00
StorageAvailable int64 `json:"storageAvailable"`
2022-01-15 21:28:28 +00:00
2022-02-08 20:24:42 +00:00
ForwardingAddress string `json:"forwardingAddress"`
2022-03-07 23:03:24 +00:00
Searchable bool `json:"searchable"`
PushEnabled bool `json:"pushEnabled"`
Sealable bool `json:"sealable"`
Seal *Seal `json:"seal,omitempty"`
2023-04-13 07:39:14 +00:00
EnableIce bool `json:"enableIce"`
2022-01-15 21:34:10 +00:00
}
2022-07-23 05:47:09 +00:00
//Announce initial message sent on websocket
2022-01-15 21:34:10 +00:00
type Announce struct {
AppToken string `json:"appToken"`
}
//Notification describes type of notifications to receive
type Notification struct {
Event string `json:"event,omitempty"`
2022-02-08 20:24:42 +00:00
MessageTitle string `json:"messageTitle,omitempty"`
2022-01-15 21:34:10 +00:00
MessageBody string `json:"messageBoday,omitempty"`
2022-01-28 07:01:17 +00:00
}
2022-07-23 05:47:09 +00:00
//Article slot for account data shared by group list
2022-01-15 21:34:10 +00:00
type Article struct {
ID string `json:"id"`
2022-02-08 20:24:42 +00:00
Revision int64 `json:"revision"`
Data *ArticleData `json:"data"`
}
2022-07-23 05:47:09 +00:00
//ArticleData account data shared by group list
type ArticleData struct {
2022-02-08 20:24:42 +00:00
DataType string `json:"dataType"`
2022-01-15 21:34:10 +00:00
Data string `json:"data"`
2022-02-08 20:24:42 +00:00
2022-01-18 08:40:39 +00:00
Created int64 `json:"created"`
2022-02-08 20:24:42 +00:00
2022-01-28 07:01:17 +00:00
Updated int64 `json:"updated"`
2022-02-08 20:24:42 +00:00
Groups *IDList `json:"groups,omitempty"`
2022-01-28 22:37:35 +00:00
}
2022-07-23 05:47:09 +00:00
//Asset files associated with channel topic
2022-01-15 21:49:28 +00:00
type Asset struct {
2022-07-22 23:10:19 +00:00
AssetID string `json:"assetId"`
2022-02-08 20:24:42 +00:00
2022-01-15 21:49:28 +00:00
Transform string `json:"transform,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 21:49:28 +00:00
Status string `json:"status,omitempty"`
}
2022-07-23 05:47:09 +00:00
//Card slot for references to an account contact
2022-01-15 21:49:28 +00:00
type Card struct {
ID string `json:"id"`
2022-02-08 20:24:42 +00:00
Revision int64 `json:"revision"`
Data *CardData `json:"data"`
2022-02-03 06:13:46 +00:00
}
2022-07-23 05:47:09 +00:00
//CardData account contact data
2022-02-03 06:13:46 +00:00
type CardData struct {
DetailRevision int64 `json:"detailRevision"`
2022-02-08 20:24:42 +00:00
ProfileRevision int64 `json:"profileRevision"`
2022-02-08 20:24:42 +00:00
NotifiedProfile int64 `json:"notifiedProfile"`
2022-02-08 20:24:42 +00:00
NotifiedArticle int64 `json:"notifiedArticle"`
NotifiedChannel int64 `json:"notifiedChannel"`
NotifiedView int64 `json:"notifiedView"`
2022-02-08 20:24:42 +00:00
CardDetail *CardDetail `json:"cardDetail,omitempty"`
CardProfile *CardProfile `json:"cardProfile,omitempty"`
}
2022-07-23 05:47:09 +00:00
//CardDetail values set for associated contact
type CardDetail struct {
2022-02-08 20:24:42 +00:00
Status string `json:"status"`
2022-08-13 14:01:13 +00:00
StatusUpdated int64 `json:"statusUpdated"`
Token string `json:"token,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 21:49:28 +00:00
Notes string `json:"notes,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 21:49:28 +00:00
Groups []string `json:"groups,omitempty"`
}
2022-01-15 21:34:10 +00:00
2022-07-23 05:47:09 +00:00
//CardProfile profile for account contact
2022-01-15 21:49:28 +00:00
type CardProfile struct {
GUID string `json:"guid"`
2022-02-08 20:24:42 +00:00
2022-01-15 21:49:28 +00:00
Handle string `json:"handle,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 21:49:28 +00:00
Name string `json:"name,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 21:49:28 +00:00
Description string `json:"description,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 21:49:28 +00:00
Location string `json:"location,omitempty"`
2022-02-08 20:24:42 +00:00
2022-04-03 21:26:04 +00:00
ImageSet bool `json:"imageSet"`
2022-02-08 20:24:42 +00:00
Seal string `json:"seal,omitempty"`
2022-02-08 20:24:42 +00:00
Version string `json:"version,omitempty"`
2022-01-15 21:49:28 +00:00
Node string `json:"node"`
}
2022-07-23 05:47:09 +00:00
//ChannelContacts ids for cards and groups with whom channel is shared
2022-03-07 23:03:24 +00:00
type ChannelContacts struct {
Groups []string `json:"groups"`
Cards []string `json:"cards"`
}
2022-07-23 05:47:09 +00:00
//Channel slot for communication channel
2022-02-08 20:24:42 +00:00
type Channel struct {
ID string `json:"id"`
2022-01-15 21:54:04 +00:00
2022-02-15 22:30:04 +00:00
Revision int64 `json:"revision"`
2022-02-08 20:24:42 +00:00
Data *ChannelData `json:"data"`
2022-01-15 21:54:04 +00:00
}
2022-07-23 05:47:09 +00:00
//ChannelData communication channel data
2022-02-08 20:24:42 +00:00
type ChannelData struct {
DetailRevision int64 `json:"detailRevision"`
2022-07-22 19:28:14 +00:00
TopicRevision int64 `json:"topicRevision"`
2022-05-09 21:08:54 +00:00
ChannelSummary *ChannelSummary `json:"channelSummary,omitempty"`
2022-02-08 20:24:42 +00:00
ChannelDetail *ChannelDetail `json:"channelDetail,omitempty"`
2022-02-03 07:48:17 +00:00
}
2022-07-23 05:47:09 +00:00
//ChannelDetail description of channel
2022-02-08 20:24:42 +00:00
type ChannelDetail struct {
2022-01-25 05:22:33 +00:00
DataType string `json:"dataType"`
2022-02-08 20:24:42 +00:00
2022-01-15 21:57:08 +00:00
Data string `json:"data"`
2022-02-08 20:24:42 +00:00
2022-01-18 08:40:39 +00:00
Created int64 `json:"created"`
2022-02-08 20:24:42 +00:00
2022-01-25 05:22:33 +00:00
Updated int64 `json:"updated"`
2022-02-08 20:24:42 +00:00
EnableImage bool `json:"enableImage"`
EnableAudio bool `json:"enableAudio"`
EnableVideo bool `json:"enableVideo"`
2022-03-07 23:03:24 +00:00
Contacts *ChannelContacts `json:"contacts,omitempty"`
2022-02-08 20:24:42 +00:00
2022-04-09 08:36:03 +00:00
Members []string `json:"members"`
2022-03-07 23:03:24 +00:00
}
//ChannelMember contact member of channel
type ChannelMember struct {
Member string `json:"member"`
PushEnabled bool `json:"pushEnabled"`
}
2022-07-23 05:47:09 +00:00
//ChannelSummary latest topic posted on channel
2022-05-09 21:08:54 +00:00
type ChannelSummary struct {
LastTopic *TopicDetail `json:"lastTopic,omitempty"`
}
2022-07-23 05:47:09 +00:00
//ChannelParams params used when creating a channel
2022-03-07 23:03:24 +00:00
type ChannelParams struct {
2022-04-06 21:02:18 +00:00
DataType string `json:"dataType"`
Data string `json:"data"`
2022-03-07 23:03:24 +00:00
Groups []string `json:"groups"`
2022-02-08 20:24:42 +00:00
2022-03-07 23:03:24 +00:00
Cards []string `json:"cards"`
2022-02-08 20:24:42 +00:00
}
2022-07-23 05:47:09 +00:00
//Claim token to verify for 3rd party authentication
2022-02-08 20:24:42 +00:00
type Claim struct {
Token string `json:"token"`
}
2022-07-23 05:47:09 +00:00
//Connect data exchanged in a contact connection message
2022-02-08 20:24:42 +00:00
type Connect struct {
Contact string `json:"contact"`
Token string `json:"token"`
ViewRevision int64 `json:"viewRevision,omitempty"`
ArticleRevision int64 `json:"articleRevision,omitempty"`
ProfileRevision int64 `json:"profileRevision,omitempty"`
ChannelRevision int64 `json:"channelRevision,omitempty"`
2022-07-22 19:28:14 +00:00
Handle string `json:"handle,omitempty"`
2022-02-08 20:24:42 +00:00
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Location string `json:"location,omitempty"`
Image string `json:"image,omitempty"`
Version string `json:"version,omitempty"`
Seal string `json:"seal,omitempty"`
2022-02-08 20:24:42 +00:00
Node string `json:"node,omitempty"`
2022-01-15 21:57:08 +00:00
}
2022-07-23 05:47:09 +00:00
//ContactStatus status of contact returned after connection message
2022-02-08 20:24:42 +00:00
type ContactStatus struct {
Token string `json:"token,omitempty"`
ProfileRevision int64 `json:"profileRevision,omitempty"`
ArticleRevision int64 `json:"articleRevision,omitempty"`
ChannelRevision int64 `json:"channelRevision,omitempty"`
ViewRevision int64 `json:"viewRevision,omitempty"`
2022-01-15 21:59:26 +00:00
Status string `json:"status"`
}
2022-07-23 05:47:09 +00:00
//DataMessage general structure holding signed messages
2022-02-08 20:24:42 +00:00
type DataMessage struct {
Message string `json:"message"`
KeyType string `json:"keyType"`
PublicKey string `json:"publicKey"`
Signature string `json:"signature"`
SignatureType string `json:"signatureType"`
}
2022-07-23 05:47:09 +00:00
//Disconnect data exchanged when closing connection
2022-02-08 20:24:42 +00:00
type Disconnect struct {
Contact string `json:"contact"`
}
2022-07-23 05:47:09 +00:00
//Group slot for holding a contact group alias
2022-02-08 20:24:42 +00:00
type Group struct {
ID string `json:"id"`
2022-02-08 20:24:42 +00:00
Revision int64 `json:"revision"`
Data *GroupData `json:"data,omitempty"`
2022-01-15 21:59:26 +00:00
}
2022-07-23 05:47:09 +00:00
//GroupData a contact group alias
2022-02-08 20:24:42 +00:00
type GroupData struct {
DataType string `json:"dataType"`
2022-01-15 21:59:26 +00:00
Data string `json:"data"`
2022-02-08 20:24:42 +00:00
2022-02-03 07:48:17 +00:00
Created int64 `json:"created"`
2022-02-08 20:24:42 +00:00
2022-02-03 07:48:17 +00:00
Updated int64 `json:"updated"`
2022-02-08 20:24:42 +00:00
}
2022-07-23 05:47:09 +00:00
//Identity data exchanged in a profile message
2022-02-08 20:24:42 +00:00
type Identity struct {
Revision int64 `json:"revision"`
Handle string `json:"handle,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Location string `json:"location,omitempty"`
Image string `json:"image,omitempty"`
Version string `json:"version"`
Node string `json:"node"`
Seal string `json:"seal"`
2022-01-15 21:59:26 +00:00
}
2022-07-23 05:47:09 +00:00
//IDList general list of ids
type IDList struct {
IDs []string `json:"ids"`
2022-02-16 08:00:07 +00:00
}
2022-07-23 05:47:09 +00:00
//LoginAccess response object when app is associated
type LoginAccess struct {
GUID string `json:"guid"`
2022-07-22 19:28:14 +00:00
AppToken string `json:"appToken"`
2022-07-22 19:28:14 +00:00
Created int64 `json:"created"`
2022-11-09 22:38:45 +00:00
PushSupported bool `json:"pushSupported"`
}
2022-07-23 05:47:09 +00:00
//NodeConfig node configuration values
2022-01-15 21:59:26 +00:00
type NodeConfig struct {
Domain string `json:"domain"`
2022-02-08 20:24:42 +00:00
EnableImage bool `json:"enableImage"`
2022-03-11 05:26:17 +00:00
EnableAudio bool `json:"enableAudio"`
EnableVideo bool `json:"enableVideo"`
2023-04-13 07:39:14 +00:00
EnableIce bool `json:"enableIce"`
IceUrl string `json:"iceUrl"`
IceUsername string `json:"iceUsername"`
IcePassword string `json:"icePassword"`
KeyType string `json:"keyType"`
2022-02-08 20:24:42 +00:00
2022-01-15 21:59:26 +00:00
AccountStorage int64 `json:"accountStorage"`
2022-11-10 04:54:44 +00:00
PushSupported bool `json:"pushSupported"`
2023-07-18 05:39:38 +00:00
EnableOpenAccess bool `json:"enableOpenAccess,omitempty"`
OpenAccessLimit int64 `json:"openAccessLimit,omitempty"`
2022-01-15 21:59:26 +00:00
}
2022-01-15 22:01:21 +00:00
2022-07-23 05:47:09 +00:00
//Profile public attributes of account
2022-01-15 22:01:21 +00:00
type Profile struct {
GUID string `json:"guid"`
2022-02-08 20:24:42 +00:00
2022-01-15 22:01:21 +00:00
Handle string `json:"handle,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 22:01:21 +00:00
Name string `json:"name,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 22:01:21 +00:00
Description string `json:"description,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 22:01:21 +00:00
Location string `json:"location,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 22:01:21 +00:00
Image string `json:"image,omitempty"`
2022-02-08 20:24:42 +00:00
Seal string `json:"seal,omitempty"`
2022-01-15 22:01:21 +00:00
Revision int64 `json:"revision"`
2022-02-08 20:24:42 +00:00
2022-01-15 22:01:21 +00:00
Version string `json:"version,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 22:01:21 +00:00
Node string `json:"node"`
}
2022-07-23 05:47:09 +00:00
//ProfileData subset of profile attributes to set
2022-01-15 22:01:21 +00:00
type ProfileData struct {
Name string `json:"name,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 22:01:21 +00:00
Description string `json:"description,omitempty"`
2022-02-08 20:24:42 +00:00
2022-01-15 22:01:21 +00:00
Location string `json:"location,omitempty"`
}
2023-03-20 05:26:55 +00:00
//Activity listener for account
type Activity struct {
2023-03-22 05:04:13 +00:00
Revision *Revision `json:"revision,emitempty"`
2023-03-20 05:26:55 +00:00
2023-03-22 05:04:13 +00:00
Phone *Phone `json:"ring",omitempty"`
2023-03-20 05:26:55 +00:00
}
2022-07-23 05:47:09 +00:00
//Revision revision of each account module
2022-01-15 22:01:21 +00:00
type Revision struct {
2022-03-25 07:33:22 +00:00
Account int64 `json:"account"`
2022-07-22 19:28:14 +00:00
Profile int64 `json:"profile"`
2022-02-08 20:24:42 +00:00
Article int64 `json:"article"`
Group int64 `json:"group"`
Channel int64 `json:"channel"`
2022-01-15 22:01:21 +00:00
Card int64 `json:"card"`
}
//Phone call indicator from contact initiating call
2023-03-20 13:47:54 +00:00
type Phone struct {
2023-03-20 05:26:55 +00:00
CardID string `json:"cardId"`
CallID string `json:"callId"`
2023-03-20 05:26:55 +00:00
CalleeToken string `json:"calleeToken"`
2023-04-13 07:39:14 +00:00
IceUrl string `json:"iceUrl"`
IceUsername string `json:"iceUsername"`
IcePassword string `json:"icePassword"`
2023-03-20 05:26:55 +00:00
}
//Seal key for channel sealing
type Seal struct {
2022-12-07 06:52:53 +00:00
PasswordSalt string `json:"passwordSalt"`
2022-12-07 06:52:53 +00:00
PrivateKeyIV string `json:"privateKeyIv,omitempty"`
PrivateKeyEncrypted string `json:"privateKeyEncrypted,omitempty"`
PublicKey string `json:"publicKey,omitempty"`
}
2022-07-23 05:47:09 +00:00
//SignedData object serialized in message
2022-02-08 20:24:42 +00:00
type SignedData struct {
GUID string `json:"guid"`
2022-02-08 20:24:42 +00:00
Timestamp int64 `json:"timestamp"`
MessageType string `json:"messageType"`
Value string `json:"value"`
}
2022-07-23 05:47:09 +00:00
//Subject payload of attribute, channel, topic or tag
2022-02-08 20:24:42 +00:00
type Subject struct {
2022-07-22 19:28:14 +00:00
DataType string `json:"dataType"`
2022-02-08 20:24:42 +00:00
2022-07-22 19:28:14 +00:00
Data string `json:"data"`
2022-01-15 22:01:21 +00:00
}
2022-01-15 22:03:00 +00:00
2022-07-23 05:47:09 +00:00
//Tag slot for tags associated with topic
2022-01-15 22:08:00 +00:00
type Tag struct {
ID string `json:"id"`
2022-02-08 20:24:42 +00:00
2022-02-18 07:56:30 +00:00
Revision int64 `json:"revision"`
2022-02-08 20:24:42 +00:00
Data *TagData `json:"data"`
2022-01-15 22:08:00 +00:00
}
2022-07-23 05:47:09 +00:00
//TagData data associated with topic
2022-02-08 20:24:42 +00:00
type TagData struct {
GUID string `json:"guid"`
2022-02-08 20:24:42 +00:00
DataType string `json:"dataType"`
2022-01-15 22:08:00 +00:00
Data string `json:"data"`
2022-02-08 20:24:42 +00:00
2022-01-18 08:40:39 +00:00
Created int64 `json:"created"`
2022-01-15 22:08:00 +00:00
2022-02-08 20:24:42 +00:00
Updated int64 `json:"updated"`
2022-01-15 22:08:00 +00:00
}
2022-07-23 05:47:09 +00:00
//Topic slot for object associated with channel
2022-02-08 20:24:42 +00:00
type Topic struct {
ID string `json:"id"`
2022-01-15 22:08:00 +00:00
2022-02-18 07:56:30 +00:00
Revision int64 `json:"revision"`
2022-01-20 07:45:53 +00:00
2022-02-08 20:24:42 +00:00
Data *TopicData `json:"data"`
2022-01-21 07:41:08 +00:00
}
2022-07-23 05:47:09 +00:00
//TopicData data and revision of posted topic and tags
2022-02-08 20:24:42 +00:00
type TopicData struct {
DetailRevision int64 `json:"detailRevision"`
TagRevision int64 `json:"tagRevision"`
TopicDetail *TopicDetail `json:"topicDetail,omitempty"`
2022-01-20 07:45:53 +00:00
}
2022-07-23 05:47:09 +00:00
//TopicDetail payload of topic
2022-02-08 20:24:42 +00:00
type TopicDetail struct {
GUID string `json:"guid"`
2022-01-20 07:45:53 +00:00
2022-02-08 20:24:42 +00:00
DataType string `json:"dataType"`
2022-01-20 07:45:53 +00:00
2022-02-08 20:24:42 +00:00
Data string `json:"data"`
2022-01-20 07:45:53 +00:00
2022-02-08 20:24:42 +00:00
Created int64 `json:"created"`
2022-02-18 07:56:30 +00:00
Updated int64 `json:"updated"`
2022-02-08 20:24:42 +00:00
Status string `json:"status"`
2022-03-01 08:28:36 +00:00
2022-07-22 19:28:14 +00:00
Transform string `json:"transform,omitempty"`
2022-01-20 07:45:53 +00:00
}
2023-03-20 13:47:54 +00:00
type Call struct {
Id string `json:"id"`
CardId string `json:"cardId"`
CallerToken string `json:"callerToken"`
CalleeToken string `json:"calleeToken"`
KeepAlive int32 `json:"keepAlive"`
2023-04-13 07:39:14 +00:00
IceUrl string `json:"iceUrl"`
IceUsername string `json:"iceUsername"`
IcePassword string `json:"icePassword"`
2023-03-20 13:47:54 +00:00
}
type Ring struct {
CallID string `json:"callId"`
2023-03-20 13:47:54 +00:00
CalleeToken string `json:"calleeToken"`
Index int32 `json:"index"`
2023-04-13 07:39:14 +00:00
IceUrl string `json:"iceUrl"`
IceUsername string `json:"iceUsername"`
IcePassword string `json:"icePassword"`
2023-03-20 13:47:54 +00:00
}