Skip to content

Commit aeb1931

Browse files
Release 0.2.0
1 parent ed55fef commit aeb1931

File tree

35 files changed

+4090
-3592
lines changed

35 files changed

+4090
-3592
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pip install --upgrade polytomic
2121
from polytomic.client import Polytomic
2222

2323
client = Polytomic(
24-
x_polytomic_version="YOUR_X_POLYTOMIC_VERSION",
2524
token="YOUR_TOKEN",
2625
)
2726
```
@@ -34,7 +33,6 @@ client = Polytomic(
3433
from polytomic.client import AsyncPolytomic
3534

3635
client = AsyncPolytomic(
37-
x_polytomic_version="YOUR_X_POLYTOMIC_VERSION",
3836
token="YOUR_TOKEN",
3937
)
4038
```

poetry.lock

Lines changed: 91 additions & 91 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 = "polytomic"
3-
version = "0.1.2"
3+
version = "0.2.0"
44
description = ""
55
readme = "README.md"
66
authors = []

src/polytomic/__init__.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
ActivateSyncEnvelope,
55
ActivateSyncInput,
66
ActivateSyncOutput,
7+
ApiError,
78
ApiKeyResponse,
89
ApiKeyResponseEnvelope,
910
BulkDiscover,
@@ -60,6 +61,7 @@
6061
GetExecutionResponseSchema,
6162
GetIdentityResponseEnvelope,
6263
GetIdentityResponseSchema,
64+
GetModelSyncSourceMetaEnvelope,
6365
Identity,
6466
IdentityFunction,
6567
JobResponse,
@@ -84,6 +86,7 @@
8486
ModelSyncField,
8587
ModelSyncResponse,
8688
ModelSyncResponseEnvelope,
89+
ModelSyncSourceMetaResponse,
8790
Organization,
8891
OrganizationEnvelope,
8992
OrganizationsEnvelope,
@@ -109,6 +112,7 @@
109112
SchemaField,
110113
SchemaRecordsResponseEnvelope,
111114
Source,
115+
SourceMeta,
112116
StartModelSyncResponseEnvelope,
113117
StartModelSyncResponseSchema,
114118
SupportedMode,
@@ -126,11 +130,19 @@
126130
WebhookListEnvelope,
127131
WorkTaskStatus,
128132
)
129-
from .errors import UnauthorizedError
133+
from .errors import (
134+
BadRequestError,
135+
ForbiddenError,
136+
InternalServerError,
137+
NotFoundError,
138+
UnauthorizedError,
139+
UnprocessableEntityError,
140+
)
130141
from .resources import (
131142
bulk_sync,
132143
connections,
133144
events,
145+
identity,
134146
jobs,
135147
model_sync,
136148
models,
@@ -147,8 +159,10 @@
147159
"ActivateSyncEnvelope",
148160
"ActivateSyncInput",
149161
"ActivateSyncOutput",
162+
"ApiError",
150163
"ApiKeyResponse",
151164
"ApiKeyResponseEnvelope",
165+
"BadRequestError",
152166
"BulkDiscover",
153167
"BulkExecutionStatus",
154168
"BulkField",
@@ -198,13 +212,16 @@
198212
"ExecutionLogsResponseEnvelope",
199213
"ExecutionStatus",
200214
"Filter",
215+
"ForbiddenError",
201216
"GetConnectionMetaEnvelope",
202217
"GetExecutionResponseEnvelope",
203218
"GetExecutionResponseSchema",
204219
"GetIdentityResponseEnvelope",
205220
"GetIdentityResponseSchema",
221+
"GetModelSyncSourceMetaEnvelope",
206222
"Identity",
207223
"IdentityFunction",
224+
"InternalServerError",
208225
"JobResponse",
209226
"JobResponseEnvelope",
210227
"JsonschemaForm",
@@ -227,6 +244,8 @@
227244
"ModelSyncField",
228245
"ModelSyncResponse",
229246
"ModelSyncResponseEnvelope",
247+
"ModelSyncSourceMetaResponse",
248+
"NotFoundError",
230249
"Organization",
231250
"OrganizationEnvelope",
232251
"OrganizationsEnvelope",
@@ -253,6 +272,7 @@
253272
"SchemaField",
254273
"SchemaRecordsResponseEnvelope",
255274
"Source",
275+
"SourceMeta",
256276
"StartModelSyncResponseEnvelope",
257277
"StartModelSyncResponseSchema",
258278
"SupportedMode",
@@ -264,6 +284,7 @@
264284
"TargetResponse",
265285
"TargetResponseEnvelope",
266286
"UnauthorizedError",
287+
"UnprocessableEntityError",
267288
"User",
268289
"UserEnvelope",
269290
"Webhook",
@@ -274,6 +295,7 @@
274295
"bulk_sync",
275296
"connections",
276297
"events",
298+
"identity",
277299
"jobs",
278300
"model_sync",
279301
"models",

src/polytomic/client.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .resources.bulk_sync.client import AsyncBulkSyncClient, BulkSyncClient
1010
from .resources.connections.client import AsyncConnectionsClient, ConnectionsClient
1111
from .resources.events.client import AsyncEventsClient, EventsClient
12+
from .resources.identity.client import AsyncIdentityClient, IdentityClient
1213
from .resources.jobs.client import AsyncJobsClient, JobsClient
1314
from .resources.model_sync.client import AsyncModelSyncClient, ModelSyncClient
1415
from .resources.models.client import AsyncModelsClient, ModelsClient
@@ -30,9 +31,7 @@ class Polytomic:
3031
3132
Defaults to PolytomicEnvironment.DEFAULT
3233
33-
- x_polytomic_version: typing.Optional[typing.Literal["2023-04-25"]].
34-
35-
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]].
34+
- token: typing.Union[str, typing.Callable[[], str]].
3635
3736
- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
3837
@@ -41,7 +40,6 @@ class Polytomic:
4140
from polytomic.client import Polytomic
4241
4342
client = Polytomic(
44-
x_polytomic_version="YOUR_X_POLYTOMIC_VERSION",
4543
token="YOUR_TOKEN",
4644
)
4745
"""
@@ -51,29 +49,28 @@ def __init__(
5149
*,
5250
base_url: typing.Optional[str] = None,
5351
environment: PolytomicEnvironment = PolytomicEnvironment.DEFAULT,
54-
x_polytomic_version: typing.Optional[typing.Literal["2023-04-25"]] = None,
55-
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
52+
token: typing.Union[str, typing.Callable[[], str]],
5653
timeout: typing.Optional[float] = None,
5754
httpx_client: typing.Optional[httpx.Client] = None
5855
):
5956
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
6057
self._client_wrapper = SyncClientWrapper(
6158
base_url=_get_base_url(base_url=base_url, environment=environment),
62-
x_polytomic_version=x_polytomic_version,
6359
token=token,
6460
httpx_client=httpx.Client(timeout=_defaulted_timeout) if httpx_client is None else httpx_client,
6561
timeout=_defaulted_timeout,
6662
)
6763
self.bulk_sync = BulkSyncClient(client_wrapper=self._client_wrapper)
6864
self.connections = ConnectionsClient(client_wrapper=self._client_wrapper)
65+
self.model_sync = ModelSyncClient(client_wrapper=self._client_wrapper)
6966
self.schemas = SchemasClient(client_wrapper=self._client_wrapper)
7067
self.events = EventsClient(client_wrapper=self._client_wrapper)
7168
self.jobs = JobsClient(client_wrapper=self._client_wrapper)
69+
self.identity = IdentityClient(client_wrapper=self._client_wrapper)
7270
self.models = ModelsClient(client_wrapper=self._client_wrapper)
7371
self.organization = OrganizationClient(client_wrapper=self._client_wrapper)
7472
self.users = UsersClient(client_wrapper=self._client_wrapper)
7573
self.permissions = PermissionsClient(client_wrapper=self._client_wrapper)
76-
self.model_sync = ModelSyncClient(client_wrapper=self._client_wrapper)
7774
self.webhooks = WebhooksClient(client_wrapper=self._client_wrapper)
7875

7976

@@ -88,9 +85,7 @@ class AsyncPolytomic:
8885
8986
Defaults to PolytomicEnvironment.DEFAULT
9087
91-
- x_polytomic_version: typing.Optional[typing.Literal["2023-04-25"]].
92-
93-
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]].
88+
- token: typing.Union[str, typing.Callable[[], str]].
9489
9590
- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
9691
@@ -99,7 +94,6 @@ class AsyncPolytomic:
9994
from polytomic.client import AsyncPolytomic
10095
10196
client = AsyncPolytomic(
102-
x_polytomic_version="YOUR_X_POLYTOMIC_VERSION",
10397
token="YOUR_TOKEN",
10498
)
10599
"""
@@ -109,29 +103,28 @@ def __init__(
109103
*,
110104
base_url: typing.Optional[str] = None,
111105
environment: PolytomicEnvironment = PolytomicEnvironment.DEFAULT,
112-
x_polytomic_version: typing.Optional[typing.Literal["2023-04-25"]] = None,
113-
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
106+
token: typing.Union[str, typing.Callable[[], str]],
114107
timeout: typing.Optional[float] = None,
115108
httpx_client: typing.Optional[httpx.AsyncClient] = None
116109
):
117110
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
118111
self._client_wrapper = AsyncClientWrapper(
119112
base_url=_get_base_url(base_url=base_url, environment=environment),
120-
x_polytomic_version=x_polytomic_version,
121113
token=token,
122114
httpx_client=httpx.AsyncClient(timeout=_defaulted_timeout) if httpx_client is None else httpx_client,
123115
timeout=_defaulted_timeout,
124116
)
125117
self.bulk_sync = AsyncBulkSyncClient(client_wrapper=self._client_wrapper)
126118
self.connections = AsyncConnectionsClient(client_wrapper=self._client_wrapper)
119+
self.model_sync = AsyncModelSyncClient(client_wrapper=self._client_wrapper)
127120
self.schemas = AsyncSchemasClient(client_wrapper=self._client_wrapper)
128121
self.events = AsyncEventsClient(client_wrapper=self._client_wrapper)
129122
self.jobs = AsyncJobsClient(client_wrapper=self._client_wrapper)
123+
self.identity = AsyncIdentityClient(client_wrapper=self._client_wrapper)
130124
self.models = AsyncModelsClient(client_wrapper=self._client_wrapper)
131125
self.organization = AsyncOrganizationClient(client_wrapper=self._client_wrapper)
132126
self.users = AsyncUsersClient(client_wrapper=self._client_wrapper)
133127
self.permissions = AsyncPermissionsClient(client_wrapper=self._client_wrapper)
134-
self.model_sync = AsyncModelSyncClient(client_wrapper=self._client_wrapper)
135128
self.webhooks = AsyncWebhooksClient(client_wrapper=self._client_wrapper)
136129

137130

src/polytomic/core/client_wrapper.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ class BaseClientWrapper:
1111
def __init__(
1212
self,
1313
*,
14-
x_polytomic_version: typing.Optional[typing.Literal["2023-04-25"]] = None,
15-
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
14+
token: typing.Union[str, typing.Callable[[], str]],
1615
base_url: str,
1716
timeout: typing.Optional[float] = None,
1817
):
19-
self._x_polytomic_version = x_polytomic_version
2018
self._token = token
2119
self._base_url = base_url
2220
self._timeout = timeout
@@ -25,17 +23,14 @@ def get_headers(self) -> typing.Dict[str, str]:
2523
headers: typing.Dict[str, str] = {
2624
"X-Fern-Language": "Python",
2725
"X-Fern-SDK-Name": "polytomic",
28-
"X-Fern-SDK-Version": "0.1.2",
26+
"X-Fern-SDK-Version": "0.2.0",
2927
}
30-
if self._x_polytomic_version is not None:
31-
headers["X-Polytomic-Version"] = self._x_polytomic_version
32-
token = self._get_token()
33-
if token is not None:
34-
headers["Authorization"] = f"Bearer {token}"
28+
headers["Authorization"] = f"Bearer {self._get_token()}"
29+
headers["X-Polytomic-Version"] = "2024-02-08"
3530
return headers
3631

37-
def _get_token(self) -> typing.Optional[str]:
38-
if isinstance(self._token, str) or self._token is None:
32+
def _get_token(self) -> str:
33+
if isinstance(self._token, str):
3934
return self._token
4035
else:
4136
return self._token()
@@ -51,25 +46,23 @@ class SyncClientWrapper(BaseClientWrapper):
5146
def __init__(
5247
self,
5348
*,
54-
x_polytomic_version: typing.Optional[typing.Literal["2023-04-25"]] = None,
55-
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
49+
token: typing.Union[str, typing.Callable[[], str]],
5650
base_url: str,
5751
timeout: typing.Optional[float] = None,
5852
httpx_client: httpx.Client,
5953
):
60-
super().__init__(x_polytomic_version=x_polytomic_version, token=token, base_url=base_url, timeout=timeout)
54+
super().__init__(token=token, base_url=base_url, timeout=timeout)
6155
self.httpx_client = HttpClient(httpx_client=httpx_client)
6256

6357

6458
class AsyncClientWrapper(BaseClientWrapper):
6559
def __init__(
6660
self,
6761
*,
68-
x_polytomic_version: typing.Optional[typing.Literal["2023-04-25"]] = None,
69-
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
62+
token: typing.Union[str, typing.Callable[[], str]],
7063
base_url: str,
7164
timeout: typing.Optional[float] = None,
7265
httpx_client: httpx.AsyncClient,
7366
):
74-
super().__init__(x_polytomic_version=x_polytomic_version, token=token, base_url=base_url, timeout=timeout)
67+
super().__init__(token=token, base_url=base_url, timeout=timeout)
7568
self.httpx_client = AsyncHttpClient(httpx_client=httpx_client)

src/polytomic/errors/__init__.py

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

3+
from .bad_request_error import BadRequestError
4+
from .forbidden_error import ForbiddenError
5+
from .internal_server_error import InternalServerError
6+
from .not_found_error import NotFoundError
37
from .unauthorized_error import UnauthorizedError
8+
from .unprocessable_entity_error import UnprocessableEntityError
49

5-
__all__ = ["UnauthorizedError"]
10+
__all__ = [
11+
"BadRequestError",
12+
"ForbiddenError",
13+
"InternalServerError",
14+
"NotFoundError",
15+
"UnauthorizedError",
16+
"UnprocessableEntityError",
17+
]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file was auto-generated from our API Definition.
2+
3+
from ..core.api_error import ApiError as core_api_error_ApiError
4+
from ..types.api_error import ApiError as types_api_error_ApiError
5+
6+
7+
class BadRequestError(core_api_error_ApiError):
8+
def __init__(self, body: types_api_error_ApiError):
9+
super().__init__(status_code=400, body=body)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file was auto-generated from our API Definition.
2+
3+
from ..core.api_error import ApiError as core_api_error_ApiError
4+
from ..types.api_error import ApiError as types_api_error_ApiError
5+
6+
7+
class ForbiddenError(core_api_error_ApiError):
8+
def __init__(self, body: types_api_error_ApiError):
9+
super().__init__(status_code=403, body=body)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file was auto-generated from our API Definition.
2+
3+
from ..core.api_error import ApiError as core_api_error_ApiError
4+
from ..types.api_error import ApiError as types_api_error_ApiError
5+
6+
7+
class InternalServerError(core_api_error_ApiError):
8+
def __init__(self, body: types_api_error_ApiError):
9+
super().__init__(status_code=500, body=body)

0 commit comments

Comments
 (0)