konecty-sdk-python 2.0.3__tar.gz → 2.0.5__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.
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/client.py +57 -34
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/PKG-INFO +1 -1
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/pyproject.toml +1 -1
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/.gitignore +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/__init__.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/cli/__init__.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/cli/apply.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/cli/backup.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/cli/pull.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/__init__.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/exceptions.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/feature_types/__init__.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/feature_types/cross_module_query.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/feature_types/kpi.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/feature_types/query_json.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/file_manager.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/filters.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/http.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/model.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/serialization.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/__init__.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/aggregation.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/base.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/change_user.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/comments.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/export.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/files.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/notifications.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/query.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/stream.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/subscriptions.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/settings.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/types.py +0 -0
- {konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/README.md +0 -0
|
@@ -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
|
-
|
|
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 .
|
|
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(
|
|
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
|
|
|
@@ -477,6 +463,35 @@ class KonectyClient:
|
|
|
477
463
|
raise KonectyAPIError(errors)
|
|
478
464
|
data = result.get("data", [])
|
|
479
465
|
return cast(List[KonectyDict], data)
|
|
466
|
+
|
|
467
|
+
async def lookup(self, module: str, lookup_field: str, options: KonectyFindParams, search: str = "") -> List[KonectyDict]:
|
|
468
|
+
params: Dict[str, str] = {}
|
|
469
|
+
for key, value in options.model_dump(exclude_none=True).items():
|
|
470
|
+
params[key] = (
|
|
471
|
+
json.dumps(value, default=json_serial)
|
|
472
|
+
if key != "fields"
|
|
473
|
+
else ",".join(value)
|
|
474
|
+
)
|
|
475
|
+
if search:
|
|
476
|
+
params["search"] = search
|
|
477
|
+
|
|
478
|
+
print(f"params: {params}")
|
|
479
|
+
async with (
|
|
480
|
+
aiohttp.ClientSession() as session,
|
|
481
|
+
session.get(
|
|
482
|
+
f"{self.base_url}/rest/data/{module}/lookup/{lookup_field}",
|
|
483
|
+
params=params,
|
|
484
|
+
headers={"Authorization": self.headers["Authorization"]},
|
|
485
|
+
) as response,
|
|
486
|
+
):
|
|
487
|
+
response.raise_for_status()
|
|
488
|
+
result = await response.json()
|
|
489
|
+
if not result.get("success", False):
|
|
490
|
+
errors = result.get("errors", [])
|
|
491
|
+
logger.error(errors)
|
|
492
|
+
raise KonectyAPIError(errors)
|
|
493
|
+
data = result.get("data", [])
|
|
494
|
+
return cast(List[KonectyDict], data)
|
|
480
495
|
|
|
481
496
|
def find_sync(self, module: str, options: KonectyFindParams) -> List[KonectyDict]:
|
|
482
497
|
"""Versão síncrona de find."""
|
|
@@ -662,7 +677,7 @@ class KonectyClient:
|
|
|
662
677
|
async def get_setting(self, key: str) -> Optional[str]:
|
|
663
678
|
"""Obtém uma configuração do Konecty."""
|
|
664
679
|
setting = await self.find_one(
|
|
665
|
-
"Setting", KonectyFilter.create().add_condition("
|
|
680
|
+
"Setting", KonectyFilter.create().add_condition("name", "equals", key)
|
|
666
681
|
)
|
|
667
682
|
if setting is None:
|
|
668
683
|
return None
|
|
@@ -671,13 +686,15 @@ class KonectyClient:
|
|
|
671
686
|
def get_setting_sync(self, key: str) -> Optional[str]:
|
|
672
687
|
"""Versão síncrona de get_setting."""
|
|
673
688
|
setting = self.find_one_sync(
|
|
674
|
-
"Setting", KonectyFilter.create().add_condition("
|
|
689
|
+
"Setting", KonectyFilter.create().add_condition("name", "equals", key)
|
|
675
690
|
)
|
|
676
691
|
if setting is None:
|
|
677
692
|
return None
|
|
678
693
|
return cast(str, setting.get("value"))
|
|
679
694
|
|
|
680
|
-
async def get_settings(
|
|
695
|
+
async def get_settings(
|
|
696
|
+
self, keys: List[str], *, module: str | None = None
|
|
697
|
+
) -> Dict[str, str]:
|
|
681
698
|
"""Obtém múltiplas configurações do Konecty.
|
|
682
699
|
|
|
683
700
|
Args:
|
|
@@ -689,7 +706,9 @@ class KonectyClient:
|
|
|
689
706
|
if not keys:
|
|
690
707
|
return {}
|
|
691
708
|
|
|
692
|
-
filter_params = KonectyFilter.create().add_condition("
|
|
709
|
+
filter_params = KonectyFilter.create().add_condition("name", "in", keys)
|
|
710
|
+
if module:
|
|
711
|
+
filter_params.add_condition("module", "equals", module)
|
|
693
712
|
find_params = KonectyFindParams(filter=filter_params)
|
|
694
713
|
|
|
695
714
|
settings = await self.find("Setting", find_params)
|
|
@@ -697,13 +716,15 @@ class KonectyClient:
|
|
|
697
716
|
result = {}
|
|
698
717
|
|
|
699
718
|
for setting in settings:
|
|
700
|
-
key = setting.get("
|
|
719
|
+
key = setting.get("name")
|
|
701
720
|
value = setting.get("value")
|
|
702
721
|
result[key] = cast(str, value)
|
|
703
722
|
|
|
704
723
|
return result
|
|
705
724
|
|
|
706
|
-
def get_settings_sync(
|
|
725
|
+
def get_settings_sync(
|
|
726
|
+
self, keys: List[str], *, module: str | None = None
|
|
727
|
+
) -> Dict[str, str]:
|
|
707
728
|
"""Versão síncrona de get_settings.
|
|
708
729
|
|
|
709
730
|
Args:
|
|
@@ -715,7 +736,9 @@ class KonectyClient:
|
|
|
715
736
|
if not keys:
|
|
716
737
|
return {}
|
|
717
738
|
|
|
718
|
-
filter_params = KonectyFilter.create().add_condition("
|
|
739
|
+
filter_params = KonectyFilter.create().add_condition("name", "in", keys)
|
|
740
|
+
if module:
|
|
741
|
+
filter_params.add_condition("module", "equals", module)
|
|
719
742
|
find_params = KonectyFindParams(filter=filter_params)
|
|
720
743
|
|
|
721
744
|
settings = self.find_sync("Setting", find_params)
|
|
@@ -723,7 +746,7 @@ class KonectyClient:
|
|
|
723
746
|
result = {}
|
|
724
747
|
|
|
725
748
|
for setting in settings:
|
|
726
|
-
key = setting.get("
|
|
749
|
+
key = setting.get("name")
|
|
727
750
|
value = setting.get("value")
|
|
728
751
|
result[key] = cast(str, value)
|
|
729
752
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/feature_types/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/feature_types/kpi.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/__init__.py
RENAMED
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/aggregation.py
RENAMED
|
File without changes
|
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/change_user.py
RENAMED
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/comments.py
RENAMED
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/export.py
RENAMED
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/files.py
RENAMED
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/notifications.py
RENAMED
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/query.py
RENAMED
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/stream.py
RENAMED
|
File without changes
|
{konecty_sdk_python-2.0.3 → konecty_sdk_python-2.0.5}/KonectySdkPython/lib/services/subscriptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|