Skip to content

Commit

Permalink
feat: implement ListResponse and SearchQuery index_0 properties
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Dec 8, 2024
1 parent 1ea045f commit a760d0d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Changelog
Added
^^^^^
- Implement :meth:`Schema.get_attribute <scim2_models.Schema.get_attribute>`.
- Implement :meth:`ListResponse.start_index_0 <scim2_models.ListResponse.start_index_0>`
and :meth:`ListResponse.start_index_1 <scim2_models.ListResponse.start_index_1>`
and :meth:`SearchRequest.start_index_0 <scim2_models.SearchRequest.start_index_0>`
and :meth:`SearchRequest.start_index_1 <scim2_models.SearchRequest.start_index_1>`.

[0.2.10] - 2024-12-02
---------------------
Expand Down
14 changes: 14 additions & 0 deletions scim2_models/rfc7644/list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,17 @@ def check_results_number(
)

return obj

@property
def start_index_0(self):
"""The 0 indexed start index."""
return self.start_index - 1 if self.start_index is not None else None

@property
def stop_index_0(self):
"""The 0 indexed stop index."""
return (
self.start_index_0 + self.count
if self.start_index_0 is not None and self.count is not None
else None
)
14 changes: 14 additions & 0 deletions scim2_models/rfc7644/search_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,17 @@ def attributes_validator(self):
)

return self

@property
def start_index_0(self):
"""The 0 indexed start index."""
return self.start_index - 1 if self.start_index is not None else None

@property
def stop_index_0(self):
"""The 0 indexed stop index."""
return (
self.start_index_0 + self.count
if self.start_index_0 is not None and self.count is not None
else None
)

0 comments on commit a760d0d

Please sign in to comment.