Skip to content

Commit 0c10e5f

Browse files
committed
Release 0.0.852
1 parent 57f2dd2 commit 0c10e5f

15 files changed

+203
-13
lines changed

poetry.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "revert-api"
3-
version = "0.0.834"
3+
version = "0.0.852"
44
description = ""
55
readme = "README.md"
66
authors = []

src/revert/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
ImportConnectionsRequestBody,
2727
ImportConnectionsResponse,
2828
MappableFieldType,
29+
TriggerSyncResponse,
2930
chat,
3031
common,
3132
connection,
3233
crm,
3334
field_mapping,
3435
metadata,
36+
sync,
3537
ticket,
3638
)
3739
from .environment import RevertEnvironment
@@ -63,11 +65,13 @@
6365
"ImportConnectionsResponse",
6466
"MappableFieldType",
6567
"RevertEnvironment",
68+
"TriggerSyncResponse",
6669
"chat",
6770
"common",
6871
"connection",
6972
"crm",
7073
"field_mapping",
7174
"metadata",
75+
"sync",
7276
"ticket",
7377
]

src/revert/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from .resources.crm.client import AsyncCrmClient, CrmClient
1212
from .resources.field_mapping.client import AsyncFieldMappingClient, FieldMappingClient
1313
from .resources.metadata.client import AsyncMetadataClient, MetadataClient
14+
from .resources.sync.client import AsyncSyncClient, SyncClient
1415
from .resources.ticket.client import AsyncTicketClient, TicketClient
1516

1617

@@ -32,6 +33,7 @@ def __init__(
3233
self.crm = CrmClient(client_wrapper=self._client_wrapper)
3334
self.field_mapping = FieldMappingClient(client_wrapper=self._client_wrapper)
3435
self.metadata = MetadataClient(client_wrapper=self._client_wrapper)
36+
self.sync = SyncClient(client_wrapper=self._client_wrapper)
3537
self.ticket = TicketClient(client_wrapper=self._client_wrapper)
3638

3739

@@ -53,6 +55,7 @@ def __init__(
5355
self.crm = AsyncCrmClient(client_wrapper=self._client_wrapper)
5456
self.field_mapping = AsyncFieldMappingClient(client_wrapper=self._client_wrapper)
5557
self.metadata = AsyncMetadataClient(client_wrapper=self._client_wrapper)
58+
self.sync = AsyncSyncClient(client_wrapper=self._client_wrapper)
5659
self.ticket = AsyncTicketClient(client_wrapper=self._client_wrapper)
5760

5861

src/revert/core/client_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def get_headers(self) -> typing.Dict[str, str]:
1313
headers: typing.Dict[str, str] = {
1414
"X-Fern-Language": "Python",
1515
"X-Fern-SDK-Name": "revert-api",
16-
"X-Fern-SDK-Version": "0.0.834",
16+
"X-Fern-SDK-Version": "0.0.852",
1717
}
1818
return headers
1919

src/revert/resources/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file was auto-generated by Fern from our API Definition.
22

3-
from . import chat, common, connection, crm, field_mapping, metadata, ticket
3+
from . import chat, common, connection, crm, field_mapping, metadata, sync, ticket
44
from .connection import (
55
ConnectionImport,
66
ConnectionStatus,
@@ -28,6 +28,7 @@
2828
MappableFieldType,
2929
)
3030
from .metadata import CrmMetadata, CrmMetadataResponse, CrmStatus
31+
from .sync import TriggerSyncResponse
3132

3233
__all__ = [
3334
"ConnectionImport",
@@ -55,11 +56,13 @@
5556
"ImportConnectionsRequestBody",
5657
"ImportConnectionsResponse",
5758
"MappableFieldType",
59+
"TriggerSyncResponse",
5860
"chat",
5961
"common",
6062
"connection",
6163
"crm",
6264
"field_mapping",
6365
"metadata",
66+
"sync",
6467
"ticket",
6568
]

src/revert/resources/common/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
LeadWrite,
3333
Message,
3434
NotFoundError,
35+
NotImplementedError,
3536
Note,
3637
NoteRead,
3738
NoteWrite,
@@ -89,6 +90,7 @@
8990
"LeadWrite",
9091
"Message",
9192
"NotFoundError",
93+
"NotImplementedError",
9294
"Note",
9395
"NoteRead",
9496
"NoteWrite",

src/revert/resources/common/resources/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@
1212
TicketStatus,
1313
Tpid,
1414
)
15-
from .errors import BadRequestError, BaseError, InternalServerError, NotFoundError, UnAuthorizedError
15+
from .errors import (
16+
BadRequestError,
17+
BaseError,
18+
InternalServerError,
19+
NotFoundError,
20+
NotImplementedError,
21+
UnAuthorizedError,
22+
)
1623
from . import associations, errors, types, unified
1724
from .associations import (
1825
CompanyAssociation,
@@ -86,6 +93,7 @@
8693
"LeadWrite",
8794
"Message",
8895
"NotFoundError",
96+
"NotImplementedError",
8997
"Note",
9098
"NoteRead",
9199
"NoteWrite",
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# This file was auto-generated by Fern from our API Definition.
22

33
from .types import BaseError
4-
from .errors import BadRequestError, InternalServerError, NotFoundError, UnAuthorizedError
4+
from .errors import BadRequestError, InternalServerError, NotFoundError, NotImplementedError, UnAuthorizedError
55

6-
__all__ = ["BadRequestError", "BaseError", "InternalServerError", "NotFoundError", "UnAuthorizedError"]
6+
__all__ = [
7+
"BadRequestError",
8+
"BaseError",
9+
"InternalServerError",
10+
"NotFoundError",
11+
"NotImplementedError",
12+
"UnAuthorizedError",
13+
]

src/revert/resources/common/resources/errors/errors/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .bad_request_error import BadRequestError
44
from .internal_server_error import InternalServerError
55
from .not_found_error import NotFoundError
6+
from .not_implemented_error import NotImplementedError
67
from .un_authorized_error import UnAuthorizedError
78

8-
__all__ = ["BadRequestError", "InternalServerError", "NotFoundError", "UnAuthorizedError"]
9+
__all__ = ["BadRequestError", "InternalServerError", "NotFoundError", "NotImplementedError", "UnAuthorizedError"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from ......core.api_error import ApiError
4+
from ..types.base_error import BaseError
5+
6+
7+
class NotImplementedError(ApiError):
8+
def __init__(self, body: BaseError):
9+
super().__init__(status_code=500, body=body)

src/revert/resources/sync/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from .types import TriggerSyncResponse
4+
5+
__all__ = ["TriggerSyncResponse"]

src/revert/resources/sync/client.py

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
import urllib.parse
5+
from json.decoder import JSONDecodeError
6+
7+
from ...core.api_error import ApiError
8+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9+
from ...core.remove_none_from_dict import remove_none_from_dict
10+
from ..common.resources.errors.errors.internal_server_error import InternalServerError
11+
from ..common.resources.errors.errors.not_found_error import NotFoundError
12+
from ..common.resources.errors.errors.not_implemented_error import NotImplementedError
13+
from ..common.resources.errors.errors.un_authorized_error import UnAuthorizedError
14+
from ..common.resources.errors.types.base_error import BaseError
15+
from .types.trigger_sync_response import TriggerSyncResponse
16+
17+
try:
18+
import pydantic.v1 as pydantic # type: ignore
19+
except ImportError:
20+
import pydantic # type: ignore
21+
22+
23+
class SyncClient:
24+
def __init__(self, *, client_wrapper: SyncClientWrapper):
25+
self._client_wrapper = client_wrapper
26+
27+
def trigger_sync(
28+
self, *, x_revert_api_token: str, x_revert_t_id: str, x_connection_api_key: typing.Optional[str] = None
29+
) -> TriggerSyncResponse:
30+
"""
31+
Trigger sync for a specific tenant
32+
33+
Parameters:
34+
- x_revert_api_token: str. Your official API key for accessing revert apis.
35+
36+
- x_revert_t_id: str. The unique customer id used when the customer linked their account.
37+
38+
- x_connection_api_key: typing.Optional[str]. API key for third party provider
39+
"""
40+
_response = self._client_wrapper.httpx_client.request(
41+
"POST",
42+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "sync"),
43+
headers=remove_none_from_dict(
44+
{
45+
**self._client_wrapper.get_headers(),
46+
"x-revert-api-token": x_revert_api_token,
47+
"x-revert-t-id": x_revert_t_id,
48+
"x-connection-api-key": x_connection_api_key,
49+
}
50+
),
51+
timeout=None,
52+
)
53+
if 200 <= _response.status_code < 300:
54+
return pydantic.parse_obj_as(TriggerSyncResponse, _response.json()) # type: ignore
55+
if _response.status_code == 401:
56+
raise UnAuthorizedError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore
57+
if _response.status_code == 500:
58+
raise InternalServerError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore
59+
if _response.status_code == 404:
60+
raise NotFoundError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore
61+
if _response.status_code == 500:
62+
raise NotImplementedError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore
63+
try:
64+
_response_json = _response.json()
65+
except JSONDecodeError:
66+
raise ApiError(status_code=_response.status_code, body=_response.text)
67+
raise ApiError(status_code=_response.status_code, body=_response_json)
68+
69+
70+
class AsyncSyncClient:
71+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
72+
self._client_wrapper = client_wrapper
73+
74+
async def trigger_sync(
75+
self, *, x_revert_api_token: str, x_revert_t_id: str, x_connection_api_key: typing.Optional[str] = None
76+
) -> TriggerSyncResponse:
77+
"""
78+
Trigger sync for a specific tenant
79+
80+
Parameters:
81+
- x_revert_api_token: str. Your official API key for accessing revert apis.
82+
83+
- x_revert_t_id: str. The unique customer id used when the customer linked their account.
84+
85+
- x_connection_api_key: typing.Optional[str]. API key for third party provider
86+
"""
87+
_response = await self._client_wrapper.httpx_client.request(
88+
"POST",
89+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "sync"),
90+
headers=remove_none_from_dict(
91+
{
92+
**self._client_wrapper.get_headers(),
93+
"x-revert-api-token": x_revert_api_token,
94+
"x-revert-t-id": x_revert_t_id,
95+
"x-connection-api-key": x_connection_api_key,
96+
}
97+
),
98+
timeout=None,
99+
)
100+
if 200 <= _response.status_code < 300:
101+
return pydantic.parse_obj_as(TriggerSyncResponse, _response.json()) # type: ignore
102+
if _response.status_code == 401:
103+
raise UnAuthorizedError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore
104+
if _response.status_code == 500:
105+
raise InternalServerError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore
106+
if _response.status_code == 404:
107+
raise NotFoundError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore
108+
if _response.status_code == 500:
109+
raise NotImplementedError(pydantic.parse_obj_as(BaseError, _response.json())) # type: ignore
110+
try:
111+
_response_json = _response.json()
112+
except JSONDecodeError:
113+
raise ApiError(status_code=_response.status_code, body=_response.text)
114+
raise ApiError(status_code=_response.status_code, body=_response_json)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from .trigger_sync_response import TriggerSyncResponse
4+
5+
__all__ = ["TriggerSyncResponse"]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import datetime as dt
4+
import typing
5+
6+
from ....core.datetime_utils import serialize_datetime
7+
from ...common.resources.types.types.response_status import ResponseStatus
8+
9+
try:
10+
import pydantic.v1 as pydantic # type: ignore
11+
except ImportError:
12+
import pydantic # type: ignore
13+
14+
15+
class TriggerSyncResponse(pydantic.BaseModel):
16+
status: ResponseStatus
17+
18+
def json(self, **kwargs: typing.Any) -> str:
19+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
20+
return super().json(**kwargs_with_defaults)
21+
22+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
23+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
24+
return super().dict(**kwargs_with_defaults)
25+
26+
class Config:
27+
frozen = True
28+
smart_union = True
29+
json_encoders = {dt.datetime: serialize_datetime}

0 commit comments

Comments
 (0)