From 46b549f256192d7abef8e0472f0a8918e2f5b18c Mon Sep 17 00:00:00 2001 From: badkaktus Date: Thu, 1 Sep 2022 16:22:58 +0300 Subject: [PATCH] update struct --- authentication.go | 42 +++++++++--------- channels.go | 26 ++++++------ chat.go | 82 +++++++++++++++++------------------ info.go | 106 +++++++++++++++++++++++----------------------- 4 files changed, 128 insertions(+), 128 deletions(-) diff --git a/authentication.go b/authentication.go index 229c835..a6290ec 100644 --- a/authentication.go +++ b/authentication.go @@ -15,21 +15,21 @@ type LoginPayload struct { } type LoginResponse struct { - Status string `json:"status"` - Data data `json:"data"` - Message string `json:"message,omitempty"` + Status string `json:"status"` + Data DataLogin `json:"data"` + Message string `json:"message,omitempty"` } -type data struct { +type DataLogin struct { UserID string `json:"userId"` AuthToken string `json:"authToken"` - Me me `json:"me"` + Me Me `json:"me"` } -type me struct { +type Me struct { ID string `json:"_id"` - Services services `json:"services"` - Emails []email `json:"emails"` + Services Services `json:"services"` + Emails []Email `json:"emails"` Status string `json:"status"` Active bool `json:"active"` UpdatedAt time.Time `json:"_updatedAt"` @@ -39,7 +39,7 @@ type me struct { Username string `json:"username"` UtcOffset int `json:"utcOffset"` StatusText string `json:"statusText"` - Settings settings `json:"settings"` + Settings Settings `json:"settings"` AvatarOrigin string `json:"avatarOrigin"` RequirePasswordChange bool `json:"requirePasswordChange"` Language string `json:"language"` @@ -47,29 +47,29 @@ type me struct { AvatarURL string `json:"avatarUrl"` } -type services struct { - Password password `json:"password"` +type Services struct { + Password Password `json:"password"` } -type password struct { +type Password struct { Bcrypt string `json:"bcrypt"` } -type email struct { +type Email struct { Address string `json:"address"` Verified bool `json:"verified"` } -type settings struct { - Preferences preferences `json:"preferences"` +type Settings struct { + Preferences Preferences `json:"preferences"` } -type dontAskAgainList struct { +type DontAskAgainList struct { Action string `json:"action"` Label string `json:"label"` } -type preferences struct { +type Preferences struct { EnableAutoAway bool `json:"enableAutoAway"` IdleTimeLimit int `json:"idleTimeLimit"` AudioNotifications string `json:"audioNotifications"` @@ -101,7 +101,7 @@ type preferences struct { DesktopNotificationRequireInteraction bool `json:"desktopNotificationRequireInteraction"` SidebarSortby string `json:"sidebarSortby"` DesktopNotificationDuration int `json:"desktopNotificationDuration"` - DontAskAgainList []dontAskAgainList `json:"dontAskAgainList"` + DontAskAgainList []DontAskAgainList `json:"dontAskAgainList"` Highlights []interface{} `json:"highlights"` Language string `json:"language"` } @@ -115,8 +115,8 @@ type LogoutResponse struct { type MeResponse struct { ID string `json:"_id"` - Services services `json:"services"` - Emails []email `json:"emails"` + Services Services `json:"services"` + Emails []Email `json:"emails"` Status string `json:"status"` Active bool `json:"active"` UpdatedAt time.Time `json:"_updatedAt"` @@ -126,7 +126,7 @@ type MeResponse struct { Username string `json:"username"` UtcOffset int `json:"utcOffset"` StatusText string `json:"statusText"` - Settings settings `json:"settings"` + Settings Settings `json:"settings"` AvatarOrigin string `json:"avatarOrigin"` RequirePasswordChange bool `json:"requirePasswordChange"` Language string `json:"language"` diff --git a/channels.go b/channels.go index 45b91c0..b356fec 100644 --- a/channels.go +++ b/channels.go @@ -14,17 +14,17 @@ type AddAllRequest struct { } type AddAllResponse struct { - Channel channel `json:"channel"` + Channel Channel `json:"channel"` Success bool `json:"success"` } -type channel struct { +type Channel struct { ID string `json:"_id"` Name string `json:"name"` T string `json:"t"` Usernames []string `json:"usernames"` Msgs int `json:"msgs"` - U u `json:"u"` + U U `json:"u"` Ts time.Time `json:"ts"` } @@ -56,7 +56,7 @@ type CreateChannelRequest struct { } type CreateChannelResponse struct { - Channel channel `json:"channel"` + Channel Channel `json:"channel"` Success bool `json:"success"` } @@ -76,18 +76,18 @@ type ChannelHistoryRequest struct { } type ChannelInfoResponse struct { - Channel channelInfo `json:"channel"` + Channel ChannelInfo `json:"channel"` Success bool `json:"success"` } -type channelInfo struct { +type ChannelInfo struct { ID string `json:"_id"` Name string `json:"name"` Fname string `json:"fname"` T string `json:"t"` Msgs int `json:"msgs"` UsersCount int `json:"usersCount"` - U uChat `json:"u"` + U UChat `json:"u"` CustomFields struct { } `json:"customFields"` Broadcast bool `json:"broadcast"` @@ -119,20 +119,20 @@ type InviteChannelResponse struct { } type ChannelListResponse struct { - Channels []channelList `json:"channels"` + Channels []ChannelList `json:"channels"` Offset int `json:"offset"` Count int `json:"count"` Total int `json:"total"` Success bool `json:"success"` } -type channelList struct { +type ChannelList struct { ID string `json:"_id"` Name string `json:"name"` T string `json:"t"` Usernames []string `json:"usernames"` Msgs int `json:"msgs"` - U uChat `json:"u"` + U UChat `json:"u"` Ts time.Time `json:"ts"` Ro bool `json:"ro"` SysMes bool `json:"sysMes"` @@ -140,14 +140,14 @@ type channelList struct { } type ChannelMembersResponse struct { - Members []member `json:"members"` + Members []Member `json:"members"` Count int `json:"count"` Offset int `json:"offset"` Total int `json:"total"` Success bool `json:"success"` } -type member struct { +type Member struct { ID string `json:"_id"` Username string `json:"username"` Name string `json:"name"` @@ -160,7 +160,7 @@ type RenameChannelRequest struct { } type RenameChannelResponse struct { - Channel channelList `json:"channel"` + Channel ChannelList `json:"channel"` Success bool `json:"success"` } diff --git a/chat.go b/chat.go index b1419e7..4d71b44 100644 --- a/chat.go +++ b/chat.go @@ -15,58 +15,58 @@ type Message struct { Emoji string `json:"emoji,omitempty"` RoomID string `json:"roomId,omitempty"` Text string `json:"text"` - Attachments []attachment `json:"attachments"` + Attachments []Attachment `json:"attachments"` } -type attachment struct { - AudioURL string `json:"audio_url"` - AuthorIcon string `json:"author_icon"` - AuthorLink string `json:"author_link"` - AuthorName string `json:"author_name"` - Collapsed bool `json:"collapsed"` - Color string `json:"color"` - Fields []attachField `json:"fields"` - ImageURL string `json:"image_url"` - MessageLink string `json:"message_link"` - Text string `json:"text"` - ThumbURL string `json:"thumb_url"` - Title string `json:"title"` - TitleLink string `json:"title_link"` - TitleLinkDownload bool `json:"title_link_download"` - Ts time.Time `json:"ts"` - VideoURL string `json:"video_url"` +type Attachment struct { + AudioURL string `json:"audio_url,omitempty"` + AuthorIcon string `json:"author_icon,omitempty"` + AuthorLink string `json:"author_link,omitempty"` + AuthorName string `json:"author_name,omitempty"` + Collapsed bool `json:"collapsed,omitempty"` + Color string `json:"color,omitempty"` + Fields []AttachField `json:"fields,omitempty"` + ImageURL string `json:"image_url,omitempty"` + MessageLink string `json:"message_link,omitempty"` + Text string `json:"text,omitempty"` + ThumbURL string `json:"thumb_url,omitempty"` + Title string `json:"title,omitempty"` + TitleLink string `json:"title_link,omitempty"` + TitleLinkDownload bool `json:"title_link_download,omitempty"` + Ts time.Time `json:"ts,omitempty"` + VideoURL string `json:"video_url,omitempty"` } -type attachField struct { - Short bool `json:"short"` - Title string `json:"title"` - Value string `json:"value"` +type AttachField struct { + Short bool `json:"short,omitempty"` + Title string `json:"title,omitempty"` + Value string `json:"value,omitempty"` } type RespPostMessage struct { Ts int64 `json:"ts"` Channel string `json:"channel"` - Message respMessageData `json:"message"` + Message RespMessageData `json:"message"` Success bool `json:"success"` Error string `json:"error,omitempty"` ErrorType string `json:"errorType,omitempty"` } -type respMessageData struct { - Alias string `json:"alias"` - Msg string `json:"msg"` - ParseUrls bool `json:"parseUrls"` - Groupable bool `json:"groupable"` - Ts time.Time `json:"ts"` - U uChat `json:"u"` - Rid string `json:"rid"` - UpdatedAt time.Time `json:"_updatedAt"` - ID string `json:"_id"` +type RespMessageData struct { + Alias string `json:"alias,omitempty"` + Msg string `json:"msg,omitempty"` + ParseUrls bool `json:"parseUrls,omitempty"` + Groupable bool `json:"groupable,omitempty"` + Ts time.Time `json:"ts,omitempty"` + U UChat `json:"u,omitempty"` + Rid string `json:"rid,omitempty"` + UpdatedAt time.Time `json:"_updatedAt,omitempty"` + ID string `json:"_id,omitempty"` } -type uChat struct { - ID string `json:"_id"` - Username string `json:"username"` +type UChat struct { + ID string `json:"_id,omitempty"` + Username string `json:"username,omitempty"` } type SingleMessageId struct { @@ -74,11 +74,11 @@ type SingleMessageId struct { } type GetMessageResponse struct { - Message message `json:"message"` - Success bool `json:"success"` + Message MessageResp `json:"message"` + Success bool `json:"success"` } -type message struct { +type MessageResp struct { ID string `json:"_id"` Rid string `json:"rid"` Msg string `json:"msg"` @@ -108,14 +108,14 @@ type GetPinnedMsgRequest struct { } type GetPinnedMsgResponse struct { - Messages []pinnedMessage `json:"messages"` + Messages []PinnedMessage `json:"messages"` Count int `json:"count"` Offset int `json:"offset"` Total int `json:"total"` Success bool `json:"success"` } -type pinnedMessage struct { +type PinnedMessage struct { ID string `json:"_id"` Rid string `json:"rid"` Msg string `json:"msg"` diff --git a/info.go b/info.go index b0c9de4..5faee4c 100644 --- a/info.go +++ b/info.go @@ -9,14 +9,14 @@ import ( type RespInfo struct { Info struct { Version string `json:"version"` - Build build `json:"build"` - Commit commit `json:"commit"` + Build Build `json:"build"` + Commit Commit `json:"commit"` MarketplaceAPIVersion string `json:"marketplaceApiVersion"` } `json:"info"` Success bool `json:"success"` } -type build struct { +type Build struct { Date time.Time `json:"date"` NodeVersion string `json:"nodeVersion"` Arch string `json:"arch"` @@ -27,7 +27,7 @@ type build struct { Cpus int `json:"cpus"` } -type commit struct { +type Commit struct { Hash string `json:"hash"` Date string `json:"date"` Author string `json:"author"` @@ -37,24 +37,24 @@ type commit struct { } type RespDirectory struct { - Result []result `json:"result"` + Result []Result `json:"result"` Count int `json:"count"` Offset int `json:"offset"` Total int `json:"total"` Success bool `json:"success"` } -type result struct { +type Result struct { ID string `json:"_id"` Ts time.Time `json:"ts"` T string `json:"t"` Name string `json:"name"` UsersCount int `json:"usersCount"` Default bool `json:"default"` - LastMessage lastMessage `json:"lastMessage"` + LastMessage LastMessage `json:"lastMessage"` } -type lastMessage struct { +type LastMessage struct { ID string `json:"_id"` Alias string `json:"alias"` Msg string `json:"msg"` @@ -62,27 +62,27 @@ type lastMessage struct { ParseUrls bool `json:"parseUrls"` Groupable bool `json:"groupable"` Ts time.Time `json:"ts"` - U u `json:"u"` + U U `json:"u"` Rid string `json:"rid"` UpdatedAt time.Time `json:"_updatedAt"` Mentions []interface{} `json:"mentions"` Channels []interface{} `json:"channels"` } -type u struct { +type U struct { ID string `json:"_id"` Username string `json:"username"` Name string `json:"name,omitempty"` } type RespSpotlight struct { - Users []usersInfo `json:"users"` - Rooms []roomsInfo `json:"rooms"` + Users []UsersInfo `json:"users"` + Rooms []RoomsInfo `json:"rooms"` Success bool `json:"success"` Error string `json:"error,omitempty"` } -type usersInfo struct { +type UsersInfo struct { ID string `json:"_id"` Status string `json:"status"` Name string `json:"name"` @@ -90,16 +90,16 @@ type usersInfo struct { StatusText string `json:"statusText"` } -type roomsInfo struct { +type RoomsInfo struct { ID string `json:"_id"` Name string `json:"name"` T string `json:"t"` - LastMessage lastMessage `json:"lastMessage"` + LastMessage LastMessage `json:"lastMessage"` } type RespStatistics struct { ID string `json:"_id"` - Wizard wizard `json:"wizard"` + Wizard Wizard `json:"wizard"` UniqueID string `json:"uniqueId"` InstalledAt time.Time `json:"installedAt"` Version string `json:"version"` @@ -132,32 +132,32 @@ type RespStatistics struct { LastLogin time.Time `json:"lastLogin"` LastMessageSentAt time.Time `json:"lastMessageSentAt"` LastSeenSubscription time.Time `json:"lastSeenSubscription"` - Os os `json:"os"` - Process process `json:"process"` - Deploy deploy `json:"deploy"` + Os Os `json:"os"` + Process Process `json:"process"` + Deploy Deploy `json:"deploy"` EnterpriseReady bool `json:"enterpriseReady"` UploadsTotal int `json:"uploadsTotal"` UploadsTotalSize int `json:"uploadsTotalSize"` - Migration migration `json:"migration"` + Migration Migration `json:"migration"` InstanceCount int `json:"instanceCount"` OplogEnabled bool `json:"oplogEnabled"` MongoVersion string `json:"mongoVersion"` MongoStorageEngine string `json:"mongoStorageEngine"` - UniqueUsersOfYesterday stats `json:"uniqueUsersOfYesterday"` - UniqueUsersOfLastMonth stats `json:"uniqueUsersOfLastMonth"` - UniqueDevicesOfYesterday stats `json:"uniqueDevicesOfYesterday"` - UniqueDevicesOfLastMonth stats `json:"uniqueDevicesOfLastMonth"` - UniqueOSOfYesterday stats `json:"uniqueOSOfYesterday"` - UniqueOSOfLastMonth stats `json:"uniqueOSOfLastMonth"` - Apps apps `json:"apps"` - Integrations integrations `json:"integrations"` + UniqueUsersOfYesterday Stats `json:"uniqueUsersOfYesterday"` + UniqueUsersOfLastMonth Stats `json:"uniqueUsersOfLastMonth"` + UniqueDevicesOfYesterday Stats `json:"uniqueDevicesOfYesterday"` + UniqueDevicesOfLastMonth Stats `json:"uniqueDevicesOfLastMonth"` + UniqueOSOfYesterday Stats `json:"uniqueOSOfYesterday"` + UniqueOSOfLastMonth Stats `json:"uniqueOSOfLastMonth"` + Apps Apps `json:"apps"` + Integrations Integrations `json:"integrations"` PushQueue int `json:"pushQueue"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"_updatedAt"` Success bool `json:"success"` } -type wizard struct { +type Wizard struct { OrganizationType string `json:"organizationType"` Industry string `json:"industry"` Size string `json:"size"` @@ -167,7 +167,7 @@ type wizard struct { RegisterServer bool `json:"registerServer"` } -type os struct { +type Os struct { Type string `json:"type"` Platform string `json:"platform"` Arch string `json:"arch"` @@ -176,16 +176,16 @@ type os struct { Loadavg []float64 `json:"loadavg"` Totalmem int64 `json:"totalmem"` Freemem int `json:"freemem"` - Cpus []cpus `json:"cpus"` + Cpus []Cpus `json:"cpus"` } -type cpus struct { +type Cpus struct { Model string `json:"model"` Speed int `json:"speed"` - Times times `json:"times"` + Times Times `json:"times"` } -type times struct { +type Times struct { User int `json:"user"` Nice int `json:"nice"` Sys int `json:"sys"` @@ -193,20 +193,20 @@ type times struct { Irq int `json:"irq"` } -type process struct { +type Process struct { NodeVersion string `json:"nodeVersion"` Pid int `json:"pid"` Uptime float64 `json:"uptime"` } -type apps struct { +type Apps struct { EngineVersion string `json:"engineVersion"` Enabled bool `json:"enabled"` TotalInstalled int `json:"totalInstalled"` TotalActive int `json:"totalActive"` } -type integrations struct { +type Integrations struct { TotalIntegrations int `json:"totalIntegrations"` TotalIncoming int `json:"totalIncoming"` TotalIncomingActive int `json:"totalIncomingActive"` @@ -215,20 +215,20 @@ type integrations struct { TotalWithScriptEnabled int `json:"totalWithScriptEnabled"` } -type stats struct { +type Stats struct { Year int `json:"year"` Month int `json:"month"` Day int `json:"day"` Data []interface{} `json:"data"` } -type migration struct { +type Migration struct { ID string `json:"_id"` Locked bool `json:"locked"` Version int `json:"version"` } -type deploy struct { +type Deploy struct { Method string `json:"method"` Platform string `json:"platform"` } @@ -236,7 +236,7 @@ type deploy struct { type RespStatisticsList struct { Statistics []struct { ID string `json:"_id"` - Wizard wizard `json:"wizard"` + Wizard Wizard `json:"wizard"` UniqueID string `json:"uniqueId"` InstalledAt time.Time `json:"installedAt"` Version string `json:"version"` @@ -265,25 +265,25 @@ type RespStatisticsList struct { TotalMessages int `json:"totalMessages"` FederatedServers int `json:"federatedServers"` FederatedUsers int `json:"federatedUsers"` - Os os `json:"os"` - Process process `json:"process"` - Deploy deploy `json:"deploy"` + Os Os `json:"os"` + Process Process `json:"process"` + Deploy Deploy `json:"deploy"` EnterpriseReady bool `json:"enterpriseReady"` UploadsTotal int `json:"uploadsTotal"` UploadsTotalSize int `json:"uploadsTotalSize"` - Migration migration `json:"migration"` + Migration Migration `json:"migration"` InstanceCount int `json:"instanceCount"` OplogEnabled bool `json:"oplogEnabled"` MongoVersion string `json:"mongoVersion"` MongoStorageEngine string `json:"mongoStorageEngine"` - UniqueUsersOfYesterday stats `json:"uniqueUsersOfYesterday"` - UniqueUsersOfLastMonth stats `json:"uniqueUsersOfLastMonth"` - UniqueDevicesOfYesterday stats `json:"uniqueDevicesOfYesterday"` - UniqueDevicesOfLastMonth stats `json:"uniqueDevicesOfLastMonth"` - UniqueOSOfYesterday stats `json:"uniqueOSOfYesterday"` - UniqueOSOfLastMonth stats `json:"uniqueOSOfLastMonth"` - Apps apps `json:"apps"` - Integrations integrations `json:"integrations"` + UniqueUsersOfYesterday Stats `json:"uniqueUsersOfYesterday"` + UniqueUsersOfLastMonth Stats `json:"uniqueUsersOfLastMonth"` + UniqueDevicesOfYesterday Stats `json:"uniqueDevicesOfYesterday"` + UniqueDevicesOfLastMonth Stats `json:"uniqueDevicesOfLastMonth"` + UniqueOSOfYesterday Stats `json:"uniqueOSOfYesterday"` + UniqueOSOfLastMonth Stats `json:"uniqueOSOfLastMonth"` + Apps Apps `json:"apps"` + Integrations Integrations `json:"integrations"` PushQueue int `json:"pushQueue"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"_updatedAt"`