mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-24 19:52:03 -08: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
|
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) {
|
func (api *Client) GetBotInfo(bot string) (*Bot, error) {
|
||||||
values := url.Values{
|
values := url.Values{
|
||||||
"token": {api.config.token},
|
"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
|
// PostMessageParameters contains all the parameters necessary (including the optional ones) for a PostMessage() request
|
||||||
type PostMessageParameters struct {
|
type PostMessageParameters struct {
|
||||||
Text string
|
Text string `json:"text"`
|
||||||
Username string
|
Username string `json:"user_name"`
|
||||||
AsUser bool
|
AsUser bool `json:"as_user"`
|
||||||
Parse string
|
Parse string `json:"parse"`
|
||||||
LinkNames int
|
LinkNames int `json:"link_names"`
|
||||||
Attachments []Attachment
|
Attachments []Attachment `json:"attachments"`
|
||||||
UnfurlLinks bool
|
UnfurlLinks bool `json:"unfurl_links"`
|
||||||
UnfurlMedia bool
|
UnfurlMedia bool `json:"unfurl_media"`
|
||||||
IconURL string
|
IconURL string `json:"icon_url"`
|
||||||
IconEmoji string
|
IconEmoji string `json:"icon_emoji"`
|
||||||
Markdown bool `json:"mrkdwn,omitempty"`
|
Markdown bool `json:"mrkdwn,omitempty"`
|
||||||
EscapeText bool
|
EscapeText bool `json:"escape_text"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPostMessageParameters provides an instance of PostMessageParameters with all the sane default values set
|
// 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()
|
rtm := api.NewRTM()
|
||||||
go rtm.ManageConnection()
|
go rtm.ManageConnection()
|
||||||
|
|
||||||
Loop:
|
for msg := range rtm.IncomingEvents {
|
||||||
for {
|
fmt.Print("Event Received: ")
|
||||||
select {
|
switch ev := msg.Data.(type) {
|
||||||
case msg := <-rtm.IncomingEvents:
|
case *slack.HelloEvent:
|
||||||
fmt.Print("Event Received: ")
|
// Ignore hello
|
||||||
switch ev := msg.Data.(type) {
|
|
||||||
case *slack.HelloEvent:
|
|
||||||
// Ignore hello
|
|
||||||
|
|
||||||
case *slack.ConnectedEvent:
|
case *slack.ConnectedEvent:
|
||||||
fmt.Println("Infos:", ev.Info)
|
fmt.Println("Infos:", ev.Info)
|
||||||
fmt.Println("Connection counter:", ev.ConnectionCount)
|
fmt.Println("Connection counter:", ev.ConnectionCount)
|
||||||
// Replace #general with your Channel ID
|
// Replace #general with your Channel ID
|
||||||
rtm.SendMessage(rtm.NewOutgoingMessage("Hello world", "#general"))
|
rtm.SendMessage(rtm.NewOutgoingMessage("Hello world", "#general"))
|
||||||
|
|
||||||
case *slack.MessageEvent:
|
case *slack.MessageEvent:
|
||||||
fmt.Printf("Message: %v\n", ev)
|
fmt.Printf("Message: %v\n", ev)
|
||||||
|
|
||||||
case *slack.PresenceChangeEvent:
|
case *slack.PresenceChangeEvent:
|
||||||
fmt.Printf("Presence Change: %v\n", ev)
|
fmt.Printf("Presence Change: %v\n", ev)
|
||||||
|
|
||||||
case *slack.LatencyReport:
|
case *slack.LatencyReport:
|
||||||
fmt.Printf("Current latency: %v\n", ev.Value)
|
fmt.Printf("Current latency: %v\n", ev.Value)
|
||||||
|
|
||||||
case *slack.RTMError:
|
case *slack.RTMError:
|
||||||
fmt.Printf("Error: %s\n", ev.Error())
|
fmt.Printf("Error: %s\n", ev.Error())
|
||||||
|
|
||||||
case *slack.InvalidAuthEvent:
|
case *slack.InvalidAuthEvent:
|
||||||
fmt.Printf("Invalid credentials")
|
fmt.Printf("Invalid credentials")
|
||||||
break Loop
|
return
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
// Ignore other events..
|
// Ignore other events..
|
||||||
// fmt.Printf("Unexpected: %v\n", msg.Data)
|
// 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
|
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 {
|
type OAuthResponseIncomingWebhook struct {
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Channel string `json:"channel"`
|
Channel string `json:"channel"`
|
||||||
|
ChannelID string `json:"channel_id,omitempty"`
|
||||||
ConfigurationURL string `json:"configuration_url"`
|
ConfigurationURL string `json:"configuration_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ type OAuthResponse struct {
|
|||||||
TeamID string `json:"team_id"`
|
TeamID string `json:"team_id"`
|
||||||
IncomingWebhook OAuthResponseIncomingWebhook `json:"incoming_webhook"`
|
IncomingWebhook OAuthResponseIncomingWebhook `json:"incoming_webhook"`
|
||||||
Bot OAuthResponseBot `json:"bot"`
|
Bot OAuthResponseBot `json:"bot"`
|
||||||
|
UserID string `json:"user_id,omitempty"`
|
||||||
SlackResponse
|
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"`
|
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
|
// AccessLogParameters contains all the parameters necessary (including the optional ones) for a GetAccessLogs() request
|
||||||
type AccessLogParameters struct {
|
type AccessLogParameters struct {
|
||||||
Count int
|
Count int
|
||||||
@ -73,6 +83,20 @@ func teamRequest(path string, values url.Values, debug bool) (*TeamResponse, err
|
|||||||
return response, nil
|
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) {
|
func accessLogsRequest(path string, values url.Values, debug bool) (*LoginResponse, error) {
|
||||||
response := &LoginResponse{}
|
response := &LoginResponse{}
|
||||||
err := post(path, values, response, debug)
|
err := post(path, values, response, debug)
|
||||||
@ -117,3 +141,20 @@ func (api *Client) GetAccessLogs(params AccessLogParameters) ([]Login, *Paging,
|
|||||||
return response.Logins, &response.Paging, nil
|
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
|
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) {
|
func (api *Client) GetUserInfo(user string) (*User, error) {
|
||||||
values := url.Values{
|
values := url.Values{
|
||||||
"token": {api.config.token},
|
"token": {api.config.token},
|
||||||
|
2
vendor/manifest
vendored
2
vendor/manifest
vendored
@ -146,7 +146,7 @@
|
|||||||
"importpath": "github.com/nlopes/slack",
|
"importpath": "github.com/nlopes/slack",
|
||||||
"repository": "https://github.com/nlopes/slack",
|
"repository": "https://github.com/nlopes/slack",
|
||||||
"vcs": "git",
|
"vcs": "git",
|
||||||
"revision": "e595e9d8590a04ff76407e4e7d1791d25b095c66",
|
"revision": "248e1d53d27901137764ae625890c127bf67e7aa",
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"notests": true
|
"notests": true
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user