konecty_sdk_python 2.1.5__tar.gz → 2.1.6__tar.gz

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.
Files changed (37) hide show
  1. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/client.py +34 -17
  2. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/PKG-INFO +1 -1
  3. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/pyproject.toml +1 -1
  4. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/.gitignore +0 -0
  5. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/__init__.py +0 -0
  6. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/cli/__init__.py +0 -0
  7. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/cli/apply.py +0 -0
  8. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/cli/backup.py +0 -0
  9. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/cli/pull.py +0 -0
  10. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/__init__.py +0 -0
  11. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/exceptions.py +0 -0
  12. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/feature_types/__init__.py +0 -0
  13. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/feature_types/cross_module_query.py +0 -0
  14. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/feature_types/kpi.py +0 -0
  15. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/feature_types/query_json.py +0 -0
  16. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/file_manager.py +0 -0
  17. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/filters.py +0 -0
  18. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/http.py +0 -0
  19. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/model.py +0 -0
  20. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/serialization.py +0 -0
  21. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/__init__.py +0 -0
  22. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/admin.py +0 -0
  23. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/aggregation.py +0 -0
  24. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/auth.py +0 -0
  25. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/base.py +0 -0
  26. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/change_user.py +0 -0
  27. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/comments.py +0 -0
  28. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/export.py +0 -0
  29. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/files.py +0 -0
  30. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/notifications.py +0 -0
  31. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/pat.py +0 -0
  32. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/query.py +0 -0
  33. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/stream.py +0 -0
  34. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/services/subscriptions.py +0 -0
  35. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/settings.py +0 -0
  36. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/KonectySdkPython/lib/types.py +0 -0
  37. {konecty_sdk_python-2.1.5 → konecty_sdk_python-2.1.6}/README.md +0 -0
@@ -52,6 +52,25 @@ KONECTY_UPDATE_IGNORE_FIELDS = [
52
52
  KONECTY_CREATE_IGNORE_FIELDS = ["_updatedAt", "_createdAt", "_updatedBy", "_createdBy"]
53
53
 
54
54
 
55
+ def _find_query_params(options: KonectyFindParams, get_total: bool) -> Dict[str, str]:
56
+ """Query string de /rest/data/{module}/find.
57
+
58
+ `getTotal=false` só vai para a rede quando a contagem é desligada: com o
59
+ padrão a query fica idêntica à de antes. Paridade com `KonectyClient.find` do
60
+ SDK TypeScript, que também só envia o desligamento, sempre no fim da query.
61
+ """
62
+ params: Dict[str, str] = {}
63
+ for key, value in options.model_dump(exclude_none=True).items():
64
+ params[key] = (
65
+ json.dumps(value, default=json_serial)
66
+ if key != "fields"
67
+ else ",".join(value)
68
+ )
69
+ if get_total is False:
70
+ params["getTotal"] = "false"
71
+ return params
72
+
73
+
55
74
  def get_first_dict(items: List[Any]) -> Optional[KonectyDict]:
56
75
  """Retorna o primeiro item de uma lista como dicionário ou None se estiver vazia."""
57
76
  if not items:
@@ -655,14 +674,16 @@ class KonectyClient:
655
674
  query_id, shared_with, is_public=is_public
656
675
  )
657
676
 
658
- async def find(self, module: str, options: KonectyFindParams) -> List[KonectyDict]:
659
- params: Dict[str, str] = {}
660
- for key, value in options.model_dump(exclude_none=True).items():
661
- params[key] = (
662
- json.dumps(value, default=json_serial)
663
- if key != "fields"
664
- else ",".join(value)
665
- )
677
+ async def find(
678
+ self, module: str, options: KonectyFindParams, get_total: bool = True
679
+ ) -> List[KonectyDict]:
680
+ """Busca registros em GET /rest/data/{module}/find.
681
+
682
+ `get_total=False` pede ao servidor para não contar o total (a resposta vem
683
+ sem `total`), o que acelera listagens grandes quando o total não é
684
+ necessário. Com o padrão (`True`) nada é enviado e a URL é a mesma de antes.
685
+ """
686
+ params = _find_query_params(options, get_total)
666
687
 
667
688
  async with (
668
689
  aiohttp.ClientSession() as session,
@@ -716,15 +737,11 @@ class KonectyClient:
716
737
  data = result.get("data", [])
717
738
  return cast(List[KonectyDict], data)
718
739
 
719
- def find_sync(self, module: str, options: KonectyFindParams) -> List[KonectyDict]:
720
- """Versão síncrona de find."""
721
- params: Dict[str, str] = {}
722
- for key, value in options.model_dump(exclude_none=True).items():
723
- params[key] = (
724
- json.dumps(value, default=json_serial)
725
- if key != "fields"
726
- else ",".join(value)
727
- )
740
+ def find_sync(
741
+ self, module: str, options: KonectyFindParams, get_total: bool = True
742
+ ) -> List[KonectyDict]:
743
+ """Versão síncrona de find (mesma semântica de `get_total`)."""
744
+ params = _find_query_params(options, get_total)
728
745
 
729
746
  import requests
730
747
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: konecty_sdk_python
3
- Version: 2.1.5
3
+ Version: 2.1.6
4
4
  Summary: Konecty SDK Python
5
5
  Author-email: Leonardo Leal <leonardo.leal@konecty.com>, Derotino Silveira <derotino.silveira@konecty.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "konecty_sdk_python"
3
- version = "2.1.5"
3
+ version = "2.1.6"
4
4
  description = "Konecty SDK Python"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"