-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57f2dd2
commit 0c10e5f
Showing
15 changed files
with
203 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
from .types import BaseError | ||
from .errors import BadRequestError, InternalServerError, NotFoundError, UnAuthorizedError | ||
from .errors import BadRequestError, InternalServerError, NotFoundError, NotImplementedError, UnAuthorizedError | ||
|
||
__all__ = ["BadRequestError", "BaseError", "InternalServerError", "NotFoundError", "UnAuthorizedError"] | ||
__all__ = [ | ||
"BadRequestError", | ||
"BaseError", | ||
"InternalServerError", | ||
"NotFoundError", | ||
"NotImplementedError", | ||
"UnAuthorizedError", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/revert/resources/common/resources/errors/errors/not_implemented_error.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
from ......core.api_error import ApiError | ||
from ..types.base_error import BaseError | ||
|
||
|
||
class NotImplementedError(ApiError): | ||
def __init__(self, body: BaseError): | ||
super().__init__(status_code=500, body=body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
from .types import TriggerSyncResponse | ||
|
||
__all__ = ["TriggerSyncResponse"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
import typing | ||
import urllib.parse | ||
from json.decoder import JSONDecodeError | ||
|
||
from ...core.api_error import ApiError | ||
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper | ||
from ...core.remove_none_from_dict import remove_none_from_dict | ||
from ..common.resources.errors.errors.internal_server_error import InternalServerError | ||
from ..common.resources.errors.errors.not_found_error import NotFoundError | ||
from ..common.resources.errors.errors.not_implemented_error import NotImplementedError | ||
from ..common.resources.errors.errors.un_authorized_error import UnAuthorizedError | ||
from ..common.resources.errors.types.base_error import BaseError | ||
from .types.trigger_sync_response import TriggerSyncResponse | ||
|
||
try: | ||
import pydantic.v1 as pydantic # type: ignore | ||
except ImportError: | ||
import pydantic # type: ignore | ||
|
||
|
||
class SyncClient: | ||
def __init__(self, *, client_wrapper: SyncClientWrapper): | ||
self._client_wrapper = client_wrapper | ||
|
||
def trigger_sync( | ||
self, *, x_revert_api_token: str, x_revert_t_id: str, x_connection_api_key: typing.Optional[str] = None | ||
) -> TriggerSyncResponse: | ||
""" | ||
Trigger sync for a specific tenant | ||
Parameters: | ||
- x_revert_api_token: str. Your official API key for accessing revert apis. | ||
- x_revert_t_id: str. The unique customer id used when the customer linked their account. | ||
- x_connection_api_key: typing.Optional[str]. API key for third party provider | ||
""" | ||
_response = self._client_wrapper.httpx_client.request( | ||
"POST", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "sync"), | ||
headers=remove_none_from_dict( | ||
{ | ||
**self._client_wrapper.get_headers(), | ||
"x-revert-api-token": x_revert_api_token, | ||
"x-revert-t-id": x_revert_t_id, | ||
"x-connection-api-key": x_connection_api_key, | ||
} | ||
), | ||
timeout=None, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(TriggerSyncResponse, _response.json()) # type: ignore | ||
if _response.status_code == 401: | ||
raise UnAuthorizedError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore | ||
if _response.status_code == 500: | ||
raise InternalServerError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore | ||
if _response.status_code == 404: | ||
raise NotFoundError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore | ||
if _response.status_code == 500: | ||
raise NotImplementedError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) | ||
|
||
|
||
class AsyncSyncClient: | ||
def __init__(self, *, client_wrapper: AsyncClientWrapper): | ||
self._client_wrapper = client_wrapper | ||
|
||
async def trigger_sync( | ||
self, *, x_revert_api_token: str, x_revert_t_id: str, x_connection_api_key: typing.Optional[str] = None | ||
) -> TriggerSyncResponse: | ||
""" | ||
Trigger sync for a specific tenant | ||
Parameters: | ||
- x_revert_api_token: str. Your official API key for accessing revert apis. | ||
- x_revert_t_id: str. The unique customer id used when the customer linked their account. | ||
- x_connection_api_key: typing.Optional[str]. API key for third party provider | ||
""" | ||
_response = await self._client_wrapper.httpx_client.request( | ||
"POST", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "sync"), | ||
headers=remove_none_from_dict( | ||
{ | ||
**self._client_wrapper.get_headers(), | ||
"x-revert-api-token": x_revert_api_token, | ||
"x-revert-t-id": x_revert_t_id, | ||
"x-connection-api-key": x_connection_api_key, | ||
} | ||
), | ||
timeout=None, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(TriggerSyncResponse, _response.json()) # type: ignore | ||
if _response.status_code == 401: | ||
raise UnAuthorizedError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore | ||
if _response.status_code == 500: | ||
raise InternalServerError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore | ||
if _response.status_code == 404: | ||
raise NotFoundError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore | ||
if _response.status_code == 500: | ||
raise NotImplementedError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
from .trigger_sync_response import TriggerSyncResponse | ||
|
||
__all__ = ["TriggerSyncResponse"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
import datetime as dt | ||
import typing | ||
|
||
from ....core.datetime_utils import serialize_datetime | ||
from ...common.resources.types.types.response_status import ResponseStatus | ||
|
||
try: | ||
import pydantic.v1 as pydantic # type: ignore | ||
except ImportError: | ||
import pydantic # type: ignore | ||
|
||
|
||
class TriggerSyncResponse(pydantic.BaseModel): | ||
status: ResponseStatus | ||
|
||
def json(self, **kwargs: typing.Any) -> str: | ||
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} | ||
return super().json(**kwargs_with_defaults) | ||
|
||
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: | ||
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} | ||
return super().dict(**kwargs_with_defaults) | ||
|
||
class Config: | ||
frozen = True | ||
smart_union = True | ||
json_encoders = {dt.datetime: serialize_datetime} |