summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack/team.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/nlopes/slack/team.go')
-rw-r--r--vendor/github.com/nlopes/slack/team.go29
1 files changed, 15 insertions, 14 deletions
diff --git a/vendor/github.com/nlopes/slack/team.go b/vendor/github.com/nlopes/slack/team.go
index e70ac57e..b6e341eb 100644
--- a/vendor/github.com/nlopes/slack/team.go
+++ b/vendor/github.com/nlopes/slack/team.go
@@ -67,9 +67,9 @@ func NewAccessLogParameters() AccessLogParameters {
}
}
-func teamRequest(ctx context.Context, path string, values url.Values, debug bool) (*TeamResponse, error) {
+func teamRequest(ctx context.Context, client HTTPRequester, path string, values url.Values, debug bool) (*TeamResponse, error) {
response := &TeamResponse{}
- err := post(ctx, path, values, response, debug)
+ err := postSlackMethod(ctx, client, path, values, response, debug)
if err != nil {
return nil, err
}
@@ -81,9 +81,9 @@ func teamRequest(ctx context.Context, path string, values url.Values, debug bool
return response, nil
}
-func billableInfoRequest(ctx context.Context, path string, values url.Values, debug bool) (map[string]BillingActive, error) {
+func billableInfoRequest(ctx context.Context, client HTTPRequester, path string, values url.Values, debug bool) (map[string]BillingActive, error) {
response := &BillableInfoResponse{}
- err := post(ctx, path, values, response, debug)
+ err := postSlackMethod(ctx, client, path, values, response, debug)
if err != nil {
return nil, err
}
@@ -95,9 +95,9 @@ func billableInfoRequest(ctx context.Context, path string, values url.Values, de
return response.BillableInfo, nil
}
-func accessLogsRequest(ctx context.Context, path string, values url.Values, debug bool) (*LoginResponse, error) {
+func accessLogsRequest(ctx context.Context, client HTTPRequester, path string, values url.Values, debug bool) (*LoginResponse, error) {
response := &LoginResponse{}
- err := post(ctx, path, values, response, debug)
+ err := postSlackMethod(ctx, client, path, values, response, debug)
if err != nil {
return nil, err
}
@@ -115,10 +115,10 @@ func (api *Client) GetTeamInfo() (*TeamInfo, error) {
// GetTeamInfoContext gets the Team Information of the user with a custom context
func (api *Client) GetTeamInfoContext(ctx context.Context) (*TeamInfo, error) {
values := url.Values{
- "token": {api.config.token},
+ "token": {api.token},
}
- response, err := teamRequest(ctx, "team.info", values, api.debug)
+ response, err := teamRequest(ctx, api.httpclient, "team.info", values, api.debug)
if err != nil {
return nil, err
}
@@ -133,7 +133,7 @@ func (api *Client) GetAccessLogs(params AccessLogParameters) ([]Login, *Paging,
// GetAccessLogsContext retrieves a page of logins according to the parameters given with a custom context
func (api *Client) GetAccessLogsContext(ctx context.Context, params AccessLogParameters) ([]Login, *Paging, error) {
values := url.Values{
- "token": {api.config.token},
+ "token": {api.token},
}
if params.Count != DEFAULT_LOGINS_COUNT {
values.Add("count", strconv.Itoa(params.Count))
@@ -141,7 +141,8 @@ func (api *Client) GetAccessLogsContext(ctx context.Context, params AccessLogPar
if params.Page != DEFAULT_LOGINS_PAGE {
values.Add("page", strconv.Itoa(params.Page))
}
- response, err := accessLogsRequest(ctx, "team.accessLogs", values, api.debug)
+
+ response, err := accessLogsRequest(ctx, api.httpclient, "team.accessLogs", values, api.debug)
if err != nil {
return nil, nil, err
}
@@ -154,11 +155,11 @@ func (api *Client) GetBillableInfo(user string) (map[string]BillingActive, error
func (api *Client) GetBillableInfoContext(ctx context.Context, user string) (map[string]BillingActive, error) {
values := url.Values{
- "token": {api.config.token},
+ "token": {api.token},
"user": {user},
}
- return billableInfoRequest(ctx, "team.billableInfo", values, api.debug)
+ return billableInfoRequest(ctx, api.httpclient, "team.billableInfo", values, api.debug)
}
// GetBillableInfoForTeam returns the billing_active status of all users on the team.
@@ -169,8 +170,8 @@ func (api *Client) GetBillableInfoForTeam() (map[string]BillingActive, error) {
// GetBillableInfoForTeamContext returns the billing_active status of all users on the team with a custom context
func (api *Client) GetBillableInfoForTeamContext(ctx context.Context) (map[string]BillingActive, error) {
values := url.Values{
- "token": {api.config.token},
+ "token": {api.token},
}
- return billableInfoRequest(ctx, "team.billableInfo", values, api.debug)
+ return billableInfoRequest(ctx, api.httpclient, "team.billableInfo", values, api.debug)
}