onecli-sdk 0.1.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.
- onecli/__init__.py +97 -0
- onecli/_agent_env.py +238 -0
- onecli/_async/__init__.py +1 -0
- onecli/_async/_client.py +431 -0
- onecli/_async/_connected_agent.py +184 -0
- onecli/_async/_http.py +330 -0
- onecli/_async/_io.py +118 -0
- onecli/_async/_resources.py +1293 -0
- onecli/_errors.py +106 -0
- onecli/_js.py +122 -0
- onecli/_keys.py +101 -0
- onecli/_lifetime.py +110 -0
- onecli/_retry.py +116 -0
- onecli/_sync/__init__.py +1 -0
- onecli/_sync/_client.py +426 -0
- onecli/_sync/_connected_agent.py +185 -0
- onecli/_sync/_http.py +329 -0
- onecli/_sync/_io.py +110 -0
- onecli/_sync/_resources.py +1286 -0
- onecli/_url.py +264 -0
- onecli/_version.py +19 -0
- onecli/_wire.py +469 -0
- onecli/gateway.py +454 -0
- onecli/py.typed +0 -0
- onecli/types/__init__.py +229 -0
- onecli/types/_base.py +42 -0
- onecli/types/_openapi.py +1590 -0
- onecli_sdk-0.1.0.dist-info/METADATA +354 -0
- onecli_sdk-0.1.0.dist-info/RECORD +31 -0
- onecli_sdk-0.1.0.dist-info/WHEEL +4 -0
- onecli_sdk-0.1.0.dist-info/licenses/LICENSE +21 -0
onecli/types/_base.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""The base of every model the SDK reads from or sends to the API."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, ClassVar
|
|
6
|
+
|
|
7
|
+
from pydantic import (
|
|
8
|
+
BaseModel,
|
|
9
|
+
ConfigDict,
|
|
10
|
+
ValidationError,
|
|
11
|
+
ValidatorFunctionWrapHandler,
|
|
12
|
+
WrapValidator,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
__all__ = ["Model", "OpenEnum"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Model(BaseModel):
|
|
19
|
+
"""A shape of the OneCLI API.
|
|
20
|
+
|
|
21
|
+
Attributes have Python names (``vault_id``); ``model_dump(by_alias=True)``
|
|
22
|
+
gives the API's own names (``vaultId``). A field the SDK does not know yet
|
|
23
|
+
is kept: read it with ``model_extra``.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
model_config: ClassVar[ConfigDict] = ConfigDict(
|
|
27
|
+
extra="allow", validate_by_name=True, validate_by_alias=True
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _open_enum(value: Any, handler: ValidatorFunctionWrapHandler) -> Any: # noqa: ANN401
|
|
32
|
+
"""Keep a text value the enum does not list: a newer server may send one."""
|
|
33
|
+
try:
|
|
34
|
+
return handler(value)
|
|
35
|
+
except ValidationError:
|
|
36
|
+
if isinstance(value, str):
|
|
37
|
+
return value
|
|
38
|
+
raise
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
OpenEnum = WrapValidator(_open_enum)
|
|
42
|
+
"""Read an enum open: a value it does not list is kept as text, never refused."""
|