cheshirecat-python-sdk 1.7.9__py3-none-any.whl → 1.7.10__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.
- cheshirecat_python_sdk/endpoints/admins.py +10 -89
- cheshirecat_python_sdk/models/api/admins.py +1 -7
- {cheshirecat_python_sdk-1.7.9.dist-info → cheshirecat_python_sdk-1.7.10.dist-info}/METADATA +1 -1
- {cheshirecat_python_sdk-1.7.9.dist-info → cheshirecat_python_sdk-1.7.10.dist-info}/RECORD +6 -6
- {cheshirecat_python_sdk-1.7.9.dist-info → cheshirecat_python_sdk-1.7.10.dist-info}/WHEEL +0 -0
- {cheshirecat_python_sdk-1.7.9.dist-info → cheshirecat_python_sdk-1.7.10.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
|
|
3
1
|
from cheshirecat_python_sdk.endpoints.base import AbstractEndpoint, MultipartPayload
|
|
4
2
|
from cheshirecat_python_sdk.models.api.admins import (
|
|
5
|
-
AdminOutput,
|
|
6
3
|
PluginInstallOutput,
|
|
7
4
|
PluginInstallFromRegistryOutput,
|
|
8
5
|
PluginDetailsOutput,
|
|
@@ -10,89 +7,13 @@ from cheshirecat_python_sdk.models.api.admins import (
|
|
|
10
7
|
)
|
|
11
8
|
from cheshirecat_python_sdk.models.api.nested.plugins import PluginSettingsOutput
|
|
12
9
|
from cheshirecat_python_sdk.models.api.plugins import PluginCollectionOutput, PluginsSettingsOutput, PluginToggleOutput
|
|
13
|
-
from cheshirecat_python_sdk.utils import
|
|
10
|
+
from cheshirecat_python_sdk.utils import file_attributes
|
|
14
11
|
|
|
15
12
|
|
|
16
13
|
class AdminsEndpoint(AbstractEndpoint):
|
|
17
14
|
def __init__(self, client: "CheshireCatClient"):
|
|
18
15
|
super().__init__(client)
|
|
19
|
-
self.prefix = "/
|
|
20
|
-
|
|
21
|
-
def post_admin(self, username: str, password: str, permissions: dict | None = None) -> AdminOutput:
|
|
22
|
-
"""
|
|
23
|
-
Create a new admin user.
|
|
24
|
-
:param username: The username of the user.
|
|
25
|
-
:param password: The password of the user.
|
|
26
|
-
:param permissions: The permissions of the user.
|
|
27
|
-
:return: AdminOutput, the details of the user.
|
|
28
|
-
"""
|
|
29
|
-
payload = {"username": username, "password": password}
|
|
30
|
-
if permissions:
|
|
31
|
-
payload["permissions"] = permissions # type: ignore
|
|
32
|
-
|
|
33
|
-
return self.post_json(self.format_url("/users"), self.system_id, output_class=AdminOutput, payload=payload)
|
|
34
|
-
|
|
35
|
-
def get_admins(self, limit: int | None = None, skip: int | None = None) -> List[AdminOutput]:
|
|
36
|
-
"""
|
|
37
|
-
Get a list of all admin users.
|
|
38
|
-
:param limit: The maximum number of users to return.
|
|
39
|
-
:param skip: The number of users to skip.
|
|
40
|
-
:return: List[AdminOutput], the details
|
|
41
|
-
"""
|
|
42
|
-
query = {}
|
|
43
|
-
if limit:
|
|
44
|
-
query["limit"] = limit
|
|
45
|
-
if skip:
|
|
46
|
-
query["skip"] = skip
|
|
47
|
-
|
|
48
|
-
response = self.get_http_client(self.system_id).get(self.format_url("/users"), params=query)
|
|
49
|
-
response.raise_for_status()
|
|
50
|
-
|
|
51
|
-
result = []
|
|
52
|
-
for item in response.json():
|
|
53
|
-
result.append(deserialize(item, AdminOutput))
|
|
54
|
-
return result
|
|
55
|
-
|
|
56
|
-
def get_admin(self, admin_id: str) -> AdminOutput:
|
|
57
|
-
"""
|
|
58
|
-
Get the details of an admin user.
|
|
59
|
-
:param admin_id: The ID of the user.
|
|
60
|
-
:return: AdminOutput, the details of the user.
|
|
61
|
-
"""
|
|
62
|
-
return self.get(self.format_url(f"/users/{admin_id}"), self.system_id, output_class=AdminOutput)
|
|
63
|
-
|
|
64
|
-
def put_admin(
|
|
65
|
-
self,
|
|
66
|
-
admin_id: str,
|
|
67
|
-
username: str | None = None,
|
|
68
|
-
password: str | None = None,
|
|
69
|
-
permissions: dict | None = None,
|
|
70
|
-
) -> AdminOutput:
|
|
71
|
-
"""
|
|
72
|
-
Update the details of an admin user.
|
|
73
|
-
:param admin_id: The ID of the user.
|
|
74
|
-
:param username: The new username.
|
|
75
|
-
:param password: The new password.
|
|
76
|
-
:param permissions: The new permissions.
|
|
77
|
-
:return: AdminOutput, the details of the user.
|
|
78
|
-
"""
|
|
79
|
-
payload = {}
|
|
80
|
-
if username:
|
|
81
|
-
payload["username"] = username
|
|
82
|
-
if password:
|
|
83
|
-
payload["password"] = password
|
|
84
|
-
if permissions:
|
|
85
|
-
payload["permissions"] = permissions
|
|
86
|
-
|
|
87
|
-
return self.put(self.format_url(f"/users/{admin_id}"), self.system_id, output_class=AdminOutput, payload=payload)
|
|
88
|
-
|
|
89
|
-
def delete_admin(self, admin_id: str) -> AdminOutput:
|
|
90
|
-
"""
|
|
91
|
-
Delete an admin user.
|
|
92
|
-
:param admin_id: The ID of the user.
|
|
93
|
-
:return: AdminOutput, the details of the user.
|
|
94
|
-
"""
|
|
95
|
-
return self.delete(self.format_url(f"/users/{admin_id}"), self.system_id, output_class=AdminOutput)
|
|
16
|
+
self.prefix = "/plugins"
|
|
96
17
|
|
|
97
18
|
def get_available_plugins(self, plugin_name: str | None = None) -> PluginCollectionOutput:
|
|
98
19
|
"""
|
|
@@ -101,7 +22,7 @@ class AdminsEndpoint(AbstractEndpoint):
|
|
|
101
22
|
:return: PluginCollectionOutput, the details of the plugins.
|
|
102
23
|
"""
|
|
103
24
|
return self.get(
|
|
104
|
-
self.format_url("/
|
|
25
|
+
self.format_url("/installed"),
|
|
105
26
|
self.system_id,
|
|
106
27
|
output_class=PluginCollectionOutput,
|
|
107
28
|
query={"query": plugin_name} if plugin_name else None,
|
|
@@ -113,7 +34,7 @@ class AdminsEndpoint(AbstractEndpoint):
|
|
|
113
34
|
with open(path_zip, "rb") as file:
|
|
114
35
|
payload.files = [("file", file_attributes(path_zip, file))]
|
|
115
36
|
result = self.post_multipart(
|
|
116
|
-
self.format_url("/
|
|
37
|
+
self.format_url("/install/upload"),
|
|
117
38
|
self.system_id,
|
|
118
39
|
output_class=PluginInstallOutput,
|
|
119
40
|
payload=payload,
|
|
@@ -127,7 +48,7 @@ class AdminsEndpoint(AbstractEndpoint):
|
|
|
127
48
|
:return: PluginInstallFromRegistryOutput, the details of the installation.
|
|
128
49
|
"""
|
|
129
50
|
return self.post_json(
|
|
130
|
-
self.format_url("/
|
|
51
|
+
self.format_url("/install/registry"),
|
|
131
52
|
self.system_id,
|
|
132
53
|
output_class=PluginInstallFromRegistryOutput,
|
|
133
54
|
payload={"url": url},
|
|
@@ -138,7 +59,7 @@ class AdminsEndpoint(AbstractEndpoint):
|
|
|
138
59
|
Get the default settings of all the plugins.
|
|
139
60
|
:return: PluginsSettingsOutput, the details of the settings.
|
|
140
61
|
"""
|
|
141
|
-
return self.get(self.format_url("/
|
|
62
|
+
return self.get(self.format_url("/system/settings"), self.system_id, output_class=PluginsSettingsOutput)
|
|
142
63
|
|
|
143
64
|
def get_plugin_settings(self, plugin_id: str) -> PluginSettingsOutput:
|
|
144
65
|
"""
|
|
@@ -147,7 +68,7 @@ class AdminsEndpoint(AbstractEndpoint):
|
|
|
147
68
|
:return: PluginSettingsOutput, the details of the settings.
|
|
148
69
|
"""
|
|
149
70
|
return self.get(
|
|
150
|
-
self.format_url(f"/
|
|
71
|
+
self.format_url(f"/system/settings/{plugin_id}"), self.system_id, output_class=PluginSettingsOutput
|
|
151
72
|
)
|
|
152
73
|
|
|
153
74
|
def get_plugin_details(self, plugin_id: str) -> PluginDetailsOutput:
|
|
@@ -156,7 +77,7 @@ class AdminsEndpoint(AbstractEndpoint):
|
|
|
156
77
|
:param plugin_id: The ID of the plugin.
|
|
157
78
|
:return: PluginDetailsOutput, the details of the plugin.
|
|
158
79
|
"""
|
|
159
|
-
return self.get(self.format_url(f"/
|
|
80
|
+
return self.get(self.format_url(f"/system/details/{plugin_id}"), self.system_id, output_class=PluginDetailsOutput)
|
|
160
81
|
|
|
161
82
|
def delete_plugin(self, plugin_id: str) -> PluginDeleteOutput:
|
|
162
83
|
"""
|
|
@@ -164,7 +85,7 @@ class AdminsEndpoint(AbstractEndpoint):
|
|
|
164
85
|
:param plugin_id: The ID of the plugin.
|
|
165
86
|
:return: PluginDeleteOutput, the details of the plugin.
|
|
166
87
|
"""
|
|
167
|
-
return self.delete(self.format_url(f"/
|
|
88
|
+
return self.delete(self.format_url(f"/uninstall/{plugin_id}"), self.system_id, output_class=PluginDeleteOutput)
|
|
168
89
|
|
|
169
90
|
def put_toggle_plugin(self, plugin_id: str) -> PluginToggleOutput:
|
|
170
91
|
"""
|
|
@@ -173,7 +94,7 @@ class AdminsEndpoint(AbstractEndpoint):
|
|
|
173
94
|
:return: PluginToggleOutput, the toggled plugin
|
|
174
95
|
"""
|
|
175
96
|
return self.put(
|
|
176
|
-
self.format_url(f"/
|
|
97
|
+
self.format_url(f"/system/toggle/{plugin_id}"),
|
|
177
98
|
self.system_id,
|
|
178
99
|
output_class=PluginToggleOutput,
|
|
179
100
|
)
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
from typing import Dict,
|
|
1
|
+
from typing import Dict, Any
|
|
2
2
|
from pydantic import BaseModel
|
|
3
3
|
|
|
4
4
|
from cheshirecat_python_sdk.models.api.plugins import PluginToggleOutput
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class AdminOutput(BaseModel):
|
|
8
|
-
username: str
|
|
9
|
-
permissions: Dict[str, List[str]]
|
|
10
|
-
id: str
|
|
11
|
-
|
|
12
|
-
|
|
13
7
|
class CreatedOutput(BaseModel):
|
|
14
8
|
created: bool
|
|
15
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cheshirecat-python-sdk
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.10
|
|
4
4
|
Summary: Python SDK for the Cloud-ready fork of the Cheshire Cat
|
|
5
5
|
Project-URL: Repository, https://github.com/matteocacciola/cheshirecat-python-sdk
|
|
6
6
|
Project-URL: Documentation, https://github.com/matteocacciola/cheshirecat-python-sdk#README
|
|
@@ -12,7 +12,7 @@ cheshirecat_python_sdk/clients/__init__.py,sha256=i4Hqux9vihFRbXVK48yJ1k9gm4JeCH
|
|
|
12
12
|
cheshirecat_python_sdk/clients/http_client.py,sha256=LnP0kr-kHRCwC-BZiysj1Zg-T3b3yuLd81wOctfcBTg,2319
|
|
13
13
|
cheshirecat_python_sdk/clients/websocket_client.py,sha256=xNjkLSEZhpHzRqIZL21V0oG3srAGFaqYveMqlma2gvI,1932
|
|
14
14
|
cheshirecat_python_sdk/endpoints/__init__.py,sha256=uQPclok3DdKTibR7ywDVM67eqtxEMwx_iuza37Wqkr8,1247
|
|
15
|
-
cheshirecat_python_sdk/endpoints/admins.py,sha256=
|
|
15
|
+
cheshirecat_python_sdk/endpoints/admins.py,sha256=b4YpHO-Xqkd-PQxvQcXYAUmQkrTLTvEjf5R9pals-50,4116
|
|
16
16
|
cheshirecat_python_sdk/endpoints/auth.py,sha256=_22fLGznoxo2pybcQGgcsHCpLoq76P6RplmSMMgajEQ,2031
|
|
17
17
|
cheshirecat_python_sdk/endpoints/auth_handler.py,sha256=Jfi7E7L3SIzJyECbJnUenIyl6xxkJlyC31AHpAlmqSs,2117
|
|
18
18
|
cheshirecat_python_sdk/endpoints/base.py,sha256=W_ynJur_cbT31KLp6F4pJ212tMaAa1BxnG75YS1UgNU,4075
|
|
@@ -31,7 +31,7 @@ cheshirecat_python_sdk/endpoints/users.py,sha256=PXlPPobLoWpiuAzi0k89YUyqSp24Sc5
|
|
|
31
31
|
cheshirecat_python_sdk/endpoints/utils.py,sha256=yKGrFRpu6ItLnBEuc98093LbXqGYaGdgCLiWuLQJVno,2551
|
|
32
32
|
cheshirecat_python_sdk/endpoints/vector_database.py,sha256=Xu6zcopjZgcFVVmyN547piiqFcaTUtF35X0QxQHycXQ,2149
|
|
33
33
|
cheshirecat_python_sdk/models/dtos.py,sha256=yK6CfCGdwLvZtYFPoImDEgpV5eyHB2iwji2t6dh6gxc,668
|
|
34
|
-
cheshirecat_python_sdk/models/api/admins.py,sha256=
|
|
34
|
+
cheshirecat_python_sdk/models/api/admins.py,sha256=sIX4NdEntjORgVACsqkBkzte4zwD6w35BdPRRG0D7uo,661
|
|
35
35
|
cheshirecat_python_sdk/models/api/conversations.py,sha256=Ej8677MLBqZEME1lZFd4UhHokdja762zYNjV9ZaEg-I,505
|
|
36
36
|
cheshirecat_python_sdk/models/api/factories.py,sha256=_NWz0nKhaVYEbaphxe2YZGznDIUiMKb-xqA1xymME5A,594
|
|
37
37
|
cheshirecat_python_sdk/models/api/file_managers.py,sha256=V0ZBjQWmYM1t0Qpfp3W2NDI_tScOtORB0i5YMEpTiRU,301
|
|
@@ -43,7 +43,7 @@ cheshirecat_python_sdk/models/api/tokens.py,sha256=GavSaCq0-SRWjvLtDgrYBOdUELd7V
|
|
|
43
43
|
cheshirecat_python_sdk/models/api/users.py,sha256=WR6m_V_jn5YiWYSC_H4ybpooEtdMRQAbReakT4WJgWE,232
|
|
44
44
|
cheshirecat_python_sdk/models/api/nested/memories.py,sha256=ddGDsmZa2refElM0sGz9QfKHGk50wsTpkwN5qDC5bF4,946
|
|
45
45
|
cheshirecat_python_sdk/models/api/nested/plugins.py,sha256=7vrwgXh0csaUn11YKY_OWnGEnD8Fu_ewKxt024VOBEs,738
|
|
46
|
-
cheshirecat_python_sdk-1.7.
|
|
47
|
-
cheshirecat_python_sdk-1.7.
|
|
48
|
-
cheshirecat_python_sdk-1.7.
|
|
49
|
-
cheshirecat_python_sdk-1.7.
|
|
46
|
+
cheshirecat_python_sdk-1.7.10.dist-info/METADATA,sha256=5BeA62kQ9doDPdbEQPXBufjkN9rhME7AvZh3jk_ce34,44137
|
|
47
|
+
cheshirecat_python_sdk-1.7.10.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
48
|
+
cheshirecat_python_sdk-1.7.10.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
49
|
+
cheshirecat_python_sdk-1.7.10.dist-info/RECORD,,
|
|
File without changes
|
{cheshirecat_python_sdk-1.7.9.dist-info → cheshirecat_python_sdk-1.7.10.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|