summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack/team.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-01-28 00:36:22 +0100
committerWim <wim@42.be>2017-01-28 00:36:22 +0100
commit482fbac68fde1674577f2ef722773de64416e2d8 (patch)
tree3b87950a74b4c3f0413b275ca151ad49a2e950f8 /vendor/github.com/nlopes/slack/team.go
parentdcccd434276c0e7e263e7567af63d6afd2712507 (diff)
downloadmatterbridge-msglm-482fbac68fde1674577f2ef722773de64416e2d8.tar.gz
matterbridge-msglm-482fbac68fde1674577f2ef722773de64416e2d8.tar.bz2
matterbridge-msglm-482fbac68fde1674577f2ef722773de64416e2d8.zip
Update vendor (slack)
Diffstat (limited to 'vendor/github.com/nlopes/slack/team.go')
-rw-r--r--vendor/github.com/nlopes/slack/team.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/vendor/github.com/nlopes/slack/team.go b/vendor/github.com/nlopes/slack/team.go
index d4e7899f..61b6a0a1 100644
--- a/vendor/github.com/nlopes/slack/team.go
+++ b/vendor/github.com/nlopes/slack/team.go
@@ -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)
+}