mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-12-24 03:25:40 +00:00
Update vendor (slack)
This commit is contained in:
parent
dcccd43427
commit
482fbac68f
2
vendor/github.com/nlopes/slack/bots.go
generated
vendored
2
vendor/github.com/nlopes/slack/bots.go
generated
vendored
@ -30,7 +30,7 @@ func botRequest(path string, values url.Values, debug bool) (*botResponseFull, e
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// GetBotInfo will retrive the complete bot information
|
||||
// GetBotInfo will retrieve the complete bot information
|
||||
func (api *Client) GetBotInfo(bot string) (*Bot, error) {
|
||||
values := url.Values{
|
||||
"token": {api.config.token},
|
||||
|
24
vendor/github.com/nlopes/slack/chat.go
generated
vendored
24
vendor/github.com/nlopes/slack/chat.go
generated
vendored
@ -29,18 +29,18 @@ type chatResponseFull struct {
|
||||
|
||||
// PostMessageParameters contains all the parameters necessary (including the optional ones) for a PostMessage() request
|
||||
type PostMessageParameters struct {
|
||||
Text string
|
||||
Username string
|
||||
AsUser bool
|
||||
Parse string
|
||||
LinkNames int
|
||||
Attachments []Attachment
|
||||
UnfurlLinks bool
|
||||
UnfurlMedia bool
|
||||
IconURL string
|
||||
IconEmoji string
|
||||
Markdown bool `json:"mrkdwn,omitempty"`
|
||||
EscapeText bool
|
||||
Text string `json:"text"`
|
||||
Username string `json:"user_name"`
|
||||
AsUser bool `json:"as_user"`
|
||||
Parse string `json:"parse"`
|
||||
LinkNames int `json:"link_names"`
|
||||
Attachments []Attachment `json:"attachments"`
|
||||
UnfurlLinks bool `json:"unfurl_links"`
|
||||
UnfurlMedia bool `json:"unfurl_media"`
|
||||
IconURL string `json:"icon_url"`
|
||||
IconEmoji string `json:"icon_emoji"`
|
||||
Markdown bool `json:"mrkdwn,omitempty"`
|
||||
EscapeText bool `json:"escape_text"`
|
||||
}
|
||||
|
||||
// NewPostMessageParameters provides an instance of PostMessageParameters with all the sane default values set
|
||||
|
52
vendor/github.com/nlopes/slack/examples/websocket/websocket.go
generated
vendored
52
vendor/github.com/nlopes/slack/examples/websocket/websocket.go
generated
vendored
@ -17,42 +17,38 @@ func main() {
|
||||
rtm := api.NewRTM()
|
||||
go rtm.ManageConnection()
|
||||
|
||||
Loop:
|
||||
for {
|
||||
select {
|
||||
case msg := <-rtm.IncomingEvents:
|
||||
fmt.Print("Event Received: ")
|
||||
switch ev := msg.Data.(type) {
|
||||
case *slack.HelloEvent:
|
||||
// Ignore hello
|
||||
for msg := range rtm.IncomingEvents {
|
||||
fmt.Print("Event Received: ")
|
||||
switch ev := msg.Data.(type) {
|
||||
case *slack.HelloEvent:
|
||||
// Ignore hello
|
||||
|
||||
case *slack.ConnectedEvent:
|
||||
fmt.Println("Infos:", ev.Info)
|
||||
fmt.Println("Connection counter:", ev.ConnectionCount)
|
||||
// Replace #general with your Channel ID
|
||||
rtm.SendMessage(rtm.NewOutgoingMessage("Hello world", "#general"))
|
||||
case *slack.ConnectedEvent:
|
||||
fmt.Println("Infos:", ev.Info)
|
||||
fmt.Println("Connection counter:", ev.ConnectionCount)
|
||||
// Replace #general with your Channel ID
|
||||
rtm.SendMessage(rtm.NewOutgoingMessage("Hello world", "#general"))
|
||||
|
||||
case *slack.MessageEvent:
|
||||
fmt.Printf("Message: %v\n", ev)
|
||||
case *slack.MessageEvent:
|
||||
fmt.Printf("Message: %v\n", ev)
|
||||
|
||||
case *slack.PresenceChangeEvent:
|
||||
fmt.Printf("Presence Change: %v\n", ev)
|
||||
case *slack.PresenceChangeEvent:
|
||||
fmt.Printf("Presence Change: %v\n", ev)
|
||||
|
||||
case *slack.LatencyReport:
|
||||
fmt.Printf("Current latency: %v\n", ev.Value)
|
||||
case *slack.LatencyReport:
|
||||
fmt.Printf("Current latency: %v\n", ev.Value)
|
||||
|
||||
case *slack.RTMError:
|
||||
fmt.Printf("Error: %s\n", ev.Error())
|
||||
case *slack.RTMError:
|
||||
fmt.Printf("Error: %s\n", ev.Error())
|
||||
|
||||
case *slack.InvalidAuthEvent:
|
||||
fmt.Printf("Invalid credentials")
|
||||
break Loop
|
||||
case *slack.InvalidAuthEvent:
|
||||
fmt.Printf("Invalid credentials")
|
||||
return
|
||||
|
||||
default:
|
||||
default:
|
||||
|
||||
// Ignore other events..
|
||||
// fmt.Printf("Unexpected: %v\n", msg.Data)
|
||||
}
|
||||
// Ignore other events..
|
||||
// fmt.Printf("Unexpected: %v\n", msg.Data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
vendor/github.com/nlopes/slack/info.go
generated
vendored
10
vendor/github.com/nlopes/slack/info.go
generated
vendored
@ -198,3 +198,13 @@ func (info Info) GetGroupByID(groupID string) *Group {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetIMByID returns an IM given an IM id
|
||||
func (info Info) GetIMByID(imID string) *IM {
|
||||
for _, im := range info.IMs {
|
||||
if im.ID == imID {
|
||||
return &im
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
2
vendor/github.com/nlopes/slack/oauth.go
generated
vendored
2
vendor/github.com/nlopes/slack/oauth.go
generated
vendored
@ -8,6 +8,7 @@ import (
|
||||
type OAuthResponseIncomingWebhook struct {
|
||||
URL string `json:"url"`
|
||||
Channel string `json:"channel"`
|
||||
ChannelID string `json:"channel_id,omitempty"`
|
||||
ConfigurationURL string `json:"configuration_url"`
|
||||
}
|
||||
|
||||
@ -23,6 +24,7 @@ type OAuthResponse struct {
|
||||
TeamID string `json:"team_id"`
|
||||
IncomingWebhook OAuthResponseIncomingWebhook `json:"incoming_webhook"`
|
||||
Bot OAuthResponseBot `json:"bot"`
|
||||
UserID string `json:"user_id,omitempty"`
|
||||
SlackResponse
|
||||
}
|
||||
|
||||
|
41
vendor/github.com/nlopes/slack/team.go
generated
vendored
41
vendor/github.com/nlopes/slack/team.go
generated
vendored
@ -44,6 +44,16 @@ type Login struct {
|
||||
Region string `json:"region"`
|
||||
}
|
||||
|
||||
type BillableInfoResponse struct {
|
||||
BillableInfo map[string]BillingActive `json:"billable_info"`
|
||||
SlackResponse
|
||||
|
||||
}
|
||||
|
||||
type BillingActive struct {
|
||||
BillingActive bool `json:"billing_active"`
|
||||
}
|
||||
|
||||
// AccessLogParameters contains all the parameters necessary (including the optional ones) for a GetAccessLogs() request
|
||||
type AccessLogParameters struct {
|
||||
Count int
|
||||
@ -73,6 +83,20 @@ func teamRequest(path string, values url.Values, debug bool) (*TeamResponse, err
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func billableInfoRequest(path string, values url.Values, debug bool) (map[string]BillingActive, error) {
|
||||
response := &BillableInfoResponse{}
|
||||
err := post(path, values, response, debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !response.Ok {
|
||||
return nil, errors.New(response.Error)
|
||||
}
|
||||
|
||||
return response.BillableInfo, nil
|
||||
}
|
||||
|
||||
func accessLogsRequest(path string, values url.Values, debug bool) (*LoginResponse, error) {
|
||||
response := &LoginResponse{}
|
||||
err := post(path, values, response, debug)
|
||||
@ -117,3 +141,20 @@ func (api *Client) GetAccessLogs(params AccessLogParameters) ([]Login, *Paging,
|
||||
return response.Logins, &response.Paging, nil
|
||||
}
|
||||
|
||||
func (api *Client) GetBillableInfo(user string) (map[string]BillingActive, error) {
|
||||
values := url.Values{
|
||||
"token": {api.config.token},
|
||||
"user": {user},
|
||||
}
|
||||
|
||||
return billableInfoRequest("team.billableInfo", values, api.debug)
|
||||
}
|
||||
|
||||
// GetBillableInfoForTeam returns the billing_active status of all users on the team.
|
||||
func (api *Client) GetBillableInfoForTeam() (map[string]BillingActive, error) {
|
||||
values := url.Values{
|
||||
"token": {api.config.token},
|
||||
}
|
||||
|
||||
return billableInfoRequest("team.billableInfo", values, api.debug)
|
||||
}
|
||||
|
2
vendor/github.com/nlopes/slack/users.go
generated
vendored
2
vendor/github.com/nlopes/slack/users.go
generated
vendored
@ -122,7 +122,7 @@ func (api *Client) GetUserPresence(user string) (*UserPresence, error) {
|
||||
return &response.UserPresence, nil
|
||||
}
|
||||
|
||||
// GetUserInfo will retrive the complete user information
|
||||
// GetUserInfo will retrieve the complete user information
|
||||
func (api *Client) GetUserInfo(user string) (*User, error) {
|
||||
values := url.Values{
|
||||
"token": {api.config.token},
|
||||
|
2
vendor/manifest
vendored
2
vendor/manifest
vendored
@ -146,7 +146,7 @@
|
||||
"importpath": "github.com/nlopes/slack",
|
||||
"repository": "https://github.com/nlopes/slack",
|
||||
"vcs": "git",
|
||||
"revision": "e595e9d8590a04ff76407e4e7d1791d25b095c66",
|
||||
"revision": "248e1d53d27901137764ae625890c127bf67e7aa",
|
||||
"branch": "master",
|
||||
"notests": true
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user