| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
from json.decoder import JSONDecodeError |
| 5 |
|
| 6 |
from ....core.api_error import ApiError |
| 7 |
from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 8 |
from ....core.http_response import AsyncHttpResponse, HttpResponse |
| 9 |
from ....core.jsonable_encoder import encode_path_param |
| 10 |
from ....core.pagination import AsyncPager, SyncPager |
| 11 |
from ....core.parse_error import ParsingError |
| 12 |
from ....core.pydantic_utilities import parse_obj_as |
| 13 |
from ....core.request_options import RequestOptions |
| 14 |
from ....errors.bad_request_error import BadRequestError |
| 15 |
from ....errors.conflict_error import ConflictError |
| 16 |
from ....errors.forbidden_error import ForbiddenError |
| 17 |
from ....errors.not_found_error import NotFoundError |
| 18 |
from ....errors.precondition_failed_error import PreconditionFailedError |
| 19 |
from ....errors.too_many_requests_error import TooManyRequestsError |
| 20 |
from ....errors.unauthorized_error import UnauthorizedError |
| 21 |
from ....types.action_module_version import ActionModuleVersion |
| 22 |
from ....types.create_action_module_version_response_content import CreateActionModuleVersionResponseContent |
| 23 |
from ....types.get_action_module_version_response_content import GetActionModuleVersionResponseContent |
| 24 |
from ....types.get_action_module_versions_response_content import GetActionModuleVersionsResponseContent |
| 25 |
from pydantic import ValidationError |
| 26 |
|
| 27 |
|
| 28 |
class RawVersionsClient: |
| 29 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 30 |
self._client_wrapper = client_wrapper |
| 31 |
|
| 32 |
def list( |
| 33 |
self, |
| 34 |
id: str, |
| 35 |
*, |
| 36 |
page: typing.Optional[int] = 0, |
| 37 |
per_page: typing.Optional[int] = 50, |
| 38 |
request_options: typing.Optional[RequestOptions] = None, |
| 39 |
) -> SyncPager[ActionModuleVersion, GetActionModuleVersionsResponseContent]: |
| 40 |
""" |
| 41 |
List all published versions of a specific Actions Module. |
| 42 |
|
| 43 |
Parameters |
| 44 |
---------- |
| 45 |
id : str |
| 46 |
The unique ID of the module. |
| 47 |
|
| 48 |
page : typing.Optional[int] |
| 49 |
Use this field to request a specific page of the list results. |
| 50 |
|
| 51 |
per_page : typing.Optional[int] |
| 52 |
The maximum number of results to be returned by the server in a single response. 20 by default. |
| 53 |
|
| 54 |
request_options : typing.Optional[RequestOptions] |
| 55 |
Request-specific configuration. |
| 56 |
|
| 57 |
Returns |
| 58 |
------- |
| 59 |
SyncPager[ActionModuleVersion, GetActionModuleVersionsResponseContent] |
| 60 |
The module versions were retrieved. |
| 61 |
""" |
| 62 |
page = page if page is not None else 0 |
| 63 |
|
| 64 |
_response = self._client_wrapper.httpx_client.request( |
| 65 |
f"actions/modules/{encode_path_param(id)}/versions", |
| 66 |
method="GET", |
| 67 |
params={ |
| 68 |
"page": page, |
| 69 |
"per_page": per_page, |
| 70 |
}, |
| 71 |
request_options=request_options, |
| 72 |
) |
| 73 |
try: |
| 74 |
if 200 <= _response.status_code < 300: |
| 75 |
_parsed_response = typing.cast( |
| 76 |
GetActionModuleVersionsResponseContent, |
| 77 |
parse_obj_as( |
| 78 |
type_=GetActionModuleVersionsResponseContent, |
| 79 |
object_=_response.json(), |
| 80 |
), |
| 81 |
) |
| 82 |
_items = _parsed_response.versions |
| 83 |
_has_next = len(_items or []) > 0 |
| 84 |
_get_next = lambda: self.list( |
| 85 |
id, |
| 86 |
page=page + 1, |
| 87 |
per_page=per_page, |
| 88 |
request_options=request_options, |
| 89 |
) |
| 90 |
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response) |
| 91 |
if _response.status_code == 400: |
| 92 |
raise BadRequestError( |
| 93 |
headers=dict(_response.headers), |
| 94 |
body=typing.cast( |
| 95 |
typing.Any, |
| 96 |
parse_obj_as( |
| 97 |
type_=typing.Any, |
| 98 |
object_=_response.json(), |
| 99 |
), |
| 100 |
), |
| 101 |
) |
| 102 |
if _response.status_code == 401: |
| 103 |
raise UnauthorizedError( |
| 104 |
headers=dict(_response.headers), |
| 105 |
body=typing.cast( |
| 106 |
typing.Any, |
| 107 |
parse_obj_as( |
| 108 |
type_=typing.Any, |
| 109 |
object_=_response.json(), |
| 110 |
), |
| 111 |
), |
| 112 |
) |
| 113 |
if _response.status_code == 403: |
| 114 |
raise ForbiddenError( |
| 115 |
headers=dict(_response.headers), |
| 116 |
body=typing.cast( |
| 117 |
typing.Any, |
| 118 |
parse_obj_as( |
| 119 |
type_=typing.Any, |
| 120 |
object_=_response.json(), |
| 121 |
), |
| 122 |
), |
| 123 |
) |
| 124 |
if _response.status_code == 404: |
| 125 |
raise NotFoundError( |
| 126 |
headers=dict(_response.headers), |
| 127 |
body=typing.cast( |
| 128 |
typing.Any, |
| 129 |
parse_obj_as( |
| 130 |
type_=typing.Any, |
| 131 |
object_=_response.json(), |
| 132 |
), |
| 133 |
), |
| 134 |
) |
| 135 |
if _response.status_code == 429: |
| 136 |
raise TooManyRequestsError( |
| 137 |
headers=dict(_response.headers), |
| 138 |
body=typing.cast( |
| 139 |
typing.Any, |
| 140 |
parse_obj_as( |
| 141 |
type_=typing.Any, |
| 142 |
object_=_response.json(), |
| 143 |
), |
| 144 |
), |
| 145 |
) |
| 146 |
_response_json = _response.json() |
| 147 |
except JSONDecodeError: |
| 148 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 149 |
except ValidationError as e: |
| 150 |
raise ParsingError( |
| 151 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 152 |
) |
| 153 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 154 |
|
| 155 |
def create( |
| 156 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 157 |
) -> HttpResponse[CreateActionModuleVersionResponseContent]: |
| 158 |
""" |
| 159 |
Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development. |
| 160 |
|
| 161 |
Parameters |
| 162 |
---------- |
| 163 |
id : str |
| 164 |
The ID of the action module to create a version for. |
| 165 |
|
| 166 |
request_options : typing.Optional[RequestOptions] |
| 167 |
Request-specific configuration. |
| 168 |
|
| 169 |
Returns |
| 170 |
------- |
| 171 |
HttpResponse[CreateActionModuleVersionResponseContent] |
| 172 |
The action module version was created. |
| 173 |
""" |
| 174 |
_response = self._client_wrapper.httpx_client.request( |
| 175 |
f"actions/modules/{encode_path_param(id)}/versions", |
| 176 |
method="POST", |
| 177 |
request_options=request_options, |
| 178 |
) |
| 179 |
try: |
| 180 |
if 200 <= _response.status_code < 300: |
| 181 |
_data = typing.cast( |
| 182 |
CreateActionModuleVersionResponseContent, |
| 183 |
parse_obj_as( |
| 184 |
type_=CreateActionModuleVersionResponseContent, |
| 185 |
object_=_response.json(), |
| 186 |
), |
| 187 |
) |
| 188 |
return HttpResponse(response=_response, data=_data) |
| 189 |
if _response.status_code == 400: |
| 190 |
raise BadRequestError( |
| 191 |
headers=dict(_response.headers), |
| 192 |
body=typing.cast( |
| 193 |
typing.Any, |
| 194 |
parse_obj_as( |
| 195 |
type_=typing.Any, |
| 196 |
object_=_response.json(), |
| 197 |
), |
| 198 |
), |
| 199 |
) |
| 200 |
if _response.status_code == 401: |
| 201 |
raise UnauthorizedError( |
| 202 |
headers=dict(_response.headers), |
| 203 |
body=typing.cast( |
| 204 |
typing.Any, |
| 205 |
parse_obj_as( |
| 206 |
type_=typing.Any, |
| 207 |
object_=_response.json(), |
| 208 |
), |
| 209 |
), |
| 210 |
) |
| 211 |
if _response.status_code == 403: |
| 212 |
raise ForbiddenError( |
| 213 |
headers=dict(_response.headers), |
| 214 |
body=typing.cast( |
| 215 |
typing.Any, |
| 216 |
parse_obj_as( |
| 217 |
type_=typing.Any, |
| 218 |
object_=_response.json(), |
| 219 |
), |
| 220 |
), |
| 221 |
) |
| 222 |
if _response.status_code == 404: |
| 223 |
raise NotFoundError( |
| 224 |
headers=dict(_response.headers), |
| 225 |
body=typing.cast( |
| 226 |
typing.Any, |
| 227 |
parse_obj_as( |
| 228 |
type_=typing.Any, |
| 229 |
object_=_response.json(), |
| 230 |
), |
| 231 |
), |
| 232 |
) |
| 233 |
if _response.status_code == 409: |
| 234 |
raise ConflictError( |
| 235 |
headers=dict(_response.headers), |
| 236 |
body=typing.cast( |
| 237 |
typing.Any, |
| 238 |
parse_obj_as( |
| 239 |
type_=typing.Any, |
| 240 |
object_=_response.json(), |
| 241 |
), |
| 242 |
), |
| 243 |
) |
| 244 |
if _response.status_code == 412: |
| 245 |
raise PreconditionFailedError( |
| 246 |
headers=dict(_response.headers), |
| 247 |
body=typing.cast( |
| 248 |
typing.Any, |
| 249 |
parse_obj_as( |
| 250 |
type_=typing.Any, |
| 251 |
object_=_response.json(), |
| 252 |
), |
| 253 |
), |
| 254 |
) |
| 255 |
_response_json = _response.json() |
| 256 |
except JSONDecodeError: |
| 257 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 258 |
except ValidationError as e: |
| 259 |
raise ParsingError( |
| 260 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 261 |
) |
| 262 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 263 |
|
| 264 |
def get( |
| 265 |
self, id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 266 |
) -> HttpResponse[GetActionModuleVersionResponseContent]: |
| 267 |
""" |
| 268 |
Retrieve the details of a specific, immutable version of an Actions Module. |
| 269 |
|
| 270 |
Parameters |
| 271 |
---------- |
| 272 |
id : str |
| 273 |
The unique ID of the module. |
| 274 |
|
| 275 |
version_id : str |
| 276 |
The unique ID of the module version to retrieve. |
| 277 |
|
| 278 |
request_options : typing.Optional[RequestOptions] |
| 279 |
Request-specific configuration. |
| 280 |
|
| 281 |
Returns |
| 282 |
------- |
| 283 |
HttpResponse[GetActionModuleVersionResponseContent] |
| 284 |
The module version was retrieved. |
| 285 |
""" |
| 286 |
_response = self._client_wrapper.httpx_client.request( |
| 287 |
f"actions/modules/{encode_path_param(id)}/versions/{encode_path_param(version_id)}", |
| 288 |
method="GET", |
| 289 |
request_options=request_options, |
| 290 |
) |
| 291 |
try: |
| 292 |
if 200 <= _response.status_code < 300: |
| 293 |
_data = typing.cast( |
| 294 |
GetActionModuleVersionResponseContent, |
| 295 |
parse_obj_as( |
| 296 |
type_=GetActionModuleVersionResponseContent, |
| 297 |
object_=_response.json(), |
| 298 |
), |
| 299 |
) |
| 300 |
return HttpResponse(response=_response, data=_data) |
| 301 |
if _response.status_code == 400: |
| 302 |
raise BadRequestError( |
| 303 |
headers=dict(_response.headers), |
| 304 |
body=typing.cast( |
| 305 |
typing.Any, |
| 306 |
parse_obj_as( |
| 307 |
type_=typing.Any, |
| 308 |
object_=_response.json(), |
| 309 |
), |
| 310 |
), |
| 311 |
) |
| 312 |
if _response.status_code == 401: |
| 313 |
raise UnauthorizedError( |
| 314 |
headers=dict(_response.headers), |
| 315 |
body=typing.cast( |
| 316 |
typing.Any, |
| 317 |
parse_obj_as( |
| 318 |
type_=typing.Any, |
| 319 |
object_=_response.json(), |
| 320 |
), |
| 321 |
), |
| 322 |
) |
| 323 |
if _response.status_code == 403: |
| 324 |
raise ForbiddenError( |
| 325 |
headers=dict(_response.headers), |
| 326 |
body=typing.cast( |
| 327 |
typing.Any, |
| 328 |
parse_obj_as( |
| 329 |
type_=typing.Any, |
| 330 |
object_=_response.json(), |
| 331 |
), |
| 332 |
), |
| 333 |
) |
| 334 |
if _response.status_code == 404: |
| 335 |
raise NotFoundError( |
| 336 |
headers=dict(_response.headers), |
| 337 |
body=typing.cast( |
| 338 |
typing.Any, |
| 339 |
parse_obj_as( |
| 340 |
type_=typing.Any, |
| 341 |
object_=_response.json(), |
| 342 |
), |
| 343 |
), |
| 344 |
) |
| 345 |
if _response.status_code == 429: |
| 346 |
raise TooManyRequestsError( |
| 347 |
headers=dict(_response.headers), |
| 348 |
body=typing.cast( |
| 349 |
typing.Any, |
| 350 |
parse_obj_as( |
| 351 |
type_=typing.Any, |
| 352 |
object_=_response.json(), |
| 353 |
), |
| 354 |
), |
| 355 |
) |
| 356 |
_response_json = _response.json() |
| 357 |
except JSONDecodeError: |
| 358 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 359 |
except ValidationError as e: |
| 360 |
raise ParsingError( |
| 361 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 362 |
) |
| 363 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 364 |
|
| 365 |
|
| 366 |
class AsyncRawVersionsClient: |
| 367 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 368 |
self._client_wrapper = client_wrapper |
| 369 |
|
| 370 |
async def list( |
| 371 |
self, |
| 372 |
id: str, |
| 373 |
*, |
| 374 |
page: typing.Optional[int] = 0, |
| 375 |
per_page: typing.Optional[int] = 50, |
| 376 |
request_options: typing.Optional[RequestOptions] = None, |
| 377 |
) -> AsyncPager[ActionModuleVersion, GetActionModuleVersionsResponseContent]: |
| 378 |
""" |
| 379 |
List all published versions of a specific Actions Module. |
| 380 |
|
| 381 |
Parameters |
| 382 |
---------- |
| 383 |
id : str |
| 384 |
The unique ID of the module. |
| 385 |
|
| 386 |
page : typing.Optional[int] |
| 387 |
Use this field to request a specific page of the list results. |
| 388 |
|
| 389 |
per_page : typing.Optional[int] |
| 390 |
The maximum number of results to be returned by the server in a single response. 20 by default. |
| 391 |
|
| 392 |
request_options : typing.Optional[RequestOptions] |
| 393 |
Request-specific configuration. |
| 394 |
|
| 395 |
Returns |
| 396 |
------- |
| 397 |
AsyncPager[ActionModuleVersion, GetActionModuleVersionsResponseContent] |
| 398 |
The module versions were retrieved. |
| 399 |
""" |
| 400 |
page = page if page is not None else 0 |
| 401 |
|
| 402 |
_response = await self._client_wrapper.httpx_client.request( |
| 403 |
f"actions/modules/{encode_path_param(id)}/versions", |
| 404 |
method="GET", |
| 405 |
params={ |
| 406 |
"page": page, |
| 407 |
"per_page": per_page, |
| 408 |
}, |
| 409 |
request_options=request_options, |
| 410 |
) |
| 411 |
try: |
| 412 |
if 200 <= _response.status_code < 300: |
| 413 |
_parsed_response = typing.cast( |
| 414 |
GetActionModuleVersionsResponseContent, |
| 415 |
parse_obj_as( |
| 416 |
type_=GetActionModuleVersionsResponseContent, |
| 417 |
object_=_response.json(), |
| 418 |
), |
| 419 |
) |
| 420 |
_items = _parsed_response.versions |
| 421 |
_has_next = len(_items or []) > 0 |
| 422 |
|
| 423 |
async def _get_next(): |
| 424 |
return await self.list( |
| 425 |
id, |
| 426 |
page=page + 1, |
| 427 |
per_page=per_page, |
| 428 |
request_options=request_options, |
| 429 |
) |
| 430 |
|
| 431 |
return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response) |
| 432 |
if _response.status_code == 400: |
| 433 |
raise BadRequestError( |
| 434 |
headers=dict(_response.headers), |
| 435 |
body=typing.cast( |
| 436 |
typing.Any, |
| 437 |
parse_obj_as( |
| 438 |
type_=typing.Any, |
| 439 |
object_=_response.json(), |
| 440 |
), |
| 441 |
), |
| 442 |
) |
| 443 |
if _response.status_code == 401: |
| 444 |
raise UnauthorizedError( |
| 445 |
headers=dict(_response.headers), |
| 446 |
body=typing.cast( |
| 447 |
typing.Any, |
| 448 |
parse_obj_as( |
| 449 |
type_=typing.Any, |
| 450 |
object_=_response.json(), |
| 451 |
), |
| 452 |
), |
| 453 |
) |
| 454 |
if _response.status_code == 403: |
| 455 |
raise ForbiddenError( |
| 456 |
headers=dict(_response.headers), |
| 457 |
body=typing.cast( |
| 458 |
typing.Any, |
| 459 |
parse_obj_as( |
| 460 |
type_=typing.Any, |
| 461 |
object_=_response.json(), |
| 462 |
), |
| 463 |
), |
| 464 |
) |
| 465 |
if _response.status_code == 404: |
| 466 |
raise NotFoundError( |
| 467 |
headers=dict(_response.headers), |
| 468 |
body=typing.cast( |
| 469 |
typing.Any, |
| 470 |
parse_obj_as( |
| 471 |
type_=typing.Any, |
| 472 |
object_=_response.json(), |
| 473 |
), |
| 474 |
), |
| 475 |
) |
| 476 |
if _response.status_code == 429: |
| 477 |
raise TooManyRequestsError( |
| 478 |
headers=dict(_response.headers), |
| 479 |
body=typing.cast( |
| 480 |
typing.Any, |
| 481 |
parse_obj_as( |
| 482 |
type_=typing.Any, |
| 483 |
object_=_response.json(), |
| 484 |
), |
| 485 |
), |
| 486 |
) |
| 487 |
_response_json = _response.json() |
| 488 |
except JSONDecodeError: |
| 489 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 490 |
except ValidationError as e: |
| 491 |
raise ParsingError( |
| 492 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 493 |
) |
| 494 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 495 |
|
| 496 |
async def create( |
| 497 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 498 |
) -> AsyncHttpResponse[CreateActionModuleVersionResponseContent]: |
| 499 |
""" |
| 500 |
Creates a new immutable version of an Actions Module from the current draft version. This publishes the draft as a new version that can be referenced by actions, while maintaining the existing draft for continued development. |
| 501 |
|
| 502 |
Parameters |
| 503 |
---------- |
| 504 |
id : str |
| 505 |
The ID of the action module to create a version for. |
| 506 |
|
| 507 |
request_options : typing.Optional[RequestOptions] |
| 508 |
Request-specific configuration. |
| 509 |
|
| 510 |
Returns |
| 511 |
------- |
| 512 |
AsyncHttpResponse[CreateActionModuleVersionResponseContent] |
| 513 |
The action module version was created. |
| 514 |
""" |
| 515 |
_response = await self._client_wrapper.httpx_client.request( |
| 516 |
f"actions/modules/{encode_path_param(id)}/versions", |
| 517 |
method="POST", |
| 518 |
request_options=request_options, |
| 519 |
) |
| 520 |
try: |
| 521 |
if 200 <= _response.status_code < 300: |
| 522 |
_data = typing.cast( |
| 523 |
CreateActionModuleVersionResponseContent, |
| 524 |
parse_obj_as( |
| 525 |
type_=CreateActionModuleVersionResponseContent, |
| 526 |
object_=_response.json(), |
| 527 |
), |
| 528 |
) |
| 529 |
return AsyncHttpResponse(response=_response, data=_data) |
| 530 |
if _response.status_code == 400: |
| 531 |
raise BadRequestError( |
| 532 |
headers=dict(_response.headers), |
| 533 |
body=typing.cast( |
| 534 |
typing.Any, |
| 535 |
parse_obj_as( |
| 536 |
type_=typing.Any, |
| 537 |
object_=_response.json(), |
| 538 |
), |
| 539 |
), |
| 540 |
) |
| 541 |
if _response.status_code == 401: |
| 542 |
raise UnauthorizedError( |
| 543 |
headers=dict(_response.headers), |
| 544 |
body=typing.cast( |
| 545 |
typing.Any, |
| 546 |
parse_obj_as( |
| 547 |
type_=typing.Any, |
| 548 |
object_=_response.json(), |
| 549 |
), |
| 550 |
), |
| 551 |
) |
| 552 |
if _response.status_code == 403: |
| 553 |
raise ForbiddenError( |
| 554 |
headers=dict(_response.headers), |
| 555 |
body=typing.cast( |
| 556 |
typing.Any, |
| 557 |
parse_obj_as( |
| 558 |
type_=typing.Any, |
| 559 |
object_=_response.json(), |
| 560 |
), |
| 561 |
), |
| 562 |
) |
| 563 |
if _response.status_code == 404: |
| 564 |
raise NotFoundError( |
| 565 |
headers=dict(_response.headers), |
| 566 |
body=typing.cast( |
| 567 |
typing.Any, |
| 568 |
parse_obj_as( |
| 569 |
type_=typing.Any, |
| 570 |
object_=_response.json(), |
| 571 |
), |
| 572 |
), |
| 573 |
) |
| 574 |
if _response.status_code == 409: |
| 575 |
raise ConflictError( |
| 576 |
headers=dict(_response.headers), |
| 577 |
body=typing.cast( |
| 578 |
typing.Any, |
| 579 |
parse_obj_as( |
| 580 |
type_=typing.Any, |
| 581 |
object_=_response.json(), |
| 582 |
), |
| 583 |
), |
| 584 |
) |
| 585 |
if _response.status_code == 412: |
| 586 |
raise PreconditionFailedError( |
| 587 |
headers=dict(_response.headers), |
| 588 |
body=typing.cast( |
| 589 |
typing.Any, |
| 590 |
parse_obj_as( |
| 591 |
type_=typing.Any, |
| 592 |
object_=_response.json(), |
| 593 |
), |
| 594 |
), |
| 595 |
) |
| 596 |
_response_json = _response.json() |
| 597 |
except JSONDecodeError: |
| 598 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 599 |
except ValidationError as e: |
| 600 |
raise ParsingError( |
| 601 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 602 |
) |
| 603 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |
| 604 |
|
| 605 |
async def get( |
| 606 |
self, id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 607 |
) -> AsyncHttpResponse[GetActionModuleVersionResponseContent]: |
| 608 |
""" |
| 609 |
Retrieve the details of a specific, immutable version of an Actions Module. |
| 610 |
|
| 611 |
Parameters |
| 612 |
---------- |
| 613 |
id : str |
| 614 |
The unique ID of the module. |
| 615 |
|
| 616 |
version_id : str |
| 617 |
The unique ID of the module version to retrieve. |
| 618 |
|
| 619 |
request_options : typing.Optional[RequestOptions] |
| 620 |
Request-specific configuration. |
| 621 |
|
| 622 |
Returns |
| 623 |
------- |
| 624 |
AsyncHttpResponse[GetActionModuleVersionResponseContent] |
| 625 |
The module version was retrieved. |
| 626 |
""" |
| 627 |
_response = await self._client_wrapper.httpx_client.request( |
| 628 |
f"actions/modules/{encode_path_param(id)}/versions/{encode_path_param(version_id)}", |
| 629 |
method="GET", |
| 630 |
request_options=request_options, |
| 631 |
) |
| 632 |
try: |
| 633 |
if 200 <= _response.status_code < 300: |
| 634 |
_data = typing.cast( |
| 635 |
GetActionModuleVersionResponseContent, |
| 636 |
parse_obj_as( |
| 637 |
type_=GetActionModuleVersionResponseContent, |
| 638 |
object_=_response.json(), |
| 639 |
), |
| 640 |
) |
| 641 |
return AsyncHttpResponse(response=_response, data=_data) |
| 642 |
if _response.status_code == 400: |
| 643 |
raise BadRequestError( |
| 644 |
headers=dict(_response.headers), |
| 645 |
body=typing.cast( |
| 646 |
typing.Any, |
| 647 |
parse_obj_as( |
| 648 |
type_=typing.Any, |
| 649 |
object_=_response.json(), |
| 650 |
), |
| 651 |
), |
| 652 |
) |
| 653 |
if _response.status_code == 401: |
| 654 |
raise UnauthorizedError( |
| 655 |
headers=dict(_response.headers), |
| 656 |
body=typing.cast( |
| 657 |
typing.Any, |
| 658 |
parse_obj_as( |
| 659 |
type_=typing.Any, |
| 660 |
object_=_response.json(), |
| 661 |
), |
| 662 |
), |
| 663 |
) |
| 664 |
if _response.status_code == 403: |
| 665 |
raise ForbiddenError( |
| 666 |
headers=dict(_response.headers), |
| 667 |
body=typing.cast( |
| 668 |
typing.Any, |
| 669 |
parse_obj_as( |
| 670 |
type_=typing.Any, |
| 671 |
object_=_response.json(), |
| 672 |
), |
| 673 |
), |
| 674 |
) |
| 675 |
if _response.status_code == 404: |
| 676 |
raise NotFoundError( |
| 677 |
headers=dict(_response.headers), |
| 678 |
body=typing.cast( |
| 679 |
typing.Any, |
| 680 |
parse_obj_as( |
| 681 |
type_=typing.Any, |
| 682 |
object_=_response.json(), |
| 683 |
), |
| 684 |
), |
| 685 |
) |
| 686 |
if _response.status_code == 429: |
| 687 |
raise TooManyRequestsError( |
| 688 |
headers=dict(_response.headers), |
| 689 |
body=typing.cast( |
| 690 |
typing.Any, |
| 691 |
parse_obj_as( |
| 692 |
type_=typing.Any, |
| 693 |
object_=_response.json(), |
| 694 |
), |
| 695 |
), |
| 696 |
) |
| 697 |
_response_json = _response.json() |
| 698 |
except JSONDecodeError: |
| 699 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) |
| 700 |
except ValidationError as e: |
| 701 |
raise ParsingError( |
| 702 |
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e |
| 703 |
) |
| 704 |
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) |