python-kanka 2.4.1__py3-none-any.whl → 2.5.0__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.
- kanka/_version.py +1 -1
- kanka/client.py +38 -2
- {python_kanka-2.4.1.dist-info → python_kanka-2.5.0.dist-info}/METADATA +1 -1
- {python_kanka-2.4.1.dist-info → python_kanka-2.5.0.dist-info}/RECORD +6 -6
- {python_kanka-2.4.1.dist-info → python_kanka-2.5.0.dist-info}/WHEEL +1 -1
- {python_kanka-2.4.1.dist-info → python_kanka-2.5.0.dist-info}/licenses/LICENSE +0 -0
kanka/_version.py
CHANGED
kanka/client.py
CHANGED
|
@@ -321,19 +321,29 @@ class KankaClient:
|
|
|
321
321
|
response = self._request("GET", f"entities/{entity_id}")
|
|
322
322
|
return response["data"] # type: ignore[no-any-return]
|
|
323
323
|
|
|
324
|
-
def entities(
|
|
324
|
+
def entities(
|
|
325
|
+
self, page: int = 1, limit: int = 15, **filters
|
|
326
|
+
) -> list[dict[str, Any]]:
|
|
325
327
|
"""Access the /entities endpoint with filters.
|
|
326
328
|
|
|
327
329
|
This endpoint provides a unified way to query entities across all types
|
|
328
330
|
with various filtering options.
|
|
329
331
|
|
|
330
332
|
Args:
|
|
333
|
+
page: Page number (default: 1)
|
|
334
|
+
limit: Number of results per page (default: 15)
|
|
331
335
|
**filters: Filter parameters like types, name, is_private, tags
|
|
332
336
|
|
|
333
337
|
Returns:
|
|
334
338
|
List of entity data
|
|
339
|
+
|
|
340
|
+
Note:
|
|
341
|
+
Pagination information is available after calling entities():
|
|
342
|
+
- client.last_entities_meta: Contains total count, current page, etc.
|
|
343
|
+
- client.last_entities_links: Contains URLs for first, last, prev, next
|
|
344
|
+
- client.entities_has_next_page: True if more pages are available
|
|
335
345
|
"""
|
|
336
|
-
params: dict[str, int | str] = {}
|
|
346
|
+
params: dict[str, int | str] = {"page": page, "limit": limit}
|
|
337
347
|
|
|
338
348
|
# Handle special filters
|
|
339
349
|
if "types" in filters and isinstance(filters["types"], list):
|
|
@@ -355,6 +365,8 @@ class KankaClient:
|
|
|
355
365
|
params[key] = filters[key]
|
|
356
366
|
|
|
357
367
|
response = self._request("GET", "entities", params=params)
|
|
368
|
+
self._last_entities_meta = response.get("meta", {})
|
|
369
|
+
self._last_entities_links = response.get("links", {})
|
|
358
370
|
return response["data"] # type: ignore[no-any-return]
|
|
359
371
|
|
|
360
372
|
def _parse_rate_limit_headers(self, response) -> float | None:
|
|
@@ -692,3 +704,27 @@ class KankaClient:
|
|
|
692
704
|
Dict[str, Any]: Links for pagination including first, last, prev, next URLs
|
|
693
705
|
"""
|
|
694
706
|
return getattr(self, "_last_search_links", {})
|
|
707
|
+
|
|
708
|
+
@property
|
|
709
|
+
def last_entities_meta(self) -> dict[str, Any]:
|
|
710
|
+
"""Get metadata from the last entities() call.
|
|
711
|
+
|
|
712
|
+
Returns:
|
|
713
|
+
Dict[str, Any]: Pagination metadata including current_page, from, to,
|
|
714
|
+
last_page, per_page, total
|
|
715
|
+
"""
|
|
716
|
+
return getattr(self, "_last_entities_meta", {})
|
|
717
|
+
|
|
718
|
+
@property
|
|
719
|
+
def last_entities_links(self) -> dict[str, Any]:
|
|
720
|
+
"""Get pagination links from the last entities() call.
|
|
721
|
+
|
|
722
|
+
Returns:
|
|
723
|
+
Dict[str, Any]: Links for pagination including first, last, prev, next URLs
|
|
724
|
+
"""
|
|
725
|
+
return getattr(self, "_last_entities_links", {})
|
|
726
|
+
|
|
727
|
+
@property
|
|
728
|
+
def entities_has_next_page(self) -> bool:
|
|
729
|
+
"""Check if more pages are available from the last entities() call."""
|
|
730
|
+
return bool(getattr(self, "_last_entities_links", {}).get("next"))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
kanka/__init__.py,sha256=S_Pl6xBtHOpUGr3eOEkq4QEMtByZx4kEWYoQfv3LLrQ,2102
|
|
2
|
-
kanka/_version.py,sha256=
|
|
3
|
-
kanka/client.py,sha256=
|
|
2
|
+
kanka/_version.py,sha256=CbCNgca30mRPFdjB04QfU2j2_o36aDbjiakPVgp44gE,67
|
|
3
|
+
kanka/client.py,sha256=r4Q0IyF0LwD8VPHB5dV2fhfLTS5tLcwUJqcEWoWoHxU,25095
|
|
4
4
|
kanka/exceptions.py,sha256=A4P7T7VO_Rp5IYldvFaecE3z4N7WYDgCDojYPu_yDzk,3871
|
|
5
5
|
kanka/managers.py,sha256=QQN4HX8CDyx8zLvJ2Bvh8f-h7xGy8E7ClY4CnYMlK5E,34225
|
|
6
6
|
kanka/py.typed,sha256=mZgbv7X8oKfyMzYIbodUlHrC15905jgP-ZbYviEIL18,86
|
|
@@ -9,7 +9,7 @@ kanka/models/__init__.py,sha256=IFdzawDK_lhS50puRunnZZalh2S5DOPU96ASHeFITUw,1329
|
|
|
9
9
|
kanka/models/base.py,sha256=GOt9I2eNb-R_2oD0fbU0LE3y9gWL0x3_2SQ9I5yuq3Y,4037
|
|
10
10
|
kanka/models/common.py,sha256=0RF33RupotK0mWjvWc9oIdQZF7ko5FNc_GG5wUIZOOE,6682
|
|
11
11
|
kanka/models/entities.py,sha256=-2ztBZn8-K8czQyd9vPnEtn4eS666v9firmk7UPDT5A,8885
|
|
12
|
-
python_kanka-2.
|
|
13
|
-
python_kanka-2.
|
|
14
|
-
python_kanka-2.
|
|
15
|
-
python_kanka-2.
|
|
12
|
+
python_kanka-2.5.0.dist-info/METADATA,sha256=-RkLCqgQEN4QtIMsePgKYupX2ZWvvZMXpo2T_-fDnpI,3249
|
|
13
|
+
python_kanka-2.5.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
14
|
+
python_kanka-2.5.0.dist-info/licenses/LICENSE,sha256=37op2CRJ_dU2qGU-iJjczcP-ljtJjpKAgBdKFaiF2GY,1067
|
|
15
|
+
python_kanka-2.5.0.dist-info/RECORD,,
|
|
File without changes
|