Skip to content

Commit 09f42bf

Browse files
committed
Add generated python sdk
1 parent 906f13a commit 09f42bf

File tree

139 files changed

+10266
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+10266
-0
lines changed

__init__.py

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from .types import (
4+
BulkSchedule,
5+
LabelLabel,
6+
RestErrResponse,
7+
SchemaAssociation,
8+
SyncDestinationProperties,
9+
V2ActivateSyncEnvelope,
10+
V2ActivateSyncInput,
11+
V2ActivateSyncOutput,
12+
V2ApiKeyResponse,
13+
V2ApiKeyResponseEnvelope,
14+
V2BulkSyncDest,
15+
V2BulkSyncDestEnvelope,
16+
V2BulkSyncListEnvelope,
17+
V2BulkSyncResponse,
18+
V2BulkSyncResponseEnvelope,
19+
V2ConfigurationValue,
20+
V2ConnectionListResponseEnvelope,
21+
V2ConnectionMeta,
22+
V2ConnectionMetaResponse,
23+
V2ConnectionResponseEnvelope,
24+
V2ConnectionResponseSchema,
25+
V2ConnectionType,
26+
V2ConnectionTypeResponseEnvelope,
27+
V2ConnectionTypeSchema,
28+
V2CreateConnectionResponseEnvelope,
29+
V2CreateConnectionResponseSchema,
30+
V2DestMeta,
31+
V2Event,
32+
V2EventTypesEnvelope,
33+
V2EventsEnvelope,
34+
V2ExecutionCounts,
35+
V2Filter,
36+
V2GetConnectionMetaEnvelope,
37+
V2GetExecutionResponseEnvelope,
38+
V2GetExecutionResponseSchema,
39+
V2GetIdentityResponseEnvelope,
40+
V2GetIdentityResponseSchema,
41+
V2Identity,
42+
V2IdentityFunction,
43+
V2ListExecutionResponseEnvelope,
44+
V2ListPoliciesResponseEnvelope,
45+
V2ListSyncResponseEnvelope,
46+
V2ListUsersEnvelope,
47+
V2Mode,
48+
V2ModelField,
49+
V2ModelFieldRequest,
50+
V2ModelFieldResponse,
51+
V2ModelListResponseEnvelope,
52+
V2ModelResponse,
53+
V2ModelResponseEnvelope,
54+
V2Organization,
55+
V2OrganizationEnvelope,
56+
V2OrganizationsEnvelope,
57+
V2Override,
58+
V2PolicyAction,
59+
V2PolicyResponse,
60+
V2PolicyResponseEnvelope,
61+
V2Relation,
62+
V2RelationTo,
63+
V2RoleListResponseEnvelope,
64+
V2RoleResponse,
65+
V2RoleResponseEnvelope,
66+
V2RunAfter,
67+
V2Schedule,
68+
V2Source,
69+
V2StartSyncResponseEnvelope,
70+
V2StartSyncResponseSchema,
71+
V2SupportedMode,
72+
V2SyncField,
73+
V2SyncResponse,
74+
V2SyncResponseEnvelope,
75+
V2SyncStatusEnvelope,
76+
V2SyncStatusResponse,
77+
V2Target,
78+
V2TargetField,
79+
V2TargetResponse,
80+
V2TargetResponseEnvelope,
81+
V2User,
82+
V2UserEnvelope,
83+
V2Webhook,
84+
V2WebhookEnvelope,
85+
V2WebhookListEnvelope,
86+
V3BulkField,
87+
V3BulkSchema,
88+
V3BulkSchemaEnvelope,
89+
V3BulkSyncExecution,
90+
V3BulkSyncExecutionEnvelope,
91+
V3BulkSyncSchemaExecution,
92+
V3BulkSyncSource,
93+
V3BulkSyncSourceEnvelope,
94+
V3BulkSyncSourceSchemaEnvelope,
95+
V3BulkSyncStatusEnvelope,
96+
V3BulkSyncStatusResponse,
97+
V3ConnectCardResponse,
98+
V3ConnectCardResponseEnvelope,
99+
V3ListBulkSchemaEnvelope,
100+
V3ListBulkSyncExecutionsEnvelope,
101+
V3PickValue,
102+
V3Schema,
103+
V3SchemaField,
104+
V3SchemaRecordsResponseEnvelope,
105+
)
106+
from .errors import UnauthorizedError
107+
from .resources import (
108+
V2CreateSyncRequestMode,
109+
V2UpdateSyncRequestMode,
110+
bulk_sync,
111+
connections,
112+
events,
113+
identity,
114+
model_sync,
115+
models,
116+
organization,
117+
permissions,
118+
schemas,
119+
users,
120+
webhooks,
121+
)
122+
from .environment import PolytomicApiEnvironment
123+
124+
__all__ = [
125+
"BulkSchedule",
126+
"LabelLabel",
127+
"PolytomicApiEnvironment",
128+
"RestErrResponse",
129+
"SchemaAssociation",
130+
"SyncDestinationProperties",
131+
"UnauthorizedError",
132+
"V2ActivateSyncEnvelope",
133+
"V2ActivateSyncInput",
134+
"V2ActivateSyncOutput",
135+
"V2ApiKeyResponse",
136+
"V2ApiKeyResponseEnvelope",
137+
"V2BulkSyncDest",
138+
"V2BulkSyncDestEnvelope",
139+
"V2BulkSyncListEnvelope",
140+
"V2BulkSyncResponse",
141+
"V2BulkSyncResponseEnvelope",
142+
"V2ConfigurationValue",
143+
"V2ConnectionListResponseEnvelope",
144+
"V2ConnectionMeta",
145+
"V2ConnectionMetaResponse",
146+
"V2ConnectionResponseEnvelope",
147+
"V2ConnectionResponseSchema",
148+
"V2ConnectionType",
149+
"V2ConnectionTypeResponseEnvelope",
150+
"V2ConnectionTypeSchema",
151+
"V2CreateConnectionResponseEnvelope",
152+
"V2CreateConnectionResponseSchema",
153+
"V2CreateSyncRequestMode",
154+
"V2DestMeta",
155+
"V2Event",
156+
"V2EventTypesEnvelope",
157+
"V2EventsEnvelope",
158+
"V2ExecutionCounts",
159+
"V2Filter",
160+
"V2GetConnectionMetaEnvelope",
161+
"V2GetExecutionResponseEnvelope",
162+
"V2GetExecutionResponseSchema",
163+
"V2GetIdentityResponseEnvelope",
164+
"V2GetIdentityResponseSchema",
165+
"V2Identity",
166+
"V2IdentityFunction",
167+
"V2ListExecutionResponseEnvelope",
168+
"V2ListPoliciesResponseEnvelope",
169+
"V2ListSyncResponseEnvelope",
170+
"V2ListUsersEnvelope",
171+
"V2Mode",
172+
"V2ModelField",
173+
"V2ModelFieldRequest",
174+
"V2ModelFieldResponse",
175+
"V2ModelListResponseEnvelope",
176+
"V2ModelResponse",
177+
"V2ModelResponseEnvelope",
178+
"V2Organization",
179+
"V2OrganizationEnvelope",
180+
"V2OrganizationsEnvelope",
181+
"V2Override",
182+
"V2PolicyAction",
183+
"V2PolicyResponse",
184+
"V2PolicyResponseEnvelope",
185+
"V2Relation",
186+
"V2RelationTo",
187+
"V2RoleListResponseEnvelope",
188+
"V2RoleResponse",
189+
"V2RoleResponseEnvelope",
190+
"V2RunAfter",
191+
"V2Schedule",
192+
"V2Source",
193+
"V2StartSyncResponseEnvelope",
194+
"V2StartSyncResponseSchema",
195+
"V2SupportedMode",
196+
"V2SyncField",
197+
"V2SyncResponse",
198+
"V2SyncResponseEnvelope",
199+
"V2SyncStatusEnvelope",
200+
"V2SyncStatusResponse",
201+
"V2Target",
202+
"V2TargetField",
203+
"V2TargetResponse",
204+
"V2TargetResponseEnvelope",
205+
"V2UpdateSyncRequestMode",
206+
"V2User",
207+
"V2UserEnvelope",
208+
"V2Webhook",
209+
"V2WebhookEnvelope",
210+
"V2WebhookListEnvelope",
211+
"V3BulkField",
212+
"V3BulkSchema",
213+
"V3BulkSchemaEnvelope",
214+
"V3BulkSyncExecution",
215+
"V3BulkSyncExecutionEnvelope",
216+
"V3BulkSyncSchemaExecution",
217+
"V3BulkSyncSource",
218+
"V3BulkSyncSourceEnvelope",
219+
"V3BulkSyncSourceSchemaEnvelope",
220+
"V3BulkSyncStatusEnvelope",
221+
"V3BulkSyncStatusResponse",
222+
"V3ConnectCardResponse",
223+
"V3ConnectCardResponseEnvelope",
224+
"V3ListBulkSchemaEnvelope",
225+
"V3ListBulkSyncExecutionsEnvelope",
226+
"V3PickValue",
227+
"V3Schema",
228+
"V3SchemaField",
229+
"V3SchemaRecordsResponseEnvelope",
230+
"bulk_sync",
231+
"connections",
232+
"events",
233+
"identity",
234+
"model_sync",
235+
"models",
236+
"organization",
237+
"permissions",
238+
"schemas",
239+
"users",
240+
"webhooks",
241+
]

client.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
import httpx
6+
7+
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8+
from .environment import PolytomicApiEnvironment
9+
from .resources.bulk_sync.client import AsyncBulkSyncClient, BulkSyncClient
10+
from .resources.connections.client import AsyncConnectionsClient, ConnectionsClient
11+
from .resources.events.client import AsyncEventsClient, EventsClient
12+
from .resources.identity.client import AsyncIdentityClient, IdentityClient
13+
from .resources.model_sync.client import AsyncModelSyncClient, ModelSyncClient
14+
from .resources.models.client import AsyncModelsClient, ModelsClient
15+
from .resources.organization.client import AsyncOrganizationClient, OrganizationClient
16+
from .resources.permissions.client import AsyncPermissionsClient, PermissionsClient
17+
from .resources.schemas.client import AsyncSchemasClient, SchemasClient
18+
from .resources.users.client import AsyncUsersClient, UsersClient
19+
from .resources.webhooks.client import AsyncWebhooksClient, WebhooksClient
20+
21+
22+
class PolytomicApi:
23+
def __init__(
24+
self,
25+
*,
26+
base_url: typing.Optional[str] = None,
27+
environment: PolytomicApiEnvironment = PolytomicApiEnvironment.DEFAULT,
28+
token: typing.Union[str, typing.Callable[[], str]],
29+
timeout: typing.Optional[float] = 60,
30+
httpx_client: typing.Optional[httpx.Client] = None
31+
):
32+
self._client_wrapper = SyncClientWrapper(
33+
base_url=_get_base_url(base_url=base_url, environment=environment),
34+
token=token,
35+
httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client,
36+
)
37+
self.bulk_sync = BulkSyncClient(client_wrapper=self._client_wrapper)
38+
self.connections = ConnectionsClient(client_wrapper=self._client_wrapper)
39+
self.schemas = SchemasClient(client_wrapper=self._client_wrapper)
40+
self.events = EventsClient(client_wrapper=self._client_wrapper)
41+
self.identity = IdentityClient(client_wrapper=self._client_wrapper)
42+
self.models = ModelsClient(client_wrapper=self._client_wrapper)
43+
self.organization = OrganizationClient(client_wrapper=self._client_wrapper)
44+
self.users = UsersClient(client_wrapper=self._client_wrapper)
45+
self.permissions = PermissionsClient(client_wrapper=self._client_wrapper)
46+
self.model_sync = ModelSyncClient(client_wrapper=self._client_wrapper)
47+
self.webhooks = WebhooksClient(client_wrapper=self._client_wrapper)
48+
49+
50+
class AsyncPolytomicApi:
51+
def __init__(
52+
self,
53+
*,
54+
base_url: typing.Optional[str] = None,
55+
environment: PolytomicApiEnvironment = PolytomicApiEnvironment.DEFAULT,
56+
token: typing.Union[str, typing.Callable[[], str]],
57+
timeout: typing.Optional[float] = 60,
58+
httpx_client: typing.Optional[httpx.AsyncClient] = None
59+
):
60+
self._client_wrapper = AsyncClientWrapper(
61+
base_url=_get_base_url(base_url=base_url, environment=environment),
62+
token=token,
63+
httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client,
64+
)
65+
self.bulk_sync = AsyncBulkSyncClient(client_wrapper=self._client_wrapper)
66+
self.connections = AsyncConnectionsClient(client_wrapper=self._client_wrapper)
67+
self.schemas = AsyncSchemasClient(client_wrapper=self._client_wrapper)
68+
self.events = AsyncEventsClient(client_wrapper=self._client_wrapper)
69+
self.identity = AsyncIdentityClient(client_wrapper=self._client_wrapper)
70+
self.models = AsyncModelsClient(client_wrapper=self._client_wrapper)
71+
self.organization = AsyncOrganizationClient(client_wrapper=self._client_wrapper)
72+
self.users = AsyncUsersClient(client_wrapper=self._client_wrapper)
73+
self.permissions = AsyncPermissionsClient(client_wrapper=self._client_wrapper)
74+
self.model_sync = AsyncModelSyncClient(client_wrapper=self._client_wrapper)
75+
self.webhooks = AsyncWebhooksClient(client_wrapper=self._client_wrapper)
76+
77+
78+
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: PolytomicApiEnvironment) -> str:
79+
if base_url is not None:
80+
return base_url
81+
elif environment is not None:
82+
return environment.value
83+
else:
84+
raise Exception("Please pass in either base_url or environment to construct the client")

core/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from .api_error import ApiError
4+
from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
5+
from .datetime_utils import serialize_datetime
6+
from .jsonable_encoder import jsonable_encoder
7+
from .remove_none_from_dict import remove_none_from_dict
8+
9+
__all__ = [
10+
"ApiError",
11+
"AsyncClientWrapper",
12+
"BaseClientWrapper",
13+
"SyncClientWrapper",
14+
"jsonable_encoder",
15+
"remove_none_from_dict",
16+
"serialize_datetime",
17+
]

core/api_error.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
6+
class ApiError(Exception):
7+
status_code: typing.Optional[int]
8+
body: typing.Any
9+
10+
def __init__(self, *, status_code: typing.Optional[int] = None, body: typing.Any = None):
11+
self.status_code = status_code
12+
self.body = body
13+
14+
def __str__(self) -> str:
15+
return f"status_code: {self.status_code}, body: {self.body}"

0 commit comments

Comments
 (0)