summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK
diff options
context:
space:
mode:
authorWim <wim@42.be>2021-04-03 19:16:46 +0200
committerGitHub <noreply@github.com>2021-04-03 19:16:46 +0200
commit21eb37e471c338a90f2e23c86106f7e49e2d1196 (patch)
treee7d1cfa89f31fcf0578edae7727f2230bba744a2 /vendor/github.com/matterbridge/Rocket.Chat.Go.SDK
parentd3b60cc445e5871971b543fde9483dba3924bf68 (diff)
downloadmatterbridge-msglm-21eb37e471c338a90f2e23c86106f7e49e2d1196.tar.gz
matterbridge-msglm-21eb37e471c338a90f2e23c86106f7e49e2d1196.tar.bz2
matterbridge-msglm-21eb37e471c338a90f2e23c86106f7e49e2d1196.zip
Update vendor (#1446)
* Update vendor * Use upstream emoji lib again
Diffstat (limited to 'vendor/github.com/matterbridge/Rocket.Chat.Go.SDK')
-rw-r--r--vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/models/message.go18
-rw-r--r--vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go41
2 files changed, 50 insertions, 9 deletions
diff --git a/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/models/message.go b/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/models/message.go
index f3dc1c6f..6a82cdd1 100644
--- a/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/models/message.go
+++ b/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/models/message.go
@@ -77,8 +77,8 @@ type Attachment struct {
// https://rocket.chat/docs/developer-guides/rest-api/chat/postmessage/
type AttachmentField struct {
Short bool `json:"short"`
- Title string `json:"title"`
- Value string `json:"value"`
+ Title string `json:"title,omitempty"`
+ Value string `json:"value,omitempty"`
}
type AttachmentActionType string
@@ -89,15 +89,15 @@ const (
// AttachmentAction are action buttons on message attachments
type AttachmentAction struct {
- Type AttachmentActionType `json:"type"`
- Text string `json:"text"`
- Url string `json:"url"`
- ImageURL string `json:"image_url"`
+ Type AttachmentActionType `json:"type,omitempty"`
+ Text string `json:"text,omitempty"`
+ Url string `json:"url,omitempty"`
+ ImageURL string `json:"image_url,omitempty"`
IsWebView bool `json:"is_webview"`
- WebviewHeightRatio string `json:"webview_height_ratio"`
- Msg string `json:"msg"`
+ WebviewHeightRatio string `json:"webview_height_ratio,omitempty"`
+ Msg string `json:"msg,omitempty"`
MsgInChatWindow bool `json:"msg_in_chat_window"`
- MsgProcessingType MessageProcessingType `json:"msg_processing_type"`
+ MsgProcessingType MessageProcessingType `json:"msg_processing_type,omitempty"`
}
// AttachmentActionButtonAlignment configures how the actions buttons will be aligned
diff --git a/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go b/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go
index d5c8fa85..473f957d 100644
--- a/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go
+++ b/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go
@@ -19,6 +19,17 @@ type ChannelResponse struct {
Channel models.Channel `json:"channel"`
}
+type GroupsResponse struct {
+ Status
+ models.Pagination
+ Groups []models.Channel `json:"groups"`
+}
+
+type GroupResponse struct {
+ Status
+ Group models.Channel `json:"group"`
+}
+
// GetPublicChannels returns all channels that can be seen by the logged in user.
//
// https://rocket.chat/docs/developer-guides/rest-api/channels/list
@@ -31,6 +42,19 @@ func (c *Client) GetPublicChannels() (*ChannelsResponse, error) {
return response, nil
}
+// GetPrivateGroups returns all channels that can be seen by the logged in user.
+//
+// https://rocket.chat/docs/developer-guides/rest-api/groups/list
+func (c *Client) GetPrivateGroups() (*GroupsResponse, error) {
+ response := new(GroupsResponse)
+ if err := c.Get("groups.list", nil, response); err != nil {
+ return nil, err
+ }
+
+ return response, nil
+}
+
+
// GetJoinedChannels returns all channels that the user has joined.
//
// https://rocket.chat/docs/developer-guides/rest-api/channels/list-joined
@@ -70,3 +94,20 @@ func (c *Client) GetChannelInfo(channel *models.Channel) (*models.Channel, error
return &response.Channel, nil
}
+// GetGroupInfo get information about a group. That might be useful to update the usernames.
+//
+// https://rocket.chat/docs/developer-guides/rest-api/groups/info
+func (c *Client) GetGroupInfo(channel *models.Channel) (*models.Channel, error) {
+ response := new(GroupResponse)
+ switch {
+ case channel.Name != "" && channel.ID == "":
+ if err := c.Get("groups.info", url.Values{"roomName": []string{channel.Name}}, response); err != nil {
+ return nil, err
+ }
+ default:
+ if err := c.Get("groups.info", url.Values{"roomId": []string{channel.ID}}, response); err != nil {
+ return nil, err
+ }
+ }
+ return &response.Group, nil
+}