exist-client 0.1.0__tar.gz → 0.1.2.dev2__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.
- {exist_client-0.1.0 → exist_client-0.1.2.dev2}/PKG-INFO +4 -1
- exist_client-0.1.2.dev2/pyproject.toml +77 -0
- exist_client-0.1.2.dev2/src/exist_client/__init__.py +3 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/__init__.py +7 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/api/__init__.py +1 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/api/default/access_token.py +134 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/api/default/accounts_profile.py +120 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/api/default/attribute_values_get.py +166 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/api/default/attributes_acquire.py +164 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/api/default/attributes_get.py +256 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/api/default/attributes_update.py +157 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/client.py +274 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/errors.py +14 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/__init__.py +41 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/access_token_data.py +79 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attribute.py +93 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attribute_by_name.py +58 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attribute_by_template.py +58 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attribute_group.py +65 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attribute_value.py +78 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attribute_values_get_result.py +95 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attributes_acquire_result.py +102 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attributes_acquire_result_failed_item.py +72 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attributes_acquire_result_success_item.py +58 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attributes_get_result.py +95 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attributes_update_result.py +96 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/attributes_update_result_failed_item.py +92 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/date_value.py +70 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/error_mixin.py +65 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/paginated_response.py +72 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/tokens.py +86 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/models/user_profile.py +58 -0
- exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/types.py +44 -0
- exist_client-0.1.2.dev2/src/exist_client/client.py +92 -0
- exist_client-0.1.2.dev2/src/exist_client/models.py +3 -0
- exist_client-0.1.0/pyproject.toml +0 -30
- {exist_client-0.1.0 → exist_client-0.1.2.dev2}/README.md +0 -0
- {exist_client-0.1.0/src/exist_client → exist_client-0.1.2.dev2/src/exist_client/_exist_io_client/api/default}/__init__.py +0 -0
- {exist_client-0.1.0 → exist_client-0.1.2.dev2}/src/exist_client/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: exist-client
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2.dev2
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Ilya Nekhay
|
|
6
6
|
Author-email: nekhayiv@gmail.com
|
|
@@ -9,6 +9,9 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.10
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Requires-Dist: attrs (>=23.1.0,<24.0.0)
|
|
13
|
+
Requires-Dist: loguru
|
|
14
|
+
Requires-Dist: pytilz (>=0.1.0,<0.2.0)
|
|
12
15
|
Description-Content-Type: text/markdown
|
|
13
16
|
|
|
14
17
|
# Setting up a new project
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "exist-client"
|
|
3
|
+
version = "0.1.2.dev2"
|
|
4
|
+
description = ""
|
|
5
|
+
authors = ["Ilya Nekhay <nekhayiv@gmail.com>"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
packages = [{include = "exist_client", from = "src"}]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
[tool.poetry.dependencies]
|
|
11
|
+
python = "^3.10"
|
|
12
|
+
attrs = "^23.1.0"
|
|
13
|
+
loguru = "*"
|
|
14
|
+
pytilz = "^0.1.0"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
[tool.poetry.group.dev.dependencies]
|
|
18
|
+
# Code generation
|
|
19
|
+
openapi-python-client = "^0.16.1"
|
|
20
|
+
|
|
21
|
+
# Code management
|
|
22
|
+
pre-commit = "*"
|
|
23
|
+
commitizen = "*"
|
|
24
|
+
|
|
25
|
+
# Testing
|
|
26
|
+
pytest = "*"
|
|
27
|
+
pytest-cov = "*"
|
|
28
|
+
mypy = "*"
|
|
29
|
+
respx = "*"
|
|
30
|
+
flask = "^3.0.0"
|
|
31
|
+
flask-httpauth = "^4.8.0"
|
|
32
|
+
flask-httpauth-stubs = "^0.1.6"
|
|
33
|
+
syrupy = "^4.6.0"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
[build-system]
|
|
37
|
+
requires = ["poetry-core", "poetry-dynamic-versioning"]
|
|
38
|
+
build-backend = "poetry_dynamic_versioning.backend"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
[tool.pytest.ini_options]
|
|
42
|
+
addopts = "--cov=src --cov-report html --cov-report xml --cov-config=.coveragerc"
|
|
43
|
+
pythonpath = ["src"]
|
|
44
|
+
testpaths = ["tests"]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
[tool.isort]
|
|
48
|
+
profile = "black"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
[tool.ruff]
|
|
52
|
+
select = ["F", "I"]
|
|
53
|
+
line-length = 120
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
[tool.commitizen]
|
|
57
|
+
name = "cz_conventional_commits"
|
|
58
|
+
tag_format = "v$version"
|
|
59
|
+
version_type = "pep440"
|
|
60
|
+
version_provider = "poetry"
|
|
61
|
+
update_changelog_on_bump = true
|
|
62
|
+
major_version_zero = true
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
[tool.poetry-dynamic-versioning]
|
|
66
|
+
enable = false
|
|
67
|
+
# TODO: extract version from `cz bump` so that when there's a MINOR/MAJOR change coming, the dev version corresponds
|
|
68
|
+
# to the next MINOR/MAJOR version
|
|
69
|
+
format-jinja = """
|
|
70
|
+
{%- if distance == 0 -%}
|
|
71
|
+
{{ serialize_pep440(base, stage, revision) }}
|
|
72
|
+
{%- elif revision is not none -%}
|
|
73
|
+
{{ serialize_pep440(base, stage, revision + 1, dev=distance) }}
|
|
74
|
+
{%- else -%}
|
|
75
|
+
{{ serialize_pep440(bump_version(base), stage, revision, dev=distance) }}
|
|
76
|
+
{%- endif -%}
|
|
77
|
+
"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains methods for accessing the API """
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.access_token_data import AccessTokenData
|
|
9
|
+
from ...models.tokens import Tokens
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
form_data: AccessTokenData,
|
|
15
|
+
) -> Dict[str, Any]:
|
|
16
|
+
return {
|
|
17
|
+
"method": "post",
|
|
18
|
+
"url": "/oauth2/access_token",
|
|
19
|
+
"data": form_data.to_dict(),
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _parse_response(
|
|
24
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
25
|
+
) -> Optional[Tokens]:
|
|
26
|
+
if response.status_code == HTTPStatus.OK:
|
|
27
|
+
response_200 = Tokens.from_dict(response.json())
|
|
28
|
+
|
|
29
|
+
return response_200
|
|
30
|
+
if client.raise_on_unexpected_status:
|
|
31
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
32
|
+
else:
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _build_response(
|
|
37
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
38
|
+
) -> Response[Tokens]:
|
|
39
|
+
return Response(
|
|
40
|
+
status_code=HTTPStatus(response.status_code),
|
|
41
|
+
content=response.content,
|
|
42
|
+
headers=response.headers,
|
|
43
|
+
parsed=_parse_response(client=client, response=response),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def sync_detailed(
|
|
48
|
+
*,
|
|
49
|
+
client: Union[AuthenticatedClient, Client],
|
|
50
|
+
form_data: AccessTokenData,
|
|
51
|
+
) -> Response[Tokens]:
|
|
52
|
+
"""
|
|
53
|
+
Raises:
|
|
54
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
55
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
Response[Tokens]
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
kwargs = _get_kwargs(
|
|
62
|
+
form_data=form_data,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
response = client.get_httpx_client().request(
|
|
66
|
+
**kwargs,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
return _build_response(client=client, response=response)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def sync(
|
|
73
|
+
*,
|
|
74
|
+
client: Union[AuthenticatedClient, Client],
|
|
75
|
+
form_data: AccessTokenData,
|
|
76
|
+
) -> Optional[Tokens]:
|
|
77
|
+
"""
|
|
78
|
+
Raises:
|
|
79
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
80
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
81
|
+
|
|
82
|
+
Returns:
|
|
83
|
+
Tokens
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
return sync_detailed(
|
|
87
|
+
client=client,
|
|
88
|
+
form_data=form_data,
|
|
89
|
+
).parsed
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
async def asyncio_detailed(
|
|
93
|
+
*,
|
|
94
|
+
client: Union[AuthenticatedClient, Client],
|
|
95
|
+
form_data: AccessTokenData,
|
|
96
|
+
) -> Response[Tokens]:
|
|
97
|
+
"""
|
|
98
|
+
Raises:
|
|
99
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
100
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
Response[Tokens]
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
kwargs = _get_kwargs(
|
|
107
|
+
form_data=form_data,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
111
|
+
|
|
112
|
+
return _build_response(client=client, response=response)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
async def asyncio(
|
|
116
|
+
*,
|
|
117
|
+
client: Union[AuthenticatedClient, Client],
|
|
118
|
+
form_data: AccessTokenData,
|
|
119
|
+
) -> Optional[Tokens]:
|
|
120
|
+
"""
|
|
121
|
+
Raises:
|
|
122
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
123
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
Tokens
|
|
127
|
+
"""
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
await asyncio_detailed(
|
|
131
|
+
client=client,
|
|
132
|
+
form_data=form_data,
|
|
133
|
+
)
|
|
134
|
+
).parsed
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.user_profile import UserProfile
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs() -> Dict[str, Any]:
|
|
13
|
+
return {
|
|
14
|
+
"method": "get",
|
|
15
|
+
"url": "/api/2/accounts/profile/",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _parse_response(
|
|
20
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
21
|
+
) -> Optional[UserProfile]:
|
|
22
|
+
if response.status_code == HTTPStatus.OK:
|
|
23
|
+
response_200 = UserProfile.from_dict(response.json())
|
|
24
|
+
|
|
25
|
+
return response_200
|
|
26
|
+
if client.raise_on_unexpected_status:
|
|
27
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
28
|
+
else:
|
|
29
|
+
return None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _build_response(
|
|
33
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
34
|
+
) -> Response[UserProfile]:
|
|
35
|
+
return Response(
|
|
36
|
+
status_code=HTTPStatus(response.status_code),
|
|
37
|
+
content=response.content,
|
|
38
|
+
headers=response.headers,
|
|
39
|
+
parsed=_parse_response(client=client, response=response),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def sync_detailed(
|
|
44
|
+
*,
|
|
45
|
+
client: AuthenticatedClient,
|
|
46
|
+
) -> Response[UserProfile]:
|
|
47
|
+
"""
|
|
48
|
+
Raises:
|
|
49
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
50
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
Response[UserProfile]
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
kwargs = _get_kwargs()
|
|
57
|
+
|
|
58
|
+
response = client.get_httpx_client().request(
|
|
59
|
+
**kwargs,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
return _build_response(client=client, response=response)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def sync(
|
|
66
|
+
*,
|
|
67
|
+
client: AuthenticatedClient,
|
|
68
|
+
) -> Optional[UserProfile]:
|
|
69
|
+
"""
|
|
70
|
+
Raises:
|
|
71
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
72
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
UserProfile
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
return sync_detailed(
|
|
79
|
+
client=client,
|
|
80
|
+
).parsed
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
async def asyncio_detailed(
|
|
84
|
+
*,
|
|
85
|
+
client: AuthenticatedClient,
|
|
86
|
+
) -> Response[UserProfile]:
|
|
87
|
+
"""
|
|
88
|
+
Raises:
|
|
89
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
90
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
Response[UserProfile]
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
kwargs = _get_kwargs()
|
|
97
|
+
|
|
98
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
99
|
+
|
|
100
|
+
return _build_response(client=client, response=response)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
async def asyncio(
|
|
104
|
+
*,
|
|
105
|
+
client: AuthenticatedClient,
|
|
106
|
+
) -> Optional[UserProfile]:
|
|
107
|
+
"""
|
|
108
|
+
Raises:
|
|
109
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
110
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
UserProfile
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
await asyncio_detailed(
|
|
118
|
+
client=client,
|
|
119
|
+
)
|
|
120
|
+
).parsed
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.attribute_values_get_result import AttributeValuesGetResult
|
|
9
|
+
from ...types import UNSET, Response, Unset
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs(
|
|
13
|
+
*,
|
|
14
|
+
attribute: str,
|
|
15
|
+
page: Union[Unset, None, int] = UNSET,
|
|
16
|
+
) -> Dict[str, Any]:
|
|
17
|
+
params: Dict[str, Any] = {}
|
|
18
|
+
params["attribute"] = attribute
|
|
19
|
+
|
|
20
|
+
params["page"] = page
|
|
21
|
+
|
|
22
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
"method": "get",
|
|
26
|
+
"url": "/api/2/attributes/values/",
|
|
27
|
+
"params": params,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _parse_response(
|
|
32
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
33
|
+
) -> Optional[AttributeValuesGetResult]:
|
|
34
|
+
if response.status_code == HTTPStatus.OK:
|
|
35
|
+
response_200 = AttributeValuesGetResult.from_dict(response.json())
|
|
36
|
+
|
|
37
|
+
return response_200
|
|
38
|
+
if client.raise_on_unexpected_status:
|
|
39
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
40
|
+
else:
|
|
41
|
+
return None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _build_response(
|
|
45
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
46
|
+
) -> Response[AttributeValuesGetResult]:
|
|
47
|
+
return Response(
|
|
48
|
+
status_code=HTTPStatus(response.status_code),
|
|
49
|
+
content=response.content,
|
|
50
|
+
headers=response.headers,
|
|
51
|
+
parsed=_parse_response(client=client, response=response),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def sync_detailed(
|
|
56
|
+
*,
|
|
57
|
+
client: Union[AuthenticatedClient, Client],
|
|
58
|
+
attribute: str,
|
|
59
|
+
page: Union[Unset, None, int] = UNSET,
|
|
60
|
+
) -> Response[AttributeValuesGetResult]:
|
|
61
|
+
"""
|
|
62
|
+
Args:
|
|
63
|
+
attribute (str):
|
|
64
|
+
page (Union[Unset, None, int]):
|
|
65
|
+
|
|
66
|
+
Raises:
|
|
67
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
68
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
Response[AttributeValuesGetResult]
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
kwargs = _get_kwargs(
|
|
75
|
+
attribute=attribute,
|
|
76
|
+
page=page,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
response = client.get_httpx_client().request(
|
|
80
|
+
**kwargs,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return _build_response(client=client, response=response)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def sync(
|
|
87
|
+
*,
|
|
88
|
+
client: Union[AuthenticatedClient, Client],
|
|
89
|
+
attribute: str,
|
|
90
|
+
page: Union[Unset, None, int] = UNSET,
|
|
91
|
+
) -> Optional[AttributeValuesGetResult]:
|
|
92
|
+
"""
|
|
93
|
+
Args:
|
|
94
|
+
attribute (str):
|
|
95
|
+
page (Union[Unset, None, int]):
|
|
96
|
+
|
|
97
|
+
Raises:
|
|
98
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
99
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
AttributeValuesGetResult
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
return sync_detailed(
|
|
106
|
+
client=client,
|
|
107
|
+
attribute=attribute,
|
|
108
|
+
page=page,
|
|
109
|
+
).parsed
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
async def asyncio_detailed(
|
|
113
|
+
*,
|
|
114
|
+
client: Union[AuthenticatedClient, Client],
|
|
115
|
+
attribute: str,
|
|
116
|
+
page: Union[Unset, None, int] = UNSET,
|
|
117
|
+
) -> Response[AttributeValuesGetResult]:
|
|
118
|
+
"""
|
|
119
|
+
Args:
|
|
120
|
+
attribute (str):
|
|
121
|
+
page (Union[Unset, None, int]):
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
125
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
Response[AttributeValuesGetResult]
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
kwargs = _get_kwargs(
|
|
132
|
+
attribute=attribute,
|
|
133
|
+
page=page,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
137
|
+
|
|
138
|
+
return _build_response(client=client, response=response)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
async def asyncio(
|
|
142
|
+
*,
|
|
143
|
+
client: Union[AuthenticatedClient, Client],
|
|
144
|
+
attribute: str,
|
|
145
|
+
page: Union[Unset, None, int] = UNSET,
|
|
146
|
+
) -> Optional[AttributeValuesGetResult]:
|
|
147
|
+
"""
|
|
148
|
+
Args:
|
|
149
|
+
attribute (str):
|
|
150
|
+
page (Union[Unset, None, int]):
|
|
151
|
+
|
|
152
|
+
Raises:
|
|
153
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
154
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
AttributeValuesGetResult
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
await asyncio_detailed(
|
|
162
|
+
client=client,
|
|
163
|
+
attribute=attribute,
|
|
164
|
+
page=page,
|
|
165
|
+
)
|
|
166
|
+
).parsed
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Dict, List, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.attribute_by_name import AttributeByName
|
|
9
|
+
from ...models.attribute_by_template import AttributeByTemplate
|
|
10
|
+
from ...models.attributes_acquire_result import AttributesAcquireResult
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
json_body: List[Union["AttributeByName", "AttributeByTemplate"]],
|
|
17
|
+
) -> Dict[str, Any]:
|
|
18
|
+
json_json_body = []
|
|
19
|
+
for json_body_item_data in json_body:
|
|
20
|
+
json_body_item: Dict[str, Any]
|
|
21
|
+
|
|
22
|
+
if isinstance(json_body_item_data, AttributeByTemplate):
|
|
23
|
+
json_body_item = json_body_item_data.to_dict()
|
|
24
|
+
|
|
25
|
+
else:
|
|
26
|
+
json_body_item = json_body_item_data.to_dict()
|
|
27
|
+
|
|
28
|
+
json_json_body.append(json_body_item)
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
"method": "post",
|
|
32
|
+
"url": "/api/2/attributes/acquire/",
|
|
33
|
+
"json": json_json_body,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse_response(
|
|
38
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
39
|
+
) -> Optional[AttributesAcquireResult]:
|
|
40
|
+
if response.status_code == HTTPStatus.OK:
|
|
41
|
+
response_200 = AttributesAcquireResult.from_dict(response.json())
|
|
42
|
+
|
|
43
|
+
return response_200
|
|
44
|
+
if response.status_code == HTTPStatus.ACCEPTED:
|
|
45
|
+
response_202 = AttributesAcquireResult.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_202
|
|
48
|
+
if client.raise_on_unexpected_status:
|
|
49
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
+
else:
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _build_response(
|
|
55
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
56
|
+
) -> Response[AttributesAcquireResult]:
|
|
57
|
+
return Response(
|
|
58
|
+
status_code=HTTPStatus(response.status_code),
|
|
59
|
+
content=response.content,
|
|
60
|
+
headers=response.headers,
|
|
61
|
+
parsed=_parse_response(client=client, response=response),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def sync_detailed(
|
|
66
|
+
*,
|
|
67
|
+
client: AuthenticatedClient,
|
|
68
|
+
json_body: List[Union["AttributeByName", "AttributeByTemplate"]],
|
|
69
|
+
) -> Response[AttributesAcquireResult]:
|
|
70
|
+
"""
|
|
71
|
+
Args:
|
|
72
|
+
json_body (List[Union['AttributeByName', 'AttributeByTemplate']]):
|
|
73
|
+
|
|
74
|
+
Raises:
|
|
75
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
76
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
Response[AttributesAcquireResult]
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
kwargs = _get_kwargs(
|
|
83
|
+
json_body=json_body,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
response = client.get_httpx_client().request(
|
|
87
|
+
**kwargs,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
return _build_response(client=client, response=response)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def sync(
|
|
94
|
+
*,
|
|
95
|
+
client: AuthenticatedClient,
|
|
96
|
+
json_body: List[Union["AttributeByName", "AttributeByTemplate"]],
|
|
97
|
+
) -> Optional[AttributesAcquireResult]:
|
|
98
|
+
"""
|
|
99
|
+
Args:
|
|
100
|
+
json_body (List[Union['AttributeByName', 'AttributeByTemplate']]):
|
|
101
|
+
|
|
102
|
+
Raises:
|
|
103
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
104
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
AttributesAcquireResult
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
return sync_detailed(
|
|
111
|
+
client=client,
|
|
112
|
+
json_body=json_body,
|
|
113
|
+
).parsed
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
async def asyncio_detailed(
|
|
117
|
+
*,
|
|
118
|
+
client: AuthenticatedClient,
|
|
119
|
+
json_body: List[Union["AttributeByName", "AttributeByTemplate"]],
|
|
120
|
+
) -> Response[AttributesAcquireResult]:
|
|
121
|
+
"""
|
|
122
|
+
Args:
|
|
123
|
+
json_body (List[Union['AttributeByName', 'AttributeByTemplate']]):
|
|
124
|
+
|
|
125
|
+
Raises:
|
|
126
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
127
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
Response[AttributesAcquireResult]
|
|
131
|
+
"""
|
|
132
|
+
|
|
133
|
+
kwargs = _get_kwargs(
|
|
134
|
+
json_body=json_body,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
138
|
+
|
|
139
|
+
return _build_response(client=client, response=response)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
async def asyncio(
|
|
143
|
+
*,
|
|
144
|
+
client: AuthenticatedClient,
|
|
145
|
+
json_body: List[Union["AttributeByName", "AttributeByTemplate"]],
|
|
146
|
+
) -> Optional[AttributesAcquireResult]:
|
|
147
|
+
"""
|
|
148
|
+
Args:
|
|
149
|
+
json_body (List[Union['AttributeByName', 'AttributeByTemplate']]):
|
|
150
|
+
|
|
151
|
+
Raises:
|
|
152
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
153
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
AttributesAcquireResult
|
|
157
|
+
"""
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
await asyncio_detailed(
|
|
161
|
+
client=client,
|
|
162
|
+
json_body=json_body,
|
|
163
|
+
)
|
|
164
|
+
).parsed
|