|
20 | 20 | from .types.get_connect_status_response import GetConnectStatusResponse |
21 | 21 | from .types.get_connection_response import GetConnectionResponse |
22 | 22 | from .types.get_connection_webhook_response import GetConnectionWebhookResponse |
| 23 | +from .types.import_connections_request_body import ImportConnectionsRequestBody |
| 24 | +from .types.import_connections_response import ImportConnectionsResponse |
23 | 25 |
|
24 | 26 | try: |
25 | 27 | import pydantic.v1 as pydantic # type: ignore |
@@ -326,6 +328,54 @@ def get_integration_status( |
326 | 328 | raise ApiError(status_code=_response.status_code, body=_response.text) |
327 | 329 | raise ApiError(status_code=_response.status_code, body=_response_json) |
328 | 330 |
|
| 331 | + def import_connections( |
| 332 | + self, |
| 333 | + *, |
| 334 | + request: ImportConnectionsRequestBody, |
| 335 | + x_revert_api_token: str, |
| 336 | + x_api_version: typing.Optional[str] = None, |
| 337 | + x_revert_t_id: str, |
| 338 | + ) -> ImportConnectionsResponse: |
| 339 | + """ |
| 340 | + Import multiple connections for a specific environment. Use this to bulk import connections as a one-time exercise. |
| 341 | +
|
| 342 | + Parameters: |
| 343 | + - request: ImportConnectionsRequestBody. |
| 344 | +
|
| 345 | + - x_revert_api_token: str. Your official API key for accessing revert apis. |
| 346 | +
|
| 347 | + - x_api_version: typing.Optional[str]. Optional Revert API version you're using. If missing we default to the latest version of the API. |
| 348 | +
|
| 349 | + - x_revert_t_id: str. The unique customer id used when the customer linked their account. |
| 350 | + """ |
| 351 | + _response = self._client_wrapper.httpx_client.request( |
| 352 | + "POST", |
| 353 | + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "connection/import"), |
| 354 | + json=jsonable_encoder(request), |
| 355 | + headers=remove_none_from_dict( |
| 356 | + { |
| 357 | + **self._client_wrapper.get_headers(), |
| 358 | + "x-revert-api-token": x_revert_api_token, |
| 359 | + "x-api-version": x_api_version, |
| 360 | + "x-revert-t-id": x_revert_t_id, |
| 361 | + } |
| 362 | + ), |
| 363 | + timeout=None, |
| 364 | + ) |
| 365 | + if 200 <= _response.status_code < 300: |
| 366 | + return pydantic.parse_obj_as(ImportConnectionsResponse, _response.json()) # type: ignore |
| 367 | + if _response.status_code == 401: |
| 368 | + raise UnAuthorizedError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore |
| 369 | + if _response.status_code == 500: |
| 370 | + raise InternalServerError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore |
| 371 | + if _response.status_code == 404: |
| 372 | + raise NotFoundError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore |
| 373 | + try: |
| 374 | + _response_json = _response.json() |
| 375 | + except JSONDecodeError: |
| 376 | + raise ApiError(status_code=_response.status_code, body=_response.text) |
| 377 | + raise ApiError(status_code=_response.status_code, body=_response_json) |
| 378 | + |
329 | 379 |
|
330 | 380 | class AsyncConnectionClient: |
331 | 381 | def __init__(self, *, client_wrapper: AsyncClientWrapper): |
@@ -622,3 +672,51 @@ async def get_integration_status( |
622 | 672 | except JSONDecodeError: |
623 | 673 | raise ApiError(status_code=_response.status_code, body=_response.text) |
624 | 674 | raise ApiError(status_code=_response.status_code, body=_response_json) |
| 675 | + |
| 676 | + async def import_connections( |
| 677 | + self, |
| 678 | + *, |
| 679 | + request: ImportConnectionsRequestBody, |
| 680 | + x_revert_api_token: str, |
| 681 | + x_api_version: typing.Optional[str] = None, |
| 682 | + x_revert_t_id: str, |
| 683 | + ) -> ImportConnectionsResponse: |
| 684 | + """ |
| 685 | + Import multiple connections for a specific environment. Use this to bulk import connections as a one-time exercise. |
| 686 | +
|
| 687 | + Parameters: |
| 688 | + - request: ImportConnectionsRequestBody. |
| 689 | +
|
| 690 | + - x_revert_api_token: str. Your official API key for accessing revert apis. |
| 691 | +
|
| 692 | + - x_api_version: typing.Optional[str]. Optional Revert API version you're using. If missing we default to the latest version of the API. |
| 693 | +
|
| 694 | + - x_revert_t_id: str. The unique customer id used when the customer linked their account. |
| 695 | + """ |
| 696 | + _response = await self._client_wrapper.httpx_client.request( |
| 697 | + "POST", |
| 698 | + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "connection/import"), |
| 699 | + json=jsonable_encoder(request), |
| 700 | + headers=remove_none_from_dict( |
| 701 | + { |
| 702 | + **self._client_wrapper.get_headers(), |
| 703 | + "x-revert-api-token": x_revert_api_token, |
| 704 | + "x-api-version": x_api_version, |
| 705 | + "x-revert-t-id": x_revert_t_id, |
| 706 | + } |
| 707 | + ), |
| 708 | + timeout=None, |
| 709 | + ) |
| 710 | + if 200 <= _response.status_code < 300: |
| 711 | + return pydantic.parse_obj_as(ImportConnectionsResponse, _response.json()) # type: ignore |
| 712 | + if _response.status_code == 401: |
| 713 | + raise UnAuthorizedError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore |
| 714 | + if _response.status_code == 500: |
| 715 | + raise InternalServerError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore |
| 716 | + if _response.status_code == 404: |
| 717 | + raise NotFoundError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore |
| 718 | + try: |
| 719 | + _response_json = _response.json() |
| 720 | + except JSONDecodeError: |
| 721 | + raise ApiError(status_code=_response.status_code, body=_response.text) |
| 722 | + raise ApiError(status_code=_response.status_code, body=_response_json) |
0 commit comments