minikai 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.

Potentially problematic release.


This version of minikai might be problematic. Click here for more details.

Files changed (87) hide show
  1. minikai/__init__.py +8 -0
  2. minikai/api/__init__.py +1 -0
  3. minikai/api/groups/__init__.py +1 -0
  4. minikai/api/groups/add_minis_to_group.py +176 -0
  5. minikai/api/groups/add_users_to_group.py +176 -0
  6. minikai/api/groups/create_group.py +160 -0
  7. minikai/api/groups/delete_group.py +95 -0
  8. minikai/api/groups/get_group.py +151 -0
  9. minikai/api/groups/get_group_minis.py +156 -0
  10. minikai/api/groups/get_group_users.py +156 -0
  11. minikai/api/groups/get_groups.py +128 -0
  12. minikai/api/groups/remove_minis_from_group.py +176 -0
  13. minikai/api/groups/remove_users_from_group.py +176 -0
  14. minikai/api/groups/update_group.py +177 -0
  15. minikai/api/minis/__init__.py +1 -0
  16. minikai/api/minis/create_mini.py +160 -0
  17. minikai/api/minis/delete_mini.py +95 -0
  18. minikai/api/minis/get_external_mini.py +164 -0
  19. minikai/api/minis/get_minis.py +128 -0
  20. minikai/api/minis/patch_mini.py +177 -0
  21. minikai/api/minis/update_mini.py +177 -0
  22. minikai/api/records/__init__.py +1 -0
  23. minikai/api/records/add_attachments.py +182 -0
  24. minikai/api/records/add_relations.py +187 -0
  25. minikai/api/records/create_record.py +162 -0
  26. minikai/api/records/delete_record.py +95 -0
  27. minikai/api/records/get_records_by_external.py +230 -0
  28. minikai/api/records/remove_attachments.py +110 -0
  29. minikai/api/records/remove_relations.py +110 -0
  30. minikai/api/records/update_attachments.py +182 -0
  31. minikai/api/records/update_record.py +179 -0
  32. minikai/api/records/update_relations.py +187 -0
  33. minikai/api/users/__init__.py +1 -0
  34. minikai/api/users/delete_api_users_minis.py +102 -0
  35. minikai/api/users/get_api_users_minis.py +156 -0
  36. minikai/api/users/get_users.py +128 -0
  37. minikai/api/users/post_api_users_minis.py +168 -0
  38. minikai/client.py +268 -0
  39. minikai/errors.py +16 -0
  40. minikai/models/__init__.py +89 -0
  41. minikai/models/add_attachments_body.py +98 -0
  42. minikai/models/create_group_command.py +102 -0
  43. minikai/models/create_mini_command.py +120 -0
  44. minikai/models/create_record_command.py +268 -0
  45. minikai/models/create_record_command_tags.py +44 -0
  46. minikai/models/document_file_dto.py +147 -0
  47. minikai/models/form_field.py +112 -0
  48. minikai/models/form_field_dto.py +149 -0
  49. minikai/models/form_field_type.py +16 -0
  50. minikai/models/group_dto.py +124 -0
  51. minikai/models/http_validation_problem_details.py +173 -0
  52. minikai/models/http_validation_problem_details_errors.py +51 -0
  53. minikai/models/json_node.py +119 -0
  54. minikai/models/json_node_options.py +42 -0
  55. minikai/models/mini_dto.py +189 -0
  56. minikai/models/mini_template_dto.py +135 -0
  57. minikai/models/paginated_list_of_record_dto.py +101 -0
  58. minikai/models/patch_mini_command.py +80 -0
  59. minikai/models/problem_details.py +151 -0
  60. minikai/models/record.py +379 -0
  61. minikai/models/record_attachment.py +236 -0
  62. minikai/models/record_attachment_dto.py +236 -0
  63. minikai/models/record_attachment_dto_metadata_type_0.py +44 -0
  64. minikai/models/record_attachment_metadata_type_0.py +44 -0
  65. minikai/models/record_authorization.py +75 -0
  66. minikai/models/record_authorization_dto.py +75 -0
  67. minikai/models/record_dto.py +377 -0
  68. minikai/models/record_dto_tags.py +44 -0
  69. minikai/models/record_relation.py +81 -0
  70. minikai/models/record_relation_dto.py +81 -0
  71. minikai/models/record_tags.py +44 -0
  72. minikai/models/slim_mini_dto.py +168 -0
  73. minikai/models/tool_dto.py +76 -0
  74. minikai/models/update_attachments_body.py +98 -0
  75. minikai/models/update_group_command.py +122 -0
  76. minikai/models/update_mini_command.py +129 -0
  77. minikai/models/update_mini_template_workspaces_command.py +51 -0
  78. minikai/models/update_record_command.py +266 -0
  79. minikai/models/update_record_command_tags.py +44 -0
  80. minikai/models/user_dto.py +182 -0
  81. minikai/models/user_to_mini_dto.py +78 -0
  82. minikai/models/workspace_dto.py +78 -0
  83. minikai/py.typed +1 -0
  84. minikai/types.py +54 -0
  85. minikai-0.1.0.dist-info/METADATA +133 -0
  86. minikai-0.1.0.dist-info/RECORD +87 -0
  87. minikai-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,177 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union, cast
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.http_validation_problem_details import HttpValidationProblemDetails
9
+ from ...models.update_mini_command import UpdateMiniCommand
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ id: int,
15
+ *,
16
+ body: UpdateMiniCommand,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "put",
22
+ "url": f"/api/Minis/{id}",
23
+ }
24
+
25
+ _kwargs["json"] = body.to_dict()
26
+
27
+ headers["Content-Type"] = "application/json"
28
+
29
+ _kwargs["headers"] = headers
30
+ return _kwargs
31
+
32
+
33
+ def _parse_response(
34
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
35
+ ) -> Optional[Union[Any, HttpValidationProblemDetails]]:
36
+ if response.status_code == 204:
37
+ response_204 = cast(Any, None)
38
+ return response_204
39
+
40
+ if response.status_code == 400:
41
+ response_400 = HttpValidationProblemDetails.from_dict(response.json())
42
+
43
+ return response_400
44
+
45
+ if response.status_code == 404:
46
+ response_404 = cast(Any, None)
47
+ return response_404
48
+
49
+ if client.raise_on_unexpected_status:
50
+ raise errors.UnexpectedStatus(response.status_code, response.content)
51
+ else:
52
+ return None
53
+
54
+
55
+ def _build_response(
56
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
57
+ ) -> Response[Union[Any, HttpValidationProblemDetails]]:
58
+ return Response(
59
+ status_code=HTTPStatus(response.status_code),
60
+ content=response.content,
61
+ headers=response.headers,
62
+ parsed=_parse_response(client=client, response=response),
63
+ )
64
+
65
+
66
+ def sync_detailed(
67
+ id: int,
68
+ *,
69
+ client: Union[AuthenticatedClient, Client],
70
+ body: UpdateMiniCommand,
71
+ ) -> Response[Union[Any, HttpValidationProblemDetails]]:
72
+ """
73
+ Args:
74
+ id (int):
75
+ body (UpdateMiniCommand):
76
+
77
+ Raises:
78
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
79
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
80
+
81
+ Returns:
82
+ Response[Union[Any, HttpValidationProblemDetails]]
83
+ """
84
+
85
+ kwargs = _get_kwargs(
86
+ id=id,
87
+ body=body,
88
+ )
89
+
90
+ response = client.get_httpx_client().request(
91
+ **kwargs,
92
+ )
93
+
94
+ return _build_response(client=client, response=response)
95
+
96
+
97
+ def sync(
98
+ id: int,
99
+ *,
100
+ client: Union[AuthenticatedClient, Client],
101
+ body: UpdateMiniCommand,
102
+ ) -> Optional[Union[Any, HttpValidationProblemDetails]]:
103
+ """
104
+ Args:
105
+ id (int):
106
+ body (UpdateMiniCommand):
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
+ Union[Any, HttpValidationProblemDetails]
114
+ """
115
+
116
+ return sync_detailed(
117
+ id=id,
118
+ client=client,
119
+ body=body,
120
+ ).parsed
121
+
122
+
123
+ async def asyncio_detailed(
124
+ id: int,
125
+ *,
126
+ client: Union[AuthenticatedClient, Client],
127
+ body: UpdateMiniCommand,
128
+ ) -> Response[Union[Any, HttpValidationProblemDetails]]:
129
+ """
130
+ Args:
131
+ id (int):
132
+ body (UpdateMiniCommand):
133
+
134
+ Raises:
135
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
136
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
137
+
138
+ Returns:
139
+ Response[Union[Any, HttpValidationProblemDetails]]
140
+ """
141
+
142
+ kwargs = _get_kwargs(
143
+ id=id,
144
+ body=body,
145
+ )
146
+
147
+ response = await client.get_async_httpx_client().request(**kwargs)
148
+
149
+ return _build_response(client=client, response=response)
150
+
151
+
152
+ async def asyncio(
153
+ id: int,
154
+ *,
155
+ client: Union[AuthenticatedClient, Client],
156
+ body: UpdateMiniCommand,
157
+ ) -> Optional[Union[Any, HttpValidationProblemDetails]]:
158
+ """
159
+ Args:
160
+ id (int):
161
+ body (UpdateMiniCommand):
162
+
163
+ Raises:
164
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
165
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
166
+
167
+ Returns:
168
+ Union[Any, HttpValidationProblemDetails]
169
+ """
170
+
171
+ return (
172
+ await asyncio_detailed(
173
+ id=id,
174
+ client=client,
175
+ body=body,
176
+ )
177
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,182 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union, cast
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.add_attachments_body import AddAttachmentsBody
9
+ from ...models.http_validation_problem_details import HttpValidationProblemDetails
10
+ from ...models.record_attachment import RecordAttachment
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ record_id: str,
16
+ *,
17
+ body: AddAttachmentsBody,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "post",
23
+ "url": f"/api/Records/{record_id}/attachments",
24
+ }
25
+
26
+ _kwargs["files"] = body.to_multipart()
27
+
28
+ _kwargs["headers"] = headers
29
+ return _kwargs
30
+
31
+
32
+ def _parse_response(
33
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
34
+ ) -> Optional[Union[Any, HttpValidationProblemDetails, list["RecordAttachment"]]]:
35
+ if response.status_code == 201:
36
+ response_201 = []
37
+ _response_201 = response.json()
38
+ for response_201_item_data in _response_201:
39
+ response_201_item = RecordAttachment.from_dict(response_201_item_data)
40
+
41
+ response_201.append(response_201_item)
42
+
43
+ return response_201
44
+
45
+ if response.status_code == 400:
46
+ response_400 = HttpValidationProblemDetails.from_dict(response.json())
47
+
48
+ return response_400
49
+
50
+ if response.status_code == 404:
51
+ response_404 = cast(Any, None)
52
+ return response_404
53
+
54
+ if client.raise_on_unexpected_status:
55
+ raise errors.UnexpectedStatus(response.status_code, response.content)
56
+ else:
57
+ return None
58
+
59
+
60
+ def _build_response(
61
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
62
+ ) -> Response[Union[Any, HttpValidationProblemDetails, list["RecordAttachment"]]]:
63
+ return Response(
64
+ status_code=HTTPStatus(response.status_code),
65
+ content=response.content,
66
+ headers=response.headers,
67
+ parsed=_parse_response(client=client, response=response),
68
+ )
69
+
70
+
71
+ def sync_detailed(
72
+ record_id: str,
73
+ *,
74
+ client: Union[AuthenticatedClient, Client],
75
+ body: AddAttachmentsBody,
76
+ ) -> Response[Union[Any, HttpValidationProblemDetails, list["RecordAttachment"]]]:
77
+ """
78
+ Args:
79
+ record_id (str):
80
+ body (AddAttachmentsBody):
81
+
82
+ Raises:
83
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
84
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
85
+
86
+ Returns:
87
+ Response[Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]]
88
+ """
89
+
90
+ kwargs = _get_kwargs(
91
+ record_id=record_id,
92
+ body=body,
93
+ )
94
+
95
+ response = client.get_httpx_client().request(
96
+ **kwargs,
97
+ )
98
+
99
+ return _build_response(client=client, response=response)
100
+
101
+
102
+ def sync(
103
+ record_id: str,
104
+ *,
105
+ client: Union[AuthenticatedClient, Client],
106
+ body: AddAttachmentsBody,
107
+ ) -> Optional[Union[Any, HttpValidationProblemDetails, list["RecordAttachment"]]]:
108
+ """
109
+ Args:
110
+ record_id (str):
111
+ body (AddAttachmentsBody):
112
+
113
+ Raises:
114
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
115
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
116
+
117
+ Returns:
118
+ Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]
119
+ """
120
+
121
+ return sync_detailed(
122
+ record_id=record_id,
123
+ client=client,
124
+ body=body,
125
+ ).parsed
126
+
127
+
128
+ async def asyncio_detailed(
129
+ record_id: str,
130
+ *,
131
+ client: Union[AuthenticatedClient, Client],
132
+ body: AddAttachmentsBody,
133
+ ) -> Response[Union[Any, HttpValidationProblemDetails, list["RecordAttachment"]]]:
134
+ """
135
+ Args:
136
+ record_id (str):
137
+ body (AddAttachmentsBody):
138
+
139
+ Raises:
140
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
141
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
142
+
143
+ Returns:
144
+ Response[Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]]
145
+ """
146
+
147
+ kwargs = _get_kwargs(
148
+ record_id=record_id,
149
+ body=body,
150
+ )
151
+
152
+ response = await client.get_async_httpx_client().request(**kwargs)
153
+
154
+ return _build_response(client=client, response=response)
155
+
156
+
157
+ async def asyncio(
158
+ record_id: str,
159
+ *,
160
+ client: Union[AuthenticatedClient, Client],
161
+ body: AddAttachmentsBody,
162
+ ) -> Optional[Union[Any, HttpValidationProblemDetails, list["RecordAttachment"]]]:
163
+ """
164
+ Args:
165
+ record_id (str):
166
+ body (AddAttachmentsBody):
167
+
168
+ Raises:
169
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
170
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
171
+
172
+ Returns:
173
+ Union[Any, HttpValidationProblemDetails, list['RecordAttachment']]
174
+ """
175
+
176
+ return (
177
+ await asyncio_detailed(
178
+ record_id=record_id,
179
+ client=client,
180
+ body=body,
181
+ )
182
+ ).parsed
@@ -0,0 +1,187 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union, cast
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.http_validation_problem_details import HttpValidationProblemDetails
9
+ from ...models.record_relation import RecordRelation
10
+ from ...models.record_relation_dto import RecordRelationDto
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ record_id: str,
16
+ *,
17
+ body: list["RecordRelationDto"],
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "post",
23
+ "url": f"/api/Records/{record_id}/relations",
24
+ }
25
+
26
+ _kwargs["json"] = []
27
+ for body_item_data in body:
28
+ body_item = body_item_data.to_dict()
29
+ _kwargs["json"].append(body_item)
30
+
31
+ headers["Content-Type"] = "application/json"
32
+
33
+ _kwargs["headers"] = headers
34
+ return _kwargs
35
+
36
+
37
+ def _parse_response(
38
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
39
+ ) -> Optional[Union[Any, HttpValidationProblemDetails, list["RecordRelation"]]]:
40
+ if response.status_code == 201:
41
+ response_201 = []
42
+ _response_201 = response.json()
43
+ for response_201_item_data in _response_201:
44
+ response_201_item = RecordRelation.from_dict(response_201_item_data)
45
+
46
+ response_201.append(response_201_item)
47
+
48
+ return response_201
49
+
50
+ if response.status_code == 400:
51
+ response_400 = HttpValidationProblemDetails.from_dict(response.json())
52
+
53
+ return response_400
54
+
55
+ if response.status_code == 404:
56
+ response_404 = cast(Any, None)
57
+ return response_404
58
+
59
+ if client.raise_on_unexpected_status:
60
+ raise errors.UnexpectedStatus(response.status_code, response.content)
61
+ else:
62
+ return None
63
+
64
+
65
+ def _build_response(
66
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
67
+ ) -> Response[Union[Any, HttpValidationProblemDetails, list["RecordRelation"]]]:
68
+ return Response(
69
+ status_code=HTTPStatus(response.status_code),
70
+ content=response.content,
71
+ headers=response.headers,
72
+ parsed=_parse_response(client=client, response=response),
73
+ )
74
+
75
+
76
+ def sync_detailed(
77
+ record_id: str,
78
+ *,
79
+ client: Union[AuthenticatedClient, Client],
80
+ body: list["RecordRelationDto"],
81
+ ) -> Response[Union[Any, HttpValidationProblemDetails, list["RecordRelation"]]]:
82
+ """
83
+ Args:
84
+ record_id (str):
85
+ body (list['RecordRelationDto']):
86
+
87
+ Raises:
88
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
89
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
90
+
91
+ Returns:
92
+ Response[Union[Any, HttpValidationProblemDetails, list['RecordRelation']]]
93
+ """
94
+
95
+ kwargs = _get_kwargs(
96
+ record_id=record_id,
97
+ body=body,
98
+ )
99
+
100
+ response = client.get_httpx_client().request(
101
+ **kwargs,
102
+ )
103
+
104
+ return _build_response(client=client, response=response)
105
+
106
+
107
+ def sync(
108
+ record_id: str,
109
+ *,
110
+ client: Union[AuthenticatedClient, Client],
111
+ body: list["RecordRelationDto"],
112
+ ) -> Optional[Union[Any, HttpValidationProblemDetails, list["RecordRelation"]]]:
113
+ """
114
+ Args:
115
+ record_id (str):
116
+ body (list['RecordRelationDto']):
117
+
118
+ Raises:
119
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
120
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
121
+
122
+ Returns:
123
+ Union[Any, HttpValidationProblemDetails, list['RecordRelation']]
124
+ """
125
+
126
+ return sync_detailed(
127
+ record_id=record_id,
128
+ client=client,
129
+ body=body,
130
+ ).parsed
131
+
132
+
133
+ async def asyncio_detailed(
134
+ record_id: str,
135
+ *,
136
+ client: Union[AuthenticatedClient, Client],
137
+ body: list["RecordRelationDto"],
138
+ ) -> Response[Union[Any, HttpValidationProblemDetails, list["RecordRelation"]]]:
139
+ """
140
+ Args:
141
+ record_id (str):
142
+ body (list['RecordRelationDto']):
143
+
144
+ Raises:
145
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
146
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
147
+
148
+ Returns:
149
+ Response[Union[Any, HttpValidationProblemDetails, list['RecordRelation']]]
150
+ """
151
+
152
+ kwargs = _get_kwargs(
153
+ record_id=record_id,
154
+ body=body,
155
+ )
156
+
157
+ response = await client.get_async_httpx_client().request(**kwargs)
158
+
159
+ return _build_response(client=client, response=response)
160
+
161
+
162
+ async def asyncio(
163
+ record_id: str,
164
+ *,
165
+ client: Union[AuthenticatedClient, Client],
166
+ body: list["RecordRelationDto"],
167
+ ) -> Optional[Union[Any, HttpValidationProblemDetails, list["RecordRelation"]]]:
168
+ """
169
+ Args:
170
+ record_id (str):
171
+ body (list['RecordRelationDto']):
172
+
173
+ Raises:
174
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
175
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
176
+
177
+ Returns:
178
+ Union[Any, HttpValidationProblemDetails, list['RecordRelation']]
179
+ """
180
+
181
+ return (
182
+ await asyncio_detailed(
183
+ record_id=record_id,
184
+ client=client,
185
+ body=body,
186
+ )
187
+ ).parsed
@@ -0,0 +1,162 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.create_record_command import CreateRecordCommand
9
+ from ...models.http_validation_problem_details import HttpValidationProblemDetails
10
+ from ...models.record import Record
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ *,
16
+ body: CreateRecordCommand,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "post",
22
+ "url": "/api/Records",
23
+ }
24
+
25
+ _kwargs["json"] = body.to_dict()
26
+
27
+ headers["Content-Type"] = "application/json"
28
+
29
+ _kwargs["headers"] = headers
30
+ return _kwargs
31
+
32
+
33
+ def _parse_response(
34
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
35
+ ) -> Optional[Union[HttpValidationProblemDetails, Record]]:
36
+ if response.status_code == 201:
37
+ response_201 = Record.from_dict(response.json())
38
+
39
+ return response_201
40
+
41
+ if response.status_code == 400:
42
+ response_400 = HttpValidationProblemDetails.from_dict(response.json())
43
+
44
+ return response_400
45
+
46
+ if client.raise_on_unexpected_status:
47
+ raise errors.UnexpectedStatus(response.status_code, response.content)
48
+ else:
49
+ return None
50
+
51
+
52
+ def _build_response(
53
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
54
+ ) -> Response[Union[HttpValidationProblemDetails, Record]]:
55
+ return Response(
56
+ status_code=HTTPStatus(response.status_code),
57
+ content=response.content,
58
+ headers=response.headers,
59
+ parsed=_parse_response(client=client, response=response),
60
+ )
61
+
62
+
63
+ def sync_detailed(
64
+ *,
65
+ client: Union[AuthenticatedClient, Client],
66
+ body: CreateRecordCommand,
67
+ ) -> Response[Union[HttpValidationProblemDetails, Record]]:
68
+ """
69
+ Args:
70
+ body (CreateRecordCommand):
71
+
72
+ Raises:
73
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
74
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
75
+
76
+ Returns:
77
+ Response[Union[HttpValidationProblemDetails, Record]]
78
+ """
79
+
80
+ kwargs = _get_kwargs(
81
+ body=body,
82
+ )
83
+
84
+ response = client.get_httpx_client().request(
85
+ **kwargs,
86
+ )
87
+
88
+ return _build_response(client=client, response=response)
89
+
90
+
91
+ def sync(
92
+ *,
93
+ client: Union[AuthenticatedClient, Client],
94
+ body: CreateRecordCommand,
95
+ ) -> Optional[Union[HttpValidationProblemDetails, Record]]:
96
+ """
97
+ Args:
98
+ body (CreateRecordCommand):
99
+
100
+ Raises:
101
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
102
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
103
+
104
+ Returns:
105
+ Union[HttpValidationProblemDetails, Record]
106
+ """
107
+
108
+ return sync_detailed(
109
+ client=client,
110
+ body=body,
111
+ ).parsed
112
+
113
+
114
+ async def asyncio_detailed(
115
+ *,
116
+ client: Union[AuthenticatedClient, Client],
117
+ body: CreateRecordCommand,
118
+ ) -> Response[Union[HttpValidationProblemDetails, Record]]:
119
+ """
120
+ Args:
121
+ body (CreateRecordCommand):
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[Union[HttpValidationProblemDetails, Record]]
129
+ """
130
+
131
+ kwargs = _get_kwargs(
132
+ body=body,
133
+ )
134
+
135
+ response = await client.get_async_httpx_client().request(**kwargs)
136
+
137
+ return _build_response(client=client, response=response)
138
+
139
+
140
+ async def asyncio(
141
+ *,
142
+ client: Union[AuthenticatedClient, Client],
143
+ body: CreateRecordCommand,
144
+ ) -> Optional[Union[HttpValidationProblemDetails, Record]]:
145
+ """
146
+ Args:
147
+ body (CreateRecordCommand):
148
+
149
+ Raises:
150
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
151
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
152
+
153
+ Returns:
154
+ Union[HttpValidationProblemDetails, Record]
155
+ """
156
+
157
+ return (
158
+ await asyncio_detailed(
159
+ client=client,
160
+ body=body,
161
+ )
162
+ ).parsed