Skip to content

Commit

Permalink
Release 0.0.852
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Apr 23, 2024
1 parent 57f2dd2 commit 0c10e5f
Show file tree
Hide file tree
Showing 15 changed files with 203 additions and 13 deletions.
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "revert-api"
version = "0.0.834"
version = "0.0.852"
description = ""
readme = "README.md"
authors = []
Expand Down
4 changes: 4 additions & 0 deletions src/revert/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
ImportConnectionsRequestBody,
ImportConnectionsResponse,
MappableFieldType,
TriggerSyncResponse,
chat,
common,
connection,
crm,
field_mapping,
metadata,
sync,
ticket,
)
from .environment import RevertEnvironment
Expand Down Expand Up @@ -63,11 +65,13 @@
"ImportConnectionsResponse",
"MappableFieldType",
"RevertEnvironment",
"TriggerSyncResponse",
"chat",
"common",
"connection",
"crm",
"field_mapping",
"metadata",
"sync",
"ticket",
]
3 changes: 3 additions & 0 deletions src/revert/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .resources.crm.client import AsyncCrmClient, CrmClient
from .resources.field_mapping.client import AsyncFieldMappingClient, FieldMappingClient
from .resources.metadata.client import AsyncMetadataClient, MetadataClient
from .resources.sync.client import AsyncSyncClient, SyncClient
from .resources.ticket.client import AsyncTicketClient, TicketClient


Expand All @@ -32,6 +33,7 @@ def __init__(
self.crm = CrmClient(client_wrapper=self._client_wrapper)
self.field_mapping = FieldMappingClient(client_wrapper=self._client_wrapper)
self.metadata = MetadataClient(client_wrapper=self._client_wrapper)
self.sync = SyncClient(client_wrapper=self._client_wrapper)
self.ticket = TicketClient(client_wrapper=self._client_wrapper)


Expand All @@ -53,6 +55,7 @@ def __init__(
self.crm = AsyncCrmClient(client_wrapper=self._client_wrapper)
self.field_mapping = AsyncFieldMappingClient(client_wrapper=self._client_wrapper)
self.metadata = AsyncMetadataClient(client_wrapper=self._client_wrapper)
self.sync = AsyncSyncClient(client_wrapper=self._client_wrapper)
self.ticket = AsyncTicketClient(client_wrapper=self._client_wrapper)


Expand Down
2 changes: 1 addition & 1 deletion src/revert/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "revert-api",
"X-Fern-SDK-Version": "0.0.834",
"X-Fern-SDK-Version": "0.0.852",
}
return headers

Expand Down
5 changes: 4 additions & 1 deletion src/revert/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file was auto-generated by Fern from our API Definition.

from . import chat, common, connection, crm, field_mapping, metadata, ticket
from . import chat, common, connection, crm, field_mapping, metadata, sync, ticket
from .connection import (
ConnectionImport,
ConnectionStatus,
Expand Down Expand Up @@ -28,6 +28,7 @@
MappableFieldType,
)
from .metadata import CrmMetadata, CrmMetadataResponse, CrmStatus
from .sync import TriggerSyncResponse

__all__ = [
"ConnectionImport",
Expand Down Expand Up @@ -55,11 +56,13 @@
"ImportConnectionsRequestBody",
"ImportConnectionsResponse",
"MappableFieldType",
"TriggerSyncResponse",
"chat",
"common",
"connection",
"crm",
"field_mapping",
"metadata",
"sync",
"ticket",
]
2 changes: 2 additions & 0 deletions src/revert/resources/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
LeadWrite,
Message,
NotFoundError,
NotImplementedError,
Note,
NoteRead,
NoteWrite,
Expand Down Expand Up @@ -89,6 +90,7 @@
"LeadWrite",
"Message",
"NotFoundError",
"NotImplementedError",
"Note",
"NoteRead",
"NoteWrite",
Expand Down
10 changes: 9 additions & 1 deletion src/revert/resources/common/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
TicketStatus,
Tpid,
)
from .errors import BadRequestError, BaseError, InternalServerError, NotFoundError, UnAuthorizedError
from .errors import (
BadRequestError,
BaseError,
InternalServerError,
NotFoundError,
NotImplementedError,
UnAuthorizedError,
)
from . import associations, errors, types, unified
from .associations import (
CompanyAssociation,
Expand Down Expand Up @@ -86,6 +93,7 @@
"LeadWrite",
"Message",
"NotFoundError",
"NotImplementedError",
"Note",
"NoteRead",
"NoteWrite",
Expand Down
11 changes: 9 additions & 2 deletions src/revert/resources/common/resources/errors/__init__.py
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",
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .bad_request_error import BadRequestError
from .internal_server_error import InternalServerError
from .not_found_error import NotFoundError
from .not_implemented_error import NotImplementedError
from .un_authorized_error import UnAuthorizedError

__all__ = ["BadRequestError", "InternalServerError", "NotFoundError", "UnAuthorizedError"]
__all__ = ["BadRequestError", "InternalServerError", "NotFoundError", "NotImplementedError", "UnAuthorizedError"]
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)
5 changes: 5 additions & 0 deletions src/revert/resources/sync/__init__.py
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"]
114 changes: 114 additions & 0 deletions src/revert/resources/sync/client.py
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)
5 changes: 5 additions & 0 deletions src/revert/resources/sync/types/__init__.py
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"]
29 changes: 29 additions & 0 deletions src/revert/resources/sync/types/trigger_sync_response.py
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}

0 comments on commit 0c10e5f

Please sign in to comment.