Skip to content

Commit

Permalink
Release 0.0.834
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Apr 8, 2024
1 parent 501b38a commit 57f2dd2
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 2 deletions.
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.795"
version = "0.0.834"
description = ""
readme = "README.md"
authors = []
Expand Down
6 changes: 6 additions & 0 deletions src/revert/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file was auto-generated by Fern from our API Definition.

from .resources import (
ConnectionImport,
ConnectionStatus,
CreateAccountFieldMappingRequestBody,
CreateAccountFieldMappingResponse,
Expand All @@ -22,6 +23,8 @@
GetConnectionWebhookResponse,
GetFieldMappingConfigResponse,
GetFieldMappingsResponse,
ImportConnectionsRequestBody,
ImportConnectionsResponse,
MappableFieldType,
chat,
common,
Expand All @@ -34,6 +37,7 @@
from .environment import RevertEnvironment

__all__ = [
"ConnectionImport",
"ConnectionStatus",
"CreateAccountFieldMappingRequestBody",
"CreateAccountFieldMappingResponse",
Expand All @@ -55,6 +59,8 @@
"GetConnectionWebhookResponse",
"GetFieldMappingConfigResponse",
"GetFieldMappingsResponse",
"ImportConnectionsRequestBody",
"ImportConnectionsResponse",
"MappableFieldType",
"RevertEnvironment",
"chat",
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.795",
"X-Fern-SDK-Version": "0.0.834",
}
return headers

Expand Down
6 changes: 6 additions & 0 deletions src/revert/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from . import chat, common, connection, crm, field_mapping, metadata, ticket
from .connection import (
ConnectionImport,
ConnectionStatus,
CreateConnectionWebhookRequest,
CreateConnectionWebhookResponse,
Expand All @@ -11,6 +12,8 @@
GetConnectStatusResponse,
GetConnectionResponse,
GetConnectionWebhookResponse,
ImportConnectionsRequestBody,
ImportConnectionsResponse,
)
from .field_mapping import (
CreateAccountFieldMappingRequestBody,
Expand All @@ -27,6 +30,7 @@
from .metadata import CrmMetadata, CrmMetadataResponse, CrmStatus

__all__ = [
"ConnectionImport",
"ConnectionStatus",
"CreateAccountFieldMappingRequestBody",
"CreateAccountFieldMappingResponse",
Expand All @@ -48,6 +52,8 @@
"GetConnectionWebhookResponse",
"GetFieldMappingConfigResponse",
"GetFieldMappingsResponse",
"ImportConnectionsRequestBody",
"ImportConnectionsResponse",
"MappableFieldType",
"chat",
"common",
Expand Down
6 changes: 6 additions & 0 deletions src/revert/resources/connection/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file was auto-generated by Fern from our API Definition.

from .types import (
ConnectionImport,
ConnectionStatus,
CreateConnectionWebhookRequest,
CreateConnectionWebhookResponse,
Expand All @@ -10,9 +11,12 @@
GetConnectStatusResponse,
GetConnectionResponse,
GetConnectionWebhookResponse,
ImportConnectionsRequestBody,
ImportConnectionsResponse,
)

__all__ = [
"ConnectionImport",
"ConnectionStatus",
"CreateConnectionWebhookRequest",
"CreateConnectionWebhookResponse",
Expand All @@ -22,4 +26,6 @@
"GetConnectStatusResponse",
"GetConnectionResponse",
"GetConnectionWebhookResponse",
"ImportConnectionsRequestBody",
"ImportConnectionsResponse",
]
98 changes: 98 additions & 0 deletions src/revert/resources/connection/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from .types.get_connect_status_response import GetConnectStatusResponse
from .types.get_connection_response import GetConnectionResponse
from .types.get_connection_webhook_response import GetConnectionWebhookResponse
from .types.import_connections_request_body import ImportConnectionsRequestBody
from .types.import_connections_response import ImportConnectionsResponse

try:
import pydantic.v1 as pydantic # type: ignore
Expand Down Expand Up @@ -326,6 +328,54 @@ def get_integration_status(
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def import_connections(
self,
*,
request: ImportConnectionsRequestBody,
x_revert_api_token: str,
x_api_version: typing.Optional[str] = None,
x_revert_t_id: str,
) -> ImportConnectionsResponse:
"""
Import multiple connections for a specific environment. Use this to bulk import connections as a one-time exercise.
Parameters:
- request: ImportConnectionsRequestBody.
- x_revert_api_token: str. Your official API key for accessing revert apis.
- x_api_version: typing.Optional[str]. Optional Revert API version you're using. If missing we default to the latest version of the API.
- x_revert_t_id: str. The unique customer id used when the customer linked their account.
"""
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "connection/import"),
json=jsonable_encoder(request),
headers=remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
"x-revert-api-token": x_revert_api_token,
"x-api-version": x_api_version,
"x-revert-t-id": x_revert_t_id,
}
),
timeout=None,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(ImportConnectionsResponse, _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
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 AsyncConnectionClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
Expand Down Expand Up @@ -622,3 +672,51 @@ async def get_integration_status(
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def import_connections(
self,
*,
request: ImportConnectionsRequestBody,
x_revert_api_token: str,
x_api_version: typing.Optional[str] = None,
x_revert_t_id: str,
) -> ImportConnectionsResponse:
"""
Import multiple connections for a specific environment. Use this to bulk import connections as a one-time exercise.
Parameters:
- request: ImportConnectionsRequestBody.
- x_revert_api_token: str. Your official API key for accessing revert apis.
- x_api_version: typing.Optional[str]. Optional Revert API version you're using. If missing we default to the latest version of the API.
- x_revert_t_id: str. The unique customer id used when the customer linked their account.
"""
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "connection/import"),
json=jsonable_encoder(request),
headers=remove_none_from_dict(
{
**self._client_wrapper.get_headers(),
"x-revert-api-token": x_revert_api_token,
"x-api-version": x_api_version,
"x-revert-t-id": x_revert_t_id,
}
),
timeout=None,
)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(ImportConnectionsResponse, _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
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)
6 changes: 6 additions & 0 deletions src/revert/resources/connection/types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file was auto-generated by Fern from our API Definition.

from .connection_import import ConnectionImport
from .connection_status import ConnectionStatus
from .create_connection_webhook_request import CreateConnectionWebhookRequest
from .create_connection_webhook_response import CreateConnectionWebhookResponse
Expand All @@ -9,8 +10,11 @@
from .get_connect_status_response import GetConnectStatusResponse
from .get_connection_response import GetConnectionResponse
from .get_connection_webhook_response import GetConnectionWebhookResponse
from .import_connections_request_body import ImportConnectionsRequestBody
from .import_connections_response import ImportConnectionsResponse

__all__ = [
"ConnectionImport",
"ConnectionStatus",
"CreateConnectionWebhookRequest",
"CreateConnectionWebhookResponse",
Expand All @@ -20,4 +24,6 @@
"GetConnectStatusResponse",
"GetConnectionResponse",
"GetConnectionWebhookResponse",
"ImportConnectionsRequestBody",
"ImportConnectionsResponse",
]
37 changes: 37 additions & 0 deletions src/revert/resources/connection/types/connection_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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.tpid import Tpid

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class ConnectionImport(pydantic.BaseModel):
tp_id: Tpid
tp_access_token: str
tp_refresh_token: str
tp_customer_id: str = pydantic.Field(description="The emailId or a unique ID id of the user who connected the app.")
t_id: str
tp_account_url: typing.Optional[str]
app_client_id: str
app_client_secret: str
app_id: str = pydantic.Field(description="Can be obtained from the integration dashboard.")

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}
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 .connection_import import ConnectionImport

try:
import pydantic.v1 as pydantic # type: ignore
except ImportError:
import pydantic # type: ignore


class ImportConnectionsRequestBody(pydantic.BaseModel):
connections: typing.List[ConnectionImport]

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}
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 ImportConnectionsResponse(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 57f2dd2

Please sign in to comment.