From 07fd825349e8b7e86f8afb3843cb8e2c2afc7c74 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 25 Mar 2017 20:45:10 +0100 Subject: Update vendor --- vendor/github.com/nlopes/slack/chat.go | 49 ++++++++++++---------- .../github.com/nlopes/slack/examples/team/team.go | 25 +++++++++++ 2 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 vendor/github.com/nlopes/slack/examples/team/team.go (limited to 'vendor/github.com/nlopes/slack') diff --git a/vendor/github.com/nlopes/slack/chat.go b/vendor/github.com/nlopes/slack/chat.go index 120c6be7..fc909a86 100644 --- a/vendor/github.com/nlopes/slack/chat.go +++ b/vendor/github.com/nlopes/slack/chat.go @@ -8,16 +8,17 @@ import ( ) const ( - DEFAULT_MESSAGE_USERNAME = "" - DEFAULT_MESSAGE_ASUSER = false - DEFAULT_MESSAGE_PARSE = "" - DEFAULT_MESSAGE_LINK_NAMES = 0 - DEFAULT_MESSAGE_UNFURL_LINKS = false - DEFAULT_MESSAGE_UNFURL_MEDIA = true - DEFAULT_MESSAGE_ICON_URL = "" - DEFAULT_MESSAGE_ICON_EMOJI = "" - DEFAULT_MESSAGE_MARKDOWN = true - DEFAULT_MESSAGE_ESCAPE_TEXT = true + DEFAULT_MESSAGE_USERNAME = "" + DEFAULT_MESSAGE_THREAD_TIMESTAMP = "" + DEFAULT_MESSAGE_ASUSER = false + DEFAULT_MESSAGE_PARSE = "" + DEFAULT_MESSAGE_LINK_NAMES = 0 + DEFAULT_MESSAGE_UNFURL_LINKS = false + DEFAULT_MESSAGE_UNFURL_MEDIA = true + DEFAULT_MESSAGE_ICON_URL = "" + DEFAULT_MESSAGE_ICON_EMOJI = "" + DEFAULT_MESSAGE_MARKDOWN = true + DEFAULT_MESSAGE_ESCAPE_TEXT = true ) type chatResponseFull struct { @@ -29,18 +30,19 @@ type chatResponseFull struct { // PostMessageParameters contains all the parameters necessary (including the optional ones) for a PostMessage() request type PostMessageParameters struct { - 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"` + Text string `json:"text"` + Username string `json:"user_name"` + AsUser bool `json:"as_user"` + Parse string `json:"parse"` + ThreadTimestamp string `json:"thread_ts"` + 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 @@ -142,6 +144,9 @@ func (api *Client) PostMessage(channel, text string, params PostMessageParameter if params.Markdown != DEFAULT_MESSAGE_MARKDOWN { values.Set("mrkdwn", "false") } + if params.ThreadTimestamp != DEFAULT_MESSAGE_THREAD_TIMESTAMP { + values.Set("thread_ts", params.ThreadTimestamp) + } response, err := chatRequest("chat.postMessage", values, api.debug) if err != nil { diff --git a/vendor/github.com/nlopes/slack/examples/team/team.go b/vendor/github.com/nlopes/slack/examples/team/team.go new file mode 100644 index 00000000..38223d86 --- /dev/null +++ b/vendor/github.com/nlopes/slack/examples/team/team.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + + "github.com/nlopes/slack" +) + +func main() { + api := slack.New("YOUR_TOKEN_HERE") + //Example for single user + billingActive, err := api.GetBillableInfo("U023BECGF") + if err != nil { + fmt.Printf("%s\n", err) + return + } + fmt.Printf("ID: U023BECGF, BillingActive: %v\n\n\n", billingActive["U023BECGF"]) + + //Example for team + billingActiveForTeam, err := api.GetBillableInfoForTeam() + for id, value := range billingActiveForTeam { + fmt.Printf("ID: %v, BillingActive: %v\n", id, value) + } + +} -- cgit v1.2.3