finalsa-common-models 2.1.0__py3-none-any.whl → 2.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- finalsa/common/models/models/pagination.py +12 -0
- {finalsa_common_models-2.1.0.dist-info → finalsa_common_models-2.1.2.dist-info}/METADATA +3 -3
- {finalsa_common_models-2.1.0.dist-info → finalsa_common_models-2.1.2.dist-info}/RECORD +5 -5
- {finalsa_common_models-2.1.0.dist-info → finalsa_common_models-2.1.2.dist-info}/WHEEL +0 -0
- {finalsa_common_models-2.1.0.dist-info → finalsa_common_models-2.1.2.dist-info}/licenses/LICENSE.md +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from typing import Any, Dict, Generic, Optional, Sequence, TypeVar
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
4
|
+
from orjson import loads
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
ItemT = TypeVar("ItemT")
|
|
@@ -22,6 +23,17 @@ class PaginationRequest(BaseModel):
|
|
|
22
23
|
description="DynamoDB ExclusiveStartKey encoded in the request.",
|
|
23
24
|
)
|
|
24
25
|
|
|
26
|
+
@classmethod
|
|
27
|
+
def from_request(cls, request: Any) -> "PaginationRequest":
|
|
28
|
+
"""Parse query params into PaginationRequest. Handles JSON-encoded 'from' param."""
|
|
29
|
+
params = request.query_params
|
|
30
|
+
data = {}
|
|
31
|
+
if limit := params.get("limit"):
|
|
32
|
+
data["limit"] = int(limit)
|
|
33
|
+
if from_param := params.get("from"):
|
|
34
|
+
data["exclusive_start_key"] = loads(from_param)
|
|
35
|
+
return PaginationRequest(**data, **request.path_params)
|
|
36
|
+
|
|
25
37
|
|
|
26
38
|
class PaginationMeta(BaseModel):
|
|
27
39
|
"""Generic metadata that can be attached to a paginated response."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: finalsa-common-models
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.2
|
|
4
4
|
Summary: Common models for Finalsa
|
|
5
5
|
Project-URL: Homepage, https://github.com/finalsa/finalsa-common-models
|
|
6
6
|
Author-email: Luis Jimenez <luis@finalsa.com>
|
|
@@ -28,8 +28,8 @@ License: MIT License
|
|
|
28
28
|
License-File: LICENSE.md
|
|
29
29
|
Keywords: common,finalsa,models
|
|
30
30
|
Requires-Python: >=3.10
|
|
31
|
-
Requires-Dist: orjson>=3.11.
|
|
32
|
-
Requires-Dist: pydantic>=2.
|
|
31
|
+
Requires-Dist: orjson>=3.11.6
|
|
32
|
+
Requires-Dist: pydantic>=2.12.5
|
|
33
33
|
Requires-Dist: python-dateutil>=2.9.0.post0
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
|
|
@@ -4,9 +4,9 @@ finalsa/common/models/exceptions/base_domain_exception.py,sha256=SWp6B41nfAxQyOF
|
|
|
4
4
|
finalsa/common/models/models/__init__.py,sha256=kiHCRA5pZwIDXfAryWO7ir1SGHUlwNtDclD6B26KIpo,619
|
|
5
5
|
finalsa/common/models/models/functions.py,sha256=vKUrhl3AVfnYBqqKYpZbZevrBpUx7ywqhtU3KKPqWUE,2983
|
|
6
6
|
finalsa/common/models/models/meta.py,sha256=VKBmzkBs1W6so9bmTXO5kIIQ2f3MzrTdZhz4bHG1FsQ,711
|
|
7
|
-
finalsa/common/models/models/pagination.py,sha256=
|
|
7
|
+
finalsa/common/models/models/pagination.py,sha256=_aWize8lixoxlWDVlK3IDABRGLUIHrTNIsANMA-UVtc,3601
|
|
8
8
|
finalsa/common/models/models/sqs_response.py,sha256=GKkDyWYeYEUCRHp2H8MjxvzFuwWL1ngzpf5zILhVUNg,2258
|
|
9
|
-
finalsa_common_models-2.1.
|
|
10
|
-
finalsa_common_models-2.1.
|
|
11
|
-
finalsa_common_models-2.1.
|
|
12
|
-
finalsa_common_models-2.1.
|
|
9
|
+
finalsa_common_models-2.1.2.dist-info/METADATA,sha256=H1XXG2nQhSFRvleYiSAiSkeS5abVC30Go-JkLNguBSc,3053
|
|
10
|
+
finalsa_common_models-2.1.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
11
|
+
finalsa_common_models-2.1.2.dist-info/licenses/LICENSE.md,sha256=yqzhfnTBr2S4lUBx-yibVPOIXRUDPrSUN9-_7AsC6OU,1084
|
|
12
|
+
finalsa_common_models-2.1.2.dist-info/RECORD,,
|
|
File without changes
|
{finalsa_common_models-2.1.0.dist-info → finalsa_common_models-2.1.2.dist-info}/licenses/LICENSE.md
RENAMED
|
File without changes
|