Skip to content

Commit

Permalink
add optional parameter affecting number of returns
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanapellanes-okta committed Dec 8, 2023
1 parent 1c64f84 commit 95c4983
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions okta/api_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def has_next(self):
"""
return self._next is not None

async def next(self):
async def next(self, includeResponse=False):
"""
Generator iterating function. Retrieves the next page of results
from the API.
Expand All @@ -142,9 +142,15 @@ async def next(self):
for item in next_page:
result.append(self._type(item) if self._type in MODELS_NOT_TO_CAMEL_CASE
else self._type(APIClient.form_response_body(item)))
return (result, None, next_response)
if includeResponse:
return (result, None, next_response)
else:
return (result, None)

return (next_page, error, next_response)
if includeResponse:
return (next_page, error, next_response)
else:
return (next_page, error)

async def get_next(self):
"""
Expand Down

0 comments on commit 95c4983

Please sign in to comment.