func (a *Api) pdUsers() ([]pagerduty.User, error) {
	var users []pagerduty.User

	pageLimit := uint(25)
	listOpts := pagerduty.APIListObject{
		Offset: 0,
		Limit:  pageLimit,
	}
	opts := pagerduty.ListUsersOptions{APIListObject: listOpts}

	for {
		res, err := a.client.ListUsers(opts)
		if err != nil {
			return users, fmt.Errorf("Failed to list PagerDuty users: %s", err)
		}

		users = append(users, res.Users...)
		listOpts.Offset += pageLimit
		opts = pagerduty.ListUsersOptions{APIListObject: listOpts}

		if res.APIListObject.More != true {
			return users, nil
		}
	}
	return users, nil
}
// pdUsers returns a list of PagerDuty users.
// Pagination is required by the PagerDuty API, so this may make multiple calls.
pdUsers returns a list of PagerDuty users.
Pagination is required by the PagerDuty API, so this may make multiple calls.
// pdUsers returns a list of PagerDuty users . // Pagination is required by the PagerDuty API so this may make multiple calls .
func (a *Api) pdUsers() ([]pagerduty.User, error) {
	var users []pagerduty.User
	pageLimit := uint(25)
	listOpts := pagerduty.APIListObject{
		Offset: 0,
		Limit:  pageLimit,
	}
	opts := pagerduty.ListUsersOptions{APIListObject: listOpts}
	for {
		res, err := a.client.ListUsers(opts)
		if err != nil {
			return users, fmt.Errorf("Failed to list PagerDuty users: %s", err)
		}
		users = append(users, res.Users...)
		listOpts.Offset += pageLimit
		opts = pagerduty.ListUsersOptions{APIListObject: listOpts}
		if res.APIListObject.More != true {
			return users, nil
		}
	}
	return users, nil
}
func ( a * Api ) pdUsers ( ) ( [ ] pagerduty . User , error ) { var users [ ] pagerduty . User pageLimit := uint ( 25 ) listOpts := pagerduty . APIListObject { Offset : 0 , Limit : pageLimit , } opts := pagerduty . ListUsersOptions { APIListObject : listOpts } for { res , err := a . client . ListUsers ( opts ) if err != nil { return users , fmt . Errorf ( " " , err ) } users = append ( users , res . Users ... ) listOpts . Offset += pageLimit opts = pagerduty . ListUsersOptions { APIListObject : listOpts } if res . APIListObject . More != true { return users , nil } } return users , nil }
pdUsers returns a list of PagerDuty users.
pdUsers returns a list of PagerDuty users .