forked from lug/matterbridge
Update vendor (slack)
This commit is contained in:
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user