@@ -6,11 +6,6 @@ import (
66 "strconv"
77)
88
9- const (
10- DEFAULT_LOGINS_COUNT = 100
11- DEFAULT_LOGINS_PAGE = 1
12- )
13-
149type TeamResponse struct {
1510 Team TeamInfo `json:"team"`
1611 SlackResponse
@@ -46,8 +41,8 @@ type TeamProfileField struct {
4641
4742type LoginResponse struct {
4843 Logins []Login `json:"logins"`
49- Paging `json:"paging"`
5044 SlackResponse
45+ ResponseMetadata `json:"response_metadata"`
5146}
5247
5348type Login struct {
@@ -75,16 +70,14 @@ type BillingActive struct {
7570// AccessLogParameters contains all the parameters necessary (including the optional ones) for a GetAccessLogs() request
7671type AccessLogParameters struct {
7772 TeamID string
78- Count int
79- Page int
73+ Cursor string
74+ Limit int
75+ Before int
8076}
8177
8278// NewAccessLogParameters provides an instance of AccessLogParameters with all the sane default values set
8379func NewAccessLogParameters () AccessLogParameters {
84- return AccessLogParameters {
85- Count : DEFAULT_LOGINS_COUNT ,
86- Page : DEFAULT_LOGINS_PAGE ,
87- }
80+ return AccessLogParameters {}
8881}
8982
9083func (api * Client ) teamRequest (ctx context.Context , path string , values url.Values ) (* TeamResponse , error ) {
@@ -193,31 +186,34 @@ func (api *Client) GetTeamProfileContext(ctx context.Context, teamID ...string)
193186
194187// GetAccessLogs retrieves a page of logins according to the parameters given.
195188// For more information see the GetAccessLogsContext documentation.
196- func (api * Client ) GetAccessLogs (params AccessLogParameters ) ([]Login , * Paging , error ) {
189+ func (api * Client ) GetAccessLogs (params AccessLogParameters ) ([]Login , string , error ) {
197190 return api .GetAccessLogsContext (context .Background (), params )
198191}
199192
200193// GetAccessLogsContext retrieves a page of logins according to the parameters given with a custom context.
201194// Slack API docs: https://api.slack.com/methods/team.accessLogs
202- func (api * Client ) GetAccessLogsContext (ctx context.Context , params AccessLogParameters ) ([]Login , * Paging , error ) {
195+ func (api * Client ) GetAccessLogsContext (ctx context.Context , params AccessLogParameters ) ([]Login , string , error ) {
203196 values := url.Values {
204197 "token" : {api .token },
205198 }
206199 if params .TeamID != "" {
207200 values .Add ("team_id" , params .TeamID )
208201 }
209- if params .Count != DEFAULT_LOGINS_COUNT {
210- values .Add ("count" , strconv .Itoa (params .Count ))
202+ if params .Cursor != "" {
203+ values .Add ("cursor" , params .Cursor )
204+ }
205+ if params .Limit != 0 {
206+ values .Add ("limit" , strconv .Itoa (params .Limit ))
211207 }
212- if params .Page != DEFAULT_LOGINS_PAGE {
213- values .Add ("page " , strconv .Itoa (params .Page ))
208+ if params .Before != 0 {
209+ values .Add ("before " , strconv .Itoa (params .Before ))
214210 }
215211
216212 response , err := api .accessLogsRequest (ctx , "team.accessLogs" , values )
217213 if err != nil {
218- return nil , nil , err
214+ return nil , "" , err
219215 }
220- return response .Logins , & response .Paging , nil
216+ return response .Logins , response .ResponseMetadata . Cursor , nil
221217}
222218
223219type GetBillableInfoParams struct {
0 commit comments