I checked an updated version of SDK and was little bit puzzled by methods client.listUsers and client.listUserGroups which both return some form of Collection. The problem is, I can’t get the number of items in the collection, or at least to check if it’s empty.
Is the only one method to do that is to attempt to iterate and calculate? Or am I missing something obvious?
You might ask this at Okta Node Management SDK GH to see if there is a better way. The Okta /users API uses pagination, and the Okta Node Management SDK Collections encapsulates this for you by retrieving batches of users as you iterate through the collection. Once empty the next batch is retrieved from Okta until all users have been retrieved. To avoid iterating through each user you could do something like,
Thanks @erik , it’s something I was thinking about as a backup solution. I actually only needed to know if it’s empty or not, and I see some hints in your code snippet.