konecty-sdk-python 2.0.2__py3-none-any.whl → 2.0.4__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.
@@ -7,16 +7,12 @@ from typing import Any, AsyncGenerator, Dict, List, Literal, Optional, Union, ca
7
7
 
8
8
  import aiohttp
9
9
 
10
- from .exceptions import (
11
- KonectyAPIError,
12
- KonectyError,
13
- KonectyValidationError,
14
- )
10
+ from .exceptions import KonectyAPIError, KonectyError, KonectyValidationError
11
+ from .feature_types.kpi import KpiConfig
15
12
  from .file_manager import FileManager
16
13
  from .filters import KonectyFilter, KonectyFindParams
17
- from .http import request as _http_request
18
14
  from .http import StreamResponse
19
- from .feature_types.kpi import KpiConfig
15
+ from .http import request as _http_request
20
16
  from .serialization import json_serial
21
17
  from .services.aggregation import AggregationService
22
18
  from .services.change_user import ChangeUserService
@@ -104,7 +100,9 @@ class KonectyClient:
104
100
  ...
105
101
  total = result.total
106
102
  """
107
- return await self._stream.find_stream(module, options, include_total=include_total)
103
+ return await self._stream.find_stream(
104
+ module, options, include_total=include_total
105
+ )
108
106
 
109
107
  async def count_stream(
110
108
  self,
@@ -234,13 +232,9 @@ class KonectyClient:
234
232
  self, module: str, data_id: str, comment_id: str, text: str
235
233
  ) -> Any:
236
234
  """Update a comment."""
237
- return await self._comments.update_comment(
238
- module, data_id, comment_id, text
239
- )
235
+ return await self._comments.update_comment(module, data_id, comment_id, text)
240
236
 
241
- async def delete_comment(
242
- self, module: str, data_id: str, comment_id: str
243
- ) -> Any:
237
+ async def delete_comment(self, module: str, data_id: str, comment_id: str) -> Any:
244
238
  """Delete (soft) a comment."""
245
239
  return await self._comments.delete_comment(module, data_id, comment_id)
246
240
 
@@ -248,9 +242,7 @@ class KonectyClient:
248
242
  self, module: str, data_id: str, query: str = ""
249
243
  ) -> Any:
250
244
  """Search users for @mention autocomplete."""
251
- return await self._comments.search_comment_users(
252
- module, data_id, query
253
- )
245
+ return await self._comments.search_comment_users(module, data_id, query)
254
246
 
255
247
  async def search_comments(
256
248
  self,
@@ -330,21 +322,15 @@ class KonectyClient:
330
322
  self._change_user_service = ChangeUserService(self)
331
323
  return self._change_user_service
332
324
 
333
- async def change_user_add(
334
- self, module: str, ids: List[Any], users: Any
335
- ) -> Any:
325
+ async def change_user_add(self, module: str, ids: List[Any], users: Any) -> Any:
336
326
  """Add users to records."""
337
327
  return await self._change_user.add_users(module, ids, users)
338
328
 
339
- async def change_user_remove(
340
- self, module: str, ids: List[Any], users: Any
341
- ) -> Any:
329
+ async def change_user_remove(self, module: str, ids: List[Any], users: Any) -> Any:
342
330
  """Remove users from records."""
343
331
  return await self._change_user.remove_users(module, ids, users)
344
332
 
345
- async def change_user_define(
346
- self, module: str, ids: List[Any], users: Any
347
- ) -> Any:
333
+ async def change_user_define(self, module: str, ids: List[Any], users: Any) -> Any:
348
334
  """Define users on records."""
349
335
  return await self._change_user.define_users(module, ids, users)
350
336
 
@@ -662,7 +648,7 @@ class KonectyClient:
662
648
  async def get_setting(self, key: str) -> Optional[str]:
663
649
  """Obtém uma configuração do Konecty."""
664
650
  setting = await self.find_one(
665
- "Setting", KonectyFilter.create().add_condition("key", "equals", key)
651
+ "Setting", KonectyFilter.create().add_condition("name", "equals", key)
666
652
  )
667
653
  if setting is None:
668
654
  return None
@@ -671,13 +657,15 @@ class KonectyClient:
671
657
  def get_setting_sync(self, key: str) -> Optional[str]:
672
658
  """Versão síncrona de get_setting."""
673
659
  setting = self.find_one_sync(
674
- "Setting", KonectyFilter.create().add_condition("key", "equals", key)
660
+ "Setting", KonectyFilter.create().add_condition("name", "equals", key)
675
661
  )
676
662
  if setting is None:
677
663
  return None
678
664
  return cast(str, setting.get("value"))
679
665
 
680
- async def get_settings(self, keys: List[str]) -> Dict[str, str]:
666
+ async def get_settings(
667
+ self, keys: List[str], *, module: str | None = None
668
+ ) -> Dict[str, str]:
681
669
  """Obtém múltiplas configurações do Konecty.
682
670
 
683
671
  Args:
@@ -689,7 +677,9 @@ class KonectyClient:
689
677
  if not keys:
690
678
  return {}
691
679
 
692
- filter_params = KonectyFilter.create().add_condition("key", "in", keys)
680
+ filter_params = KonectyFilter.create().add_condition("name", "in", keys)
681
+ if module:
682
+ filter_params.add_condition("module", "equals", module)
693
683
  find_params = KonectyFindParams(filter=filter_params)
694
684
 
695
685
  settings = await self.find("Setting", find_params)
@@ -697,13 +687,15 @@ class KonectyClient:
697
687
  result = {}
698
688
 
699
689
  for setting in settings:
700
- key = setting.get("key")
690
+ key = setting.get("name")
701
691
  value = setting.get("value")
702
692
  result[key] = cast(str, value)
703
693
 
704
694
  return result
705
695
 
706
- def get_settings_sync(self, keys: List[str]) -> Dict[str, str]:
696
+ def get_settings_sync(
697
+ self, keys: List[str], *, module: str | None = None
698
+ ) -> Dict[str, str]:
707
699
  """Versão síncrona de get_settings.
708
700
 
709
701
  Args:
@@ -715,7 +707,9 @@ class KonectyClient:
715
707
  if not keys:
716
708
  return {}
717
709
 
718
- filter_params = KonectyFilter.create().add_condition("key", "in", keys)
710
+ filter_params = KonectyFilter.create().add_condition("name", "in", keys)
711
+ if module:
712
+ filter_params.add_condition("module", "equals", module)
719
713
  find_params = KonectyFindParams(filter=filter_params)
720
714
 
721
715
  settings = self.find_sync("Setting", find_params)
@@ -723,7 +717,7 @@ class KonectyClient:
723
717
  result = {}
724
718
 
725
719
  for setting in settings:
726
- key = setting.get("key")
720
+ key = setting.get("name")
727
721
  value = setting.get("value")
728
722
  result[key] = cast(str, value)
729
723
 
@@ -34,7 +34,7 @@ async def _build_query_result(
34
34
  total: Optional[int] = None
35
35
  meta: Optional[Dict[str, Any]] = None
36
36
  if include_total:
37
- tc = raw.headers.get("X-Total-Count")
37
+ tc = raw.headers.get("x-total-count")
38
38
  if tc is not None:
39
39
  try:
40
40
  total = int(tc)
@@ -65,7 +65,7 @@ class StreamService(BaseService):
65
65
  assert isinstance(raw, StreamResponse)
66
66
  total: Optional[int] = None
67
67
  if include_total:
68
- tc = raw.headers.get("X-Total-Count")
68
+ tc = raw.headers.get("x-total-count")
69
69
  if tc is not None:
70
70
  try:
71
71
  total = int(tc)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: konecty_sdk_python
3
- Version: 2.0.2
3
+ Version: 2.0.4
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
@@ -4,7 +4,7 @@ KonectySdkPython/cli/apply.py,sha256=LyPoNcsU3oz9P_eTAi4BdtJHWkbp-sNK_SP9W8Xua04
4
4
  KonectySdkPython/cli/backup.py,sha256=rcla3EWfPsy-vWgmDK844EaM5u3h7JF-u7-b2HUBMgA,4785
5
5
  KonectySdkPython/cli/pull.py,sha256=n4gIkKtuEpPKULb3zcYu5tZlBLbt_4oNQDeu2l6tHxU,9529
6
6
  KonectySdkPython/lib/__init__.py,sha256=Du8jLNfFG1bQuHX5u7pAhbyV9TjC7Ie9K1Xo1KSUqqc,995
7
- KonectySdkPython/lib/client.py,sha256=eN8FBn9-xGbkKkU7wZ7O1Hkl-MA4XjYEU1BUOjpsvrg,30608
7
+ KonectySdkPython/lib/client.py,sha256=tOA-IsBe1gA_4hn69lrkXK8LD-8iDRQ3rpuvUwVBsLY,30781
8
8
  KonectySdkPython/lib/exceptions.py,sha256=HR48cd-cptFPoObr37NcvDrdkb-RtxKRteQoG-tuPkk,529
9
9
  KonectySdkPython/lib/file_manager.py,sha256=CLpOJWdA1tb2iq0qOIeRyEEIuACRq9tIo7Rls1YT2ig,9986
10
10
  KonectySdkPython/lib/filters.py,sha256=PsFaUFCEyKgxgzD566LdTLvuMJevoF_i9U1WnpJZzPQ,4482
@@ -25,10 +25,10 @@ KonectySdkPython/lib/services/comments.py,sha256=RNevCg4de2FWNk7mD60-pk3r8f2sJ1N
25
25
  KonectySdkPython/lib/services/export.py,sha256=WAtSOUYx4uK1ujGHmITP77B1_l69UykhxvUBXEOG_wE,2074
26
26
  KonectySdkPython/lib/services/files.py,sha256=YvaN2yyh48pcPfv0t4PtZLxaDxQlQrGnzIAwnEYN5Ag,1843
27
27
  KonectySdkPython/lib/services/notifications.py,sha256=7AtCBbBl-YAz_RBIW6bzoKvuwsYqAUVnLBnS4uAlMWQ,1446
28
- KonectySdkPython/lib/services/query.py,sha256=-LYHwEz3xUdj96K6L5fWBp-eTsSYoiLkY_gIkVqOSug,6605
29
- KonectySdkPython/lib/services/stream.py,sha256=Yf3I1AyTnlzhl5Ics2YufAxcQozc88V8giQ7FnQV0d8,4737
28
+ KonectySdkPython/lib/services/query.py,sha256=vCqbf0QdV8Blh8Hfsvq6Ne1-YFuC5siw1gVa7ZBGs_k,6605
29
+ KonectySdkPython/lib/services/stream.py,sha256=1DMVxcg9Ymk2NgX0Qfvpjrr6vZJo5iFovPFT1NA3_CY,4737
30
30
  KonectySdkPython/lib/services/subscriptions.py,sha256=_Jq8jW7YkL_hwLNte1bWgrr4D2EMZUUSOXUgnRoGGK4,1022
31
- konecty_sdk_python-2.0.2.dist-info/METADATA,sha256=ED73ue4kDcvGvQaWZ70A_8JMGqsoKOeg_Ub20nSWaXI,1622
32
- konecty_sdk_python-2.0.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
33
- konecty_sdk_python-2.0.2.dist-info/entry_points.txt,sha256=awf962DamFgy791G3PsJ354edBMLJg16Dqi-2Y1tb9s,58
34
- konecty_sdk_python-2.0.2.dist-info/RECORD,,
31
+ konecty_sdk_python-2.0.4.dist-info/METADATA,sha256=DLB0V_BAvLX0DEBULTk0K8vvIfV-Hsby_OVdzTiQAS8,1622
32
+ konecty_sdk_python-2.0.4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
33
+ konecty_sdk_python-2.0.4.dist-info/entry_points.txt,sha256=awf962DamFgy791G3PsJ354edBMLJg16Dqi-2Y1tb9s,58
34
+ konecty_sdk_python-2.0.4.dist-info/RECORD,,