diff --git a/poetry.lock b/poetry.lock index a3b66c9..1584898 100644 --- a/poetry.lock +++ b/poetry.lock @@ -130,13 +130,13 @@ socks = ["socksio (==1.*)"] [[package]] name = "idna" -version = "3.7" +version = "3.8" description = "Internationalized Domain Names in Applications (IDNA)" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" files = [ - {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, - {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, + {file = "idna-3.8-py3-none-any.whl", hash = "sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac"}, + {file = "idna-3.8.tar.gz", hash = "sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603"}, ] [[package]] @@ -445,13 +445,13 @@ files = [ [[package]] name = "types-python-dateutil" -version = "2.9.0.20240316" +version = "2.9.0.20240821" description = "Typing stubs for python-dateutil" optional = false python-versions = ">=3.8" files = [ - {file = "types-python-dateutil-2.9.0.20240316.tar.gz", hash = "sha256:5d2f2e240b86905e40944dd787db6da9263f0deabef1076ddaed797351ec0202"}, - {file = "types_python_dateutil-2.9.0.20240316-py3-none-any.whl", hash = "sha256:6b8cb66d960771ce5ff974e9dd45e38facb81718cc1e208b10b1baccbfdbee3b"}, + {file = "types-python-dateutil-2.9.0.20240821.tar.gz", hash = "sha256:9649d1dcb6fef1046fb18bebe9ea2aa0028b160918518c34589a46045f6ebd98"}, + {file = "types_python_dateutil-2.9.0.20240821-py3-none-any.whl", hash = "sha256:f5889fcb4e63ed4aaa379b44f93c32593d50b9a94c9a60a0c854d8cc3511cd57"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 1f58f19..40f37b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "polytomic" -version = "1.9.0" +version = "1.9.1" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index f8a8dbe..570adfa 100644 --- a/reference.md +++ b/reference.md @@ -1,6 +1,6 @@ # Reference ## BulkSync -
client.bulk_sync.list() +
client.bulk_sync.list(...)
@@ -19,7 +19,9 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.bulk_sync.list() +client.bulk_sync.list( + active=True, +) ```
@@ -35,6 +37,14 @@ client.bulk_sync.list()
+**active:** `typing.Optional[bool]` + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -1075,6 +1085,146 @@ client.bulk_sync.executions.get(
+ +
+
+ +
client.bulk_sync.executions.get_logs(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from polytomic.client import Polytomic + +client = Polytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", +) +client.bulk_sync.executions.get_logs( + sync_id="248df4b7-aa70-47b8-a036-33ac447e668d", + execution_id="248df4b7-aa70-47b8-a036-33ac447e668d", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**sync_id:** `str` + +
+
+ +
+
+ +**execution_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.bulk_sync.executions.export_logs(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from polytomic.client import Polytomic + +client = Polytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", +) +client.bulk_sync.executions.export_logs( + sync_id="248df4b7-aa70-47b8-a036-33ac447e668d", + execution_id="248df4b7-aa70-47b8-a036-33ac447e668d", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**sync_id:** `str` + +
+
+ +
+
+ +**execution_id:** `str` + +
+
+ +
+
+ +**notify:** `typing.Optional[bool]` — Send a notification to the user when the logs are ready for download. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
@@ -2113,8 +2263,8 @@ client.query_runner.get_query(
-## ModelSync -
client.model_sync.get_source(...) +## Models +
client.models.get_enrichment_source(...)
@@ -2133,7 +2283,7 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.model_sync.get_source( +client.models.get_enrichment_source( id="248df4b7-aa70-47b8-a036-33ac447e668d", ) @@ -2179,10 +2329,24 @@ client.model_sync.get_source(
-
client.model_sync.get_source_fields(...) +
client.models.post(...) +
+
+ +#### 📝 Description +
+
+
+ +For a given connection and enrichment configuration, provides the valid sets of input fields. +
+
+
+
+ #### 🔌 Usage
@@ -2198,8 +2362,8 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.model_sync.get_source_fields( - id="248df4b7-aa70-47b8-a036-33ac447e668d", +client.models.post( + connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", ) ``` @@ -2216,7 +2380,15 @@ client.model_sync.get_source_fields(
-**id:** `str` +**connection_id:** `str` + +
+
+ +
+
+ +**configuration:** `typing.Optional[V2EnricherConfiguration]`
@@ -2236,7 +2408,7 @@ client.model_sync.get_source_fields(
-
client.model_sync.get_target(...) +
client.models.preview(...)
@@ -2255,8 +2427,10 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.model_sync.get_target( - id="248df4b7-aa70-47b8-a036-33ac447e668d", +client.models.preview( + configuration={"table": "public.users"}, + connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", + name="Users", ) ``` @@ -2273,7 +2447,7 @@ client.model_sync.get_target(
-**id:** `str` +**configuration:** `typing.Dict[str, typing.Any]`
@@ -2281,7 +2455,7 @@ client.model_sync.get_target(
-**type:** `typing.Optional[str]` +**connection_id:** `str`
@@ -2289,7 +2463,7 @@ client.model_sync.get_target(
-**search:** `typing.Optional[str]` +**name:** `str`
@@ -2297,58 +2471,63 @@ client.model_sync.get_target(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**async_:** `typing.Optional[bool]`
-
-
+
+
+**additional_fields:** `typing.Optional[typing.Sequence[ModelModelFieldRequest]]` +
-
-
client.model_sync.get_target_fields(...)
-#### 🔌 Usage +**enricher:** `typing.Optional[Enrichment]` + +
+
+**fields:** `typing.Optional[typing.Sequence[str]]` + +
+
+
-```python -from polytomic.client import Polytomic - -client = Polytomic( - version="YOUR_VERSION", - token="YOUR_TOKEN", -) -client.model_sync.get_target_fields( - id="248df4b7-aa70-47b8-a036-33ac447e668d", - target="database.table", - refresh=False, -) - -``` +**identifier:** `typing.Optional[str]` +
+ +
+
+ +**labels:** `typing.Optional[typing.Sequence[str]]` +
-#### ⚙️ Parameters -
+**organization_id:** `typing.Optional[str]` + +
+
+
-**id:** `str` +**policies:** `typing.Optional[typing.Sequence[str]]`
@@ -2356,7 +2535,7 @@ client.model_sync.get_target_fields(
-**target:** `str` +**relations:** `typing.Optional[typing.Sequence[ModelRelation]]`
@@ -2364,7 +2543,7 @@ client.model_sync.get_target_fields(
-**refresh:** `typing.Optional[bool]` +**tracking_columns:** `typing.Optional[typing.Sequence[str]]`
@@ -2384,7 +2563,7 @@ client.model_sync.get_target_fields(
-
client.model_sync.get_target_objects(...) +
client.models.list()
@@ -2403,9 +2582,7 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.model_sync.get_target_objects( - id="248df4b7-aa70-47b8-a036-33ac447e668d", -) +client.models.list() ```
@@ -2421,27 +2598,19 @@ client.model_sync.get_target_objects(
-**id:** `str` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
- -
+ +
-
client.model_sync.list() +
client.models.create(...)
@@ -2460,7 +2629,11 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.model_sync.list() +client.models.create( + configuration={"table": "public.users"}, + connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", + name="Users", +) ```
@@ -2476,68 +2649,39 @@ client.model_sync.list()
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**configuration:** `typing.Dict[str, typing.Any]`
- -
+
+
+**connection_id:** `str` +
-
-
client.model_sync.create(...)
-#### 🔌 Usage - -
-
+**name:** `str` + +
+
-```python -from polytomic import ModelSyncField, Schedule, Target -from polytomic.client import Polytomic - -client = Polytomic( - version="YOUR_VERSION", - token="YOUR_TOKEN", -) -client.model_sync.create( - fields=[ - ModelSyncField( - target="name", - ) - ], - mode="create", - name="Users Sync", - schedule=Schedule(), - target=Target( - connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", - object="Users", - ), -) - -``` -
-
+**async_:** `typing.Optional[bool]` +
-#### ⚙️ Parameters - -
-
-
-**fields:** `typing.Sequence[ModelSyncField]` — Fields to sync from source to target. +**additional_fields:** `typing.Optional[typing.Sequence[ModelModelFieldRequest]]`
@@ -2545,7 +2689,7 @@ client.model_sync.create(
-**mode:** `str` +**enricher:** `typing.Optional[Enrichment]`
@@ -2553,7 +2697,7 @@ client.model_sync.create(
-**name:** `str` +**fields:** `typing.Optional[typing.Sequence[str]]`
@@ -2561,7 +2705,7 @@ client.model_sync.create(
-**schedule:** `Schedule` +**identifier:** `typing.Optional[str]`
@@ -2569,7 +2713,7 @@ client.model_sync.create(
-**target:** `Target` +**labels:** `typing.Optional[typing.Sequence[str]]`
@@ -2577,7 +2721,7 @@ client.model_sync.create(
-**active:** `typing.Optional[bool]` +**organization_id:** `typing.Optional[str]`
@@ -2585,7 +2729,7 @@ client.model_sync.create(
-**enricher:** `typing.Optional[Enrichment]` +**policies:** `typing.Optional[typing.Sequence[str]]`
@@ -2593,7 +2737,7 @@ client.model_sync.create(
-**filter_logic:** `typing.Optional[str]` +**relations:** `typing.Optional[typing.Sequence[ModelRelation]]`
@@ -2601,7 +2745,7 @@ client.model_sync.create(
-**filters:** `typing.Optional[typing.Sequence[Filter]]` +**tracking_columns:** `typing.Optional[typing.Sequence[str]]`
@@ -2609,39 +2753,56 @@ client.model_sync.create(
-**identity:** `typing.Optional[Identity]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**organization_id:** `typing.Optional[str]` -
+
+
client.models.get(...)
-**override_fields:** `typing.Optional[typing.Sequence[ModelSyncField]]` — Values to set in the target unconditionally. - -
-
+#### 🔌 Usage
-**overrides:** `typing.Optional[typing.Sequence[Override]]` — Conditional value replacement for fields. - +
+
+ +```python +from polytomic.client import Polytomic + +client = Polytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", +) +client.models.get( + id="248df4b7-aa70-47b8-a036-33ac447e668d", +) + +``` +
+
+#### ⚙️ Parameters +
-**policies:** `typing.Optional[typing.Sequence[str]]` +
+
+ +**id:** `str`
@@ -2649,7 +2810,7 @@ client.model_sync.create(
-**sync_all_records:** `typing.Optional[bool]` +**async_:** `typing.Optional[bool]`
@@ -2669,7 +2830,7 @@ client.model_sync.create(
-
client.model_sync.get_schedule_options() +
client.models.update(...)
@@ -2688,7 +2849,13 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.model_sync.get_schedule_options() +client.models.update( + id="248df4b7-aa70-47b8-a036-33ac447e668d", + async_=False, + configuration={"table": "public.users"}, + connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", + name="Users", +) ```
@@ -2704,56 +2871,111 @@ client.model_sync.get_schedule_options()
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**id:** `str`
+ +
+
+ +**configuration:** `typing.Dict[str, typing.Any]` +
+
+
+**connection_id:** `str` +
-
-
client.model_sync.get(...)
-#### 🔌 Usage +**name:** `str` + +
+
+**async_:** `typing.Optional[bool]` + +
+
+
-```python -from polytomic.client import Polytomic +**additional_fields:** `typing.Optional[typing.Sequence[ModelModelFieldRequest]]` + +
+
-client = Polytomic( - version="YOUR_VERSION", - token="YOUR_TOKEN", -) -client.model_sync.get( - id="248df4b7-aa70-47b8-a036-33ac447e668d", -) +
+
-``` +**enricher:** `typing.Optional[Enrichment]` +
+ +
+
+ +**fields:** `typing.Optional[typing.Sequence[str]]` +
-#### ⚙️ Parameters +
+
+ +**identifier:** `typing.Optional[str]` + +
+
+**labels:** `typing.Optional[typing.Sequence[str]]` + +
+
+
-**id:** `str` +**organization_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**policies:** `typing.Optional[typing.Sequence[str]]` + +
+
+ +
+
+ +**relations:** `typing.Optional[typing.Sequence[ModelRelation]]` + +
+
+ +
+
+ +**tracking_columns:** `typing.Optional[typing.Sequence[str]]`
@@ -2773,7 +2995,7 @@ client.model_sync.get(
-
client.model_sync.update(...) +
client.models.remove(...)
@@ -2786,27 +3008,14 @@ client.model_sync.get(
```python -from polytomic import ModelSyncField, Schedule, Target from polytomic.client import Polytomic client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.model_sync.update( +client.models.remove( id="248df4b7-aa70-47b8-a036-33ac447e668d", - fields=[ - ModelSyncField( - target="name", - ) - ], - mode="create", - name="Users Sync", - schedule=Schedule(), - target=Target( - connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", - object="Users", - ), ) ``` @@ -2831,7 +3040,7 @@ client.model_sync.update(
-**fields:** `typing.Sequence[ModelSyncField]` — Fields to sync from source to target. +**async_:** `typing.Optional[bool]`
@@ -2839,55 +3048,70 @@ client.model_sync.update(
-**mode:** `str` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**name:** `str` -
+
+
client.models.sample(...)
-**schedule:** `Schedule` - -
-
+#### 📝 Description
-**target:** `Target` - -
-
-
-**active:** `typing.Optional[bool]` - +Returns sample records from the model. The first ten records that the source provides will be returned after being enriched (if applicable). Synchronous requests must complete within 10s. If either querying or enrichment exceeds 10s, please use the async option. +
+
+#### 🔌 Usage +
-**enricher:** `typing.Optional[Enrichment]` - +
+
+ +```python +from polytomic.client import Polytomic + +client = Polytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", +) +client.models.sample( + id="248df4b7-aa70-47b8-a036-33ac447e668d", +) + +``` +
+
+#### ⚙️ Parameters +
-**filter_logic:** `typing.Optional[str]` +
+
+ +**id:** `str`
@@ -2895,7 +3119,7 @@ client.model_sync.update(
-**filters:** `typing.Optional[typing.Sequence[Filter]]` +**async_:** `typing.Optional[bool]`
@@ -2903,39 +3127,57 @@ client.model_sync.update(
-**identity:** `typing.Optional[Identity]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**organization_id:** `typing.Optional[str]` -
+
+## ModelSync +
client.model_sync.get_source(...)
-**override_fields:** `typing.Optional[typing.Sequence[ModelSyncField]]` — Values to set in the target unconditionally. - -
-
+#### 🔌 Usage
-**overrides:** `typing.Optional[typing.Sequence[Override]]` — Conditional value replacement for fields. - +
+
+ +```python +from polytomic.client import Polytomic + +client = Polytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", +) +client.model_sync.get_source( + id="248df4b7-aa70-47b8-a036-33ac447e668d", +) + +``` +
+
+#### ⚙️ Parameters +
-**policies:** `typing.Optional[typing.Sequence[str]]` +
+
+ +**id:** `str`
@@ -2943,7 +3185,7 @@ client.model_sync.update(
-**sync_all_records:** `typing.Optional[bool]` +**params:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]`
@@ -2963,7 +3205,7 @@ client.model_sync.update(
-
client.model_sync.remove(...) +
client.model_sync.get_source_fields(...)
@@ -2982,7 +3224,7 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.model_sync.remove( +client.model_sync.get_source_fields( id="248df4b7-aa70-47b8-a036-33ac447e668d", ) @@ -3020,7 +3262,7 @@ client.model_sync.remove(
-
client.model_sync.activate(...) +
client.model_sync.get_target(...)
@@ -3039,9 +3281,8 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.model_sync.activate( +client.model_sync.get_target( id="248df4b7-aa70-47b8-a036-33ac447e668d", - active=True, ) ``` @@ -3066,7 +3307,15 @@ client.model_sync.activate(
-**active:** `bool` +**type:** `typing.Optional[str]` + +
+
+ +
+
+ +**search:** `typing.Optional[str]`
@@ -3086,26 +3335,10 @@ client.model_sync.activate(
-
client.model_sync.start(...) -
-
- -#### 📝 Description - -
-
- +
client.model_sync.get_target_fields(...)
-> 🚧 Force full resync -> -> Use caution when setting the `resync` parameter to `true`. This will force a full resync of the data from the source system. This can be a time-consuming operation and may impact the performance of the source system. It is recommended to only use this option when necessary. -
-
-
-
- #### 🔌 Usage
@@ -3121,8 +3354,10 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.model_sync.start( +client.model_sync.get_target_fields( id="248df4b7-aa70-47b8-a036-33ac447e668d", + target="database.table", + refresh=False, ) ``` @@ -3147,7 +3382,7 @@ client.model_sync.start(
-**identities:** `typing.Optional[typing.Sequence[str]]` +**target:** `str`
@@ -3155,7 +3390,7 @@ client.model_sync.start(
-**resync:** `typing.Optional[bool]` +**refresh:** `typing.Optional[bool]`
@@ -3175,7 +3410,7 @@ client.model_sync.start(
-
client.model_sync.get_status(...) +
client.model_sync.get_target_objects(...)
@@ -3194,7 +3429,7 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.model_sync.get_status( +client.model_sync.get_target_objects( id="248df4b7-aa70-47b8-a036-33ac447e668d", ) @@ -3232,8 +3467,7 @@ client.model_sync.get_status(
-## Schemas -
client.schemas.refresh(...) +
client.model_sync.list(...)
@@ -3252,8 +3486,9 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.schemas.refresh( - id="248df4b7-aa70-47b8-a036-33ac447e668d", +client.model_sync.list( + active=True, + target_connection_id="0b155265-c537-44c9-9359-a3ceb468a4da", ) ``` @@ -3270,7 +3505,23 @@ client.schemas.refresh(
-**id:** `str` +**active:** `typing.Optional[bool]` + +
+
+ +
+
+ +**mode:** `typing.Optional[SyncMode]` + +
+
+ +
+
+ +**target_connection_id:** `typing.Optional[str]`
@@ -3290,7 +3541,7 @@ client.schemas.refresh(
-
client.schemas.get_status(...) +
client.model_sync.create(...)
@@ -3303,14 +3554,26 @@ client.schemas.refresh(
```python +from polytomic import ModelSyncField, Schedule, Target from polytomic.client import Polytomic client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.schemas.get_status( - id="248df4b7-aa70-47b8-a036-33ac447e668d", +client.model_sync.create( + fields=[ + ModelSyncField( + target="name", + ) + ], + mode="create", + name="Users Sync", + schedule=Schedule(), + target=Target( + connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", + object="Users", + ), ) ``` @@ -3327,7 +3590,7 @@ client.schemas.get_status(
-**id:** `str` +**fields:** `typing.Sequence[ModelSyncField]` — Fields to sync from source to target.
@@ -3335,57 +3598,87 @@ client.schemas.get_status(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**mode:** `str`
+ +
+
+ +**name:** `str` +
+
+
+**schedule:** `Schedule` +
-
-
client.schemas.get(...)
-#### 🔌 Usage +**target:** `Target` + +
+
+**active:** `typing.Optional[bool]` + +
+
+
-```python -from polytomic.client import Polytomic +**enricher:** `typing.Optional[Enrichment]` + +
+
-client = Polytomic( - version="YOUR_VERSION", - token="YOUR_TOKEN", -) -client.schemas.get( - id="248df4b7-aa70-47b8-a036-33ac447e668d", - schema_id="public.users", -) +
+
-``` +**filter_logic:** `typing.Optional[str]` +
+ +
+
+ +**filters:** `typing.Optional[typing.Sequence[Filter]]` +
-#### ⚙️ Parameters +
+
+ +**identity:** `typing.Optional[Identity]` + +
+
+**organization_id:** `typing.Optional[str]` + +
+
+
-**id:** `str` +**override_fields:** `typing.Optional[typing.Sequence[ModelSyncField]]` — Values to set in the target unconditionally.
@@ -3393,7 +3686,23 @@ client.schemas.get(
-**schema_id:** `str` +**overrides:** `typing.Optional[typing.Sequence[Override]]` — Conditional value replacement for fields. + +
+
+ +
+
+ +**policies:** `typing.Optional[typing.Sequence[str]]` + +
+
+ +
+
+ +**sync_all_records:** `typing.Optional[bool]`
@@ -3413,7 +3722,7 @@ client.schemas.get(
-
client.schemas.get_records(...) +
client.model_sync.get_schedule_options()
@@ -3432,10 +3741,7 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.schemas.get_records( - id="248df4b7-aa70-47b8-a036-33ac447e668d", - schema_id="public.users", -) +client.model_sync.get_schedule_options() ```
@@ -3451,22 +3757,6 @@ client.schemas.get_records(
-**id:** `str` - -
-
- -
-
- -**schema_id:** `str` - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -3479,25 +3769,10 @@ client.schemas.get_records(
-## Models -
client.models.post(...) -
-
- -#### 📝 Description - -
-
- +
client.model_sync.get(...)
-For a given connection and enrichment configuration, provides the valid sets of input fields. -
-
-
-
- #### 🔌 Usage
@@ -3513,8 +3788,8 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.models.post( - connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", +client.model_sync.get( + id="248df4b7-aa70-47b8-a036-33ac447e668d", ) ``` @@ -3531,15 +3806,7 @@ client.models.post(
-**connection_id:** `str` - -
-
- -
-
- -**configuration:** `typing.Optional[V2EnricherConfiguration]` +**id:** `str`
@@ -3559,7 +3826,7 @@ client.models.post(
-
client.models.preview(...) +
client.model_sync.update(...)
@@ -3572,16 +3839,27 @@ client.models.post(
```python +from polytomic import ModelSyncField, Schedule, Target from polytomic.client import Polytomic client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.models.preview( - configuration={"table": "public.users"}, - connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", - name="Users", +client.model_sync.update( + id="248df4b7-aa70-47b8-a036-33ac447e668d", + fields=[ + ModelSyncField( + target="name", + ) + ], + mode="create", + name="Users Sync", + schedule=Schedule(), + target=Target( + connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", + object="Users", + ), ) ``` @@ -3598,7 +3876,23 @@ client.models.preview(
-**configuration:** `typing.Dict[str, typing.Any]` +**id:** `str` + +
+
+ +
+
+ +**fields:** `typing.Sequence[ModelSyncField]` — Fields to sync from source to target. + +
+
+ +
+
+ +**mode:** `str`
@@ -3606,7 +3900,7 @@ client.models.preview(
-**connection_id:** `str` +**name:** `str`
@@ -3614,7 +3908,7 @@ client.models.preview(
-**name:** `str` +**schedule:** `Schedule`
@@ -3622,7 +3916,7 @@ client.models.preview(
-**async_:** `typing.Optional[bool]` +**target:** `Target`
@@ -3630,7 +3924,7 @@ client.models.preview(
-**additional_fields:** `typing.Optional[typing.Sequence[ModelModelFieldRequest]]` +**active:** `typing.Optional[bool]`
@@ -3646,7 +3940,7 @@ client.models.preview(
-**fields:** `typing.Optional[typing.Sequence[str]]` +**filter_logic:** `typing.Optional[str]`
@@ -3654,7 +3948,7 @@ client.models.preview(
-**identifier:** `typing.Optional[str]` +**filters:** `typing.Optional[typing.Sequence[Filter]]`
@@ -3662,7 +3956,7 @@ client.models.preview(
-**labels:** `typing.Optional[typing.Sequence[str]]` +**identity:** `typing.Optional[Identity]`
@@ -3678,7 +3972,7 @@ client.models.preview(
-**policies:** `typing.Optional[typing.Sequence[str]]` +**override_fields:** `typing.Optional[typing.Sequence[ModelSyncField]]` — Values to set in the target unconditionally.
@@ -3686,7 +3980,7 @@ client.models.preview(
-**relations:** `typing.Optional[typing.Sequence[ModelRelation]]` +**overrides:** `typing.Optional[typing.Sequence[Override]]` — Conditional value replacement for fields.
@@ -3694,7 +3988,15 @@ client.models.preview(
-**tracking_columns:** `typing.Optional[typing.Sequence[str]]` +**policies:** `typing.Optional[typing.Sequence[str]]` + +
+
+ +
+
+ +**sync_all_records:** `typing.Optional[bool]`
@@ -3714,7 +4016,7 @@ client.models.preview(
-
client.models.list() +
client.model_sync.remove(...)
@@ -3733,7 +4035,9 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.models.list() +client.model_sync.remove( + id="248df4b7-aa70-47b8-a036-33ac447e668d", +) ```
@@ -3749,6 +4053,14 @@ client.models.list()
+**id:** `str` + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -3761,7 +4073,7 @@ client.models.list()
-
client.models.create(...) +
client.model_sync.activate(...)
@@ -3780,10 +4092,9 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.models.create( - configuration={"table": "public.users"}, - connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", - name="Users", +client.model_sync.activate( + id="248df4b7-aa70-47b8-a036-33ac447e668d", + active=True, ) ``` @@ -3800,7 +4111,7 @@ client.models.create(
-**configuration:** `typing.Dict[str, typing.Any]` +**id:** `str`
@@ -3808,7 +4119,7 @@ client.models.create(
-**connection_id:** `str` +**active:** `bool`
@@ -3816,71 +4127,72 @@ client.models.create(
-**name:** `str` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
-
-
-**async_:** `typing.Optional[bool]` -
+
+
client.model_sync.start(...)
-**additional_fields:** `typing.Optional[typing.Sequence[ModelModelFieldRequest]]` - -
-
+#### 📝 Description
-**enricher:** `typing.Optional[Enrichment]` - -
-
-
-**fields:** `typing.Optional[typing.Sequence[str]]` - +> 🚧 Force full resync +> +> Use caution when setting the `resync` parameter to `true`. This will force a full resync of the data from the source system. This can be a time-consuming operation and may impact the performance of the source system. It is recommended to only use this option when necessary. +
+
+#### 🔌 Usage +
-**identifier:** `typing.Optional[str]` - -
-
-
-**labels:** `typing.Optional[typing.Sequence[str]]` - +```python +from polytomic.client import Polytomic + +client = Polytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", +) +client.model_sync.start( + id="248df4b7-aa70-47b8-a036-33ac447e668d", +) + +``` +
+
+#### ⚙️ Parameters +
-**organization_id:** `typing.Optional[str]` - -
-
-
-**policies:** `typing.Optional[typing.Sequence[str]]` +**id:** `str`
@@ -3888,7 +4200,7 @@ client.models.create(
-**relations:** `typing.Optional[typing.Sequence[ModelRelation]]` +**identities:** `typing.Optional[typing.Sequence[str]]`
@@ -3896,7 +4208,7 @@ client.models.create(
-**tracking_columns:** `typing.Optional[typing.Sequence[str]]` +**resync:** `typing.Optional[bool]`
@@ -3916,7 +4228,7 @@ client.models.create(
-
client.models.get(...) +
client.model_sync.get_status(...)
@@ -3935,7 +4247,7 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.models.get( +client.model_sync.get_status( id="248df4b7-aa70-47b8-a036-33ac447e668d", ) @@ -3961,14 +4273,6 @@ client.models.get(
-**async_:** `typing.Optional[bool]` - -
-
- -
-
- **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -3981,7 +4285,8 @@ client.models.get(
-
client.models.update(...) +## Schemas +
client.schemas.refresh(...)
@@ -4000,12 +4305,8 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.models.update( +client.schemas.refresh( id="248df4b7-aa70-47b8-a036-33ac447e668d", - async_=False, - configuration={"table": "public.users"}, - connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", - name="Users", ) ``` @@ -4030,103 +4331,56 @@ client.models.update(
-**configuration:** `typing.Dict[str, typing.Any]` - -
-
- -
-
- -**connection_id:** `str` - -
-
- -
-
- -**name:** `str` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**async_:** `typing.Optional[bool]` -
-
-
-**additional_fields:** `typing.Optional[typing.Sequence[ModelModelFieldRequest]]` -
+
+
client.schemas.get_status(...)
-**enricher:** `typing.Optional[Enrichment]` - -
-
+#### 🔌 Usage
-**fields:** `typing.Optional[typing.Sequence[str]]` - -
-
-
-**identifier:** `typing.Optional[str]` - -
-
+```python +from polytomic.client import Polytomic -
-
+client = Polytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", +) +client.schemas.get_status( + id="248df4b7-aa70-47b8-a036-33ac447e668d", +) -**labels:** `typing.Optional[typing.Sequence[str]]` - +```
- -
-
- -**organization_id:** `typing.Optional[str]` -
-
-
- -**policies:** `typing.Optional[typing.Sequence[str]]` - -
-
+#### ⚙️ Parameters
-**relations:** `typing.Optional[typing.Sequence[ModelRelation]]` - -
-
-
-**tracking_columns:** `typing.Optional[typing.Sequence[str]]` +**id:** `str`
@@ -4146,7 +4400,7 @@ client.models.update(
-
client.models.remove(...) +
client.schemas.get(...)
@@ -4165,8 +4419,9 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.models.remove( +client.schemas.get( id="248df4b7-aa70-47b8-a036-33ac447e668d", + schema_id="public.users", ) ``` @@ -4191,7 +4446,7 @@ client.models.remove(
-**async_:** `typing.Optional[bool]` +**schema_id:** `str`
@@ -4211,24 +4466,10 @@ client.models.remove(
-
client.models.sample(...) -
-
- -#### 📝 Description - -
-
- +
client.schemas.get_records(...)
-Returns sample records from the model. The first ten records that the source provides will be returned after being enriched (if applicable). Synchronous requests must complete within 10s. If either querying or enrichment exceeds 10s, please use the async option. -
-
-
-
- #### 🔌 Usage
@@ -4244,8 +4485,9 @@ client = Polytomic( version="YOUR_VERSION", token="YOUR_TOKEN", ) -client.models.sample( +client.schemas.get_records( id="248df4b7-aa70-47b8-a036-33ac447e668d", + schema_id="public.users", ) ``` @@ -4270,7 +4512,7 @@ client.models.sample(
-**async_:** `typing.Optional[bool]` +**schema_id:** `str`
@@ -6310,7 +6552,7 @@ client.model_sync.executions.get_log_urls(
-**type:** `str` +**type:** `V2ExecutionLogType`
@@ -6351,7 +6593,7 @@ client = Polytomic( ) client.model_sync.executions.get_logs( sync_id="248df4b7-aa70-47b8-a036-33ac447e668d", - id="248df4b7-aa70-47b8-a036-33ac447e668d", + id="0ecd09c1-b901-4d27-9053-f0367c427254", type="records", filename="path/to/file.json", ) @@ -6386,7 +6628,7 @@ client.model_sync.executions.get_logs(
-**type:** `str` +**type:** `V2ExecutionLogType`
diff --git a/src/polytomic/__init__.py b/src/polytomic/__init__.py index f59225f..3513328 100644 --- a/src/polytomic/__init__.py +++ b/src/polytomic/__init__.py @@ -151,13 +151,20 @@ TargetObject, TargetResponse, TargetResponseEnvelope, + TypesType, User, UserEnvelope, + UtilFieldType, V2EnricherConfiguration, V2EnricherMapping, + V2ExecutionLogType, V2GetEnrichmentInputFieldsResponseEnvelope, V2SampleRecord, V2SchemaConfigurationFieldsItem, + V4BulkSyncExecutionLogs, + V4BulkSyncExecutionLogsEnvelope, + V4ExportSyncLogsEnvelope, + V4ExportSyncLogsResponse, V4QueryResultsEnvelope, V4RunQueryEnvelope, V4RunQueryResult, @@ -350,17 +357,24 @@ "TargetObject", "TargetResponse", "TargetResponseEnvelope", + "TypesType", "UnauthorizedError", "UnprocessableEntityError", "User", "UserEnvelope", + "UtilFieldType", "V2CreateBulkSyncRequestSchemasItem", "V2EnricherConfiguration", "V2EnricherMapping", + "V2ExecutionLogType", "V2GetEnrichmentInputFieldsResponseEnvelope", "V2SampleRecord", "V2SchemaConfigurationFieldsItem", "V2UpdateBulkSyncRequestSchemasItem", + "V4BulkSyncExecutionLogs", + "V4BulkSyncExecutionLogsEnvelope", + "V4ExportSyncLogsEnvelope", + "V4ExportSyncLogsResponse", "V4QueryResultsEnvelope", "V4RunQueryEnvelope", "V4RunQueryResult", diff --git a/src/polytomic/bulk_sync/client.py b/src/polytomic/bulk_sync/client.py index 08c2ca9..9e23406 100644 --- a/src/polytomic/bulk_sync/client.py +++ b/src/polytomic/bulk_sync/client.py @@ -41,10 +41,14 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): self.executions = ExecutionsClient(client_wrapper=self._client_wrapper) self.schemas = SchemasClient(client_wrapper=self._client_wrapper) - def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> BulkSyncListEnvelope: + def list( + self, *, active: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> BulkSyncListEnvelope: """ Parameters ---------- + active : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -61,10 +65,12 @@ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> Bu version="YOUR_VERSION", token="YOUR_TOKEN", ) - client.bulk_sync.list() + client.bulk_sync.list( + active=True, + ) """ _response = self._client_wrapper.httpx_client.request( - "api/bulk/syncs", method="GET", request_options=request_options + "api/bulk/syncs", method="GET", params={"active": active}, request_options=request_options ) try: if 200 <= _response.status_code < 300: @@ -756,10 +762,14 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): self.executions = AsyncExecutionsClient(client_wrapper=self._client_wrapper) self.schemas = AsyncSchemasClient(client_wrapper=self._client_wrapper) - async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> BulkSyncListEnvelope: + async def list( + self, *, active: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> BulkSyncListEnvelope: """ Parameters ---------- + active : typing.Optional[bool] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -781,13 +791,15 @@ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) async def main() -> None: - await client.bulk_sync.list() + await client.bulk_sync.list( + active=True, + ) asyncio.run(main()) """ _response = await self._client_wrapper.httpx_client.request( - "api/bulk/syncs", method="GET", request_options=request_options + "api/bulk/syncs", method="GET", params={"active": active}, request_options=request_options ) try: if 200 <= _response.status_code < 300: diff --git a/src/polytomic/bulk_sync/executions/client.py b/src/polytomic/bulk_sync/executions/client.py index 4061deb..1de79be 100644 --- a/src/polytomic/bulk_sync/executions/client.py +++ b/src/polytomic/bulk_sync/executions/client.py @@ -8,6 +8,8 @@ from ...core.jsonable_encoder import jsonable_encoder from ...core.pydantic_utilities import pydantic_v1 from ...core.request_options import RequestOptions +from ...errors.bad_request_error import BadRequestError +from ...errors.internal_server_error import InternalServerError from ...errors.not_found_error import NotFoundError from ...errors.unauthorized_error import UnauthorizedError from ...types.api_error import ApiError as types_api_error_ApiError @@ -15,6 +17,8 @@ from ...types.list_bulk_sync_execution_status_envelope import ListBulkSyncExecutionStatusEnvelope from ...types.list_bulk_sync_executions_envelope import ListBulkSyncExecutionsEnvelope from ...types.rest_err_response import RestErrResponse +from ...types.v_4_bulk_sync_execution_logs_envelope import V4BulkSyncExecutionLogsEnvelope +from ...types.v_4_export_sync_logs_envelope import V4ExportSyncLogsEnvelope class ExecutionsClient: @@ -177,6 +181,123 @@ def get( raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text) raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) + def get_logs( + self, sync_id: str, execution_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> V4BulkSyncExecutionLogsEnvelope: + """ + Parameters + ---------- + sync_id : str + + execution_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + V4BulkSyncExecutionLogsEnvelope + OK + + Examples + -------- + from polytomic.client import Polytomic + + client = Polytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", + ) + client.bulk_sync.executions.get_logs( + sync_id="248df4b7-aa70-47b8-a036-33ac447e668d", + execution_id="248df4b7-aa70-47b8-a036-33ac447e668d", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"api/bulk/syncs/{jsonable_encoder(sync_id)}/executions/{jsonable_encoder(execution_id)}/logs", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(V4BulkSyncExecutionLogsEnvelope, _response.json()) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(RestErrResponse, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text) + raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) + + def export_logs( + self, + sync_id: str, + execution_id: str, + *, + notify: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> V4ExportSyncLogsEnvelope: + """ + Parameters + ---------- + sync_id : str + + execution_id : str + + notify : typing.Optional[bool] + Send a notification to the user when the logs are ready for download. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + V4ExportSyncLogsEnvelope + OK + + Examples + -------- + from polytomic.client import Polytomic + + client = Polytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", + ) + client.bulk_sync.executions.export_logs( + sync_id="248df4b7-aa70-47b8-a036-33ac447e668d", + execution_id="248df4b7-aa70-47b8-a036-33ac447e668d", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"api/bulk/syncs/{jsonable_encoder(sync_id)}/executions/{jsonable_encoder(execution_id)}/logs/export", + method="POST", + params={"notify": notify}, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(V4ExportSyncLogsEnvelope, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(RestErrResponse, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + if _response.status_code == 500: + raise InternalServerError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text) + raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) + class AsyncExecutionsClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -361,3 +482,136 @@ async def main() -> None: except JSONDecodeError: raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text) raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) + + async def get_logs( + self, sync_id: str, execution_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> V4BulkSyncExecutionLogsEnvelope: + """ + Parameters + ---------- + sync_id : str + + execution_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + V4BulkSyncExecutionLogsEnvelope + OK + + Examples + -------- + import asyncio + + from polytomic.client import AsyncPolytomic + + client = AsyncPolytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.bulk_sync.executions.get_logs( + sync_id="248df4b7-aa70-47b8-a036-33ac447e668d", + execution_id="248df4b7-aa70-47b8-a036-33ac447e668d", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/bulk/syncs/{jsonable_encoder(sync_id)}/executions/{jsonable_encoder(execution_id)}/logs", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(V4BulkSyncExecutionLogsEnvelope, _response.json()) # type: ignore + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(RestErrResponse, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text) + raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) + + async def export_logs( + self, + sync_id: str, + execution_id: str, + *, + notify: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> V4ExportSyncLogsEnvelope: + """ + Parameters + ---------- + sync_id : str + + execution_id : str + + notify : typing.Optional[bool] + Send a notification to the user when the logs are ready for download. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + V4ExportSyncLogsEnvelope + OK + + Examples + -------- + import asyncio + + from polytomic.client import AsyncPolytomic + + client = AsyncPolytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.bulk_sync.executions.export_logs( + sync_id="248df4b7-aa70-47b8-a036-33ac447e668d", + execution_id="248df4b7-aa70-47b8-a036-33ac447e668d", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/bulk/syncs/{jsonable_encoder(sync_id)}/executions/{jsonable_encoder(execution_id)}/logs/export", + method="POST", + params={"notify": notify}, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(V4ExportSyncLogsEnvelope, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(RestErrResponse, _response.json())) # type: ignore + if _response.status_code == 404: + raise NotFoundError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + if _response.status_code == 500: + raise InternalServerError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text) + raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/polytomic/client.py b/src/polytomic/client.py index ccf09e4..40268d4 100644 --- a/src/polytomic/client.py +++ b/src/polytomic/client.py @@ -86,9 +86,9 @@ def __init__( self.bulk_sync = BulkSyncClient(client_wrapper=self._client_wrapper) self.connections = ConnectionsClient(client_wrapper=self._client_wrapper) self.query_runner = QueryRunnerClient(client_wrapper=self._client_wrapper) + self.models = ModelsClient(client_wrapper=self._client_wrapper) self.model_sync = ModelSyncClient(client_wrapper=self._client_wrapper) self.schemas = SchemasClient(client_wrapper=self._client_wrapper) - self.models = ModelsClient(client_wrapper=self._client_wrapper) self.events = EventsClient(client_wrapper=self._client_wrapper) self.jobs = JobsClient(client_wrapper=self._client_wrapper) self.identity = IdentityClient(client_wrapper=self._client_wrapper) @@ -163,9 +163,9 @@ def __init__( self.bulk_sync = AsyncBulkSyncClient(client_wrapper=self._client_wrapper) self.connections = AsyncConnectionsClient(client_wrapper=self._client_wrapper) self.query_runner = AsyncQueryRunnerClient(client_wrapper=self._client_wrapper) + self.models = AsyncModelsClient(client_wrapper=self._client_wrapper) self.model_sync = AsyncModelSyncClient(client_wrapper=self._client_wrapper) self.schemas = AsyncSchemasClient(client_wrapper=self._client_wrapper) - self.models = AsyncModelsClient(client_wrapper=self._client_wrapper) self.events = AsyncEventsClient(client_wrapper=self._client_wrapper) self.jobs = AsyncJobsClient(client_wrapper=self._client_wrapper) self.identity = AsyncIdentityClient(client_wrapper=self._client_wrapper) diff --git a/src/polytomic/core/client_wrapper.py b/src/polytomic/core/client_wrapper.py index 24358dc..32ec338 100644 --- a/src/polytomic/core/client_wrapper.py +++ b/src/polytomic/core/client_wrapper.py @@ -25,7 +25,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "polytomic", - "X-Fern-SDK-Version": "1.9.0", + "X-Fern-SDK-Version": "1.9.1", } if self._version is not None: headers["X-Polytomic-Version"] = self._version diff --git a/src/polytomic/model_sync/client.py b/src/polytomic/model_sync/client.py index c66c1a4..b549435 100644 --- a/src/polytomic/model_sync/client.py +++ b/src/polytomic/model_sync/client.py @@ -30,6 +30,7 @@ from ..types.schedule import Schedule from ..types.schedule_option_response_envelope import ScheduleOptionResponseEnvelope from ..types.start_model_sync_response_envelope import StartModelSyncResponseEnvelope +from ..types.sync_mode import SyncMode from ..types.sync_status_envelope import SyncStatusEnvelope from ..types.target import Target from ..types.target_response_envelope import TargetResponseEnvelope @@ -365,10 +366,23 @@ def get_target_objects( raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text) raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) - def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListModelSyncResponseEnvelope: + def list( + self, + *, + active: typing.Optional[bool] = None, + mode: typing.Optional[SyncMode] = None, + target_connection_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListModelSyncResponseEnvelope: """ Parameters ---------- + active : typing.Optional[bool] + + mode : typing.Optional[SyncMode] + + target_connection_id : typing.Optional[str] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -385,14 +399,24 @@ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> Li version="YOUR_VERSION", token="YOUR_TOKEN", ) - client.model_sync.list() + client.model_sync.list( + active=True, + target_connection_id="0b155265-c537-44c9-9359-a3ceb468a4da", + ) """ _response = self._client_wrapper.httpx_client.request( - "api/syncs", method="GET", request_options=request_options + "api/syncs", + method="GET", + params={"active": active, "mode": mode, "target_connection_id": target_connection_id}, + request_options=request_options, ) try: if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(ListModelSyncResponseEnvelope, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) if _response.status_code == 401: raise UnauthorizedError(pydantic_v1.parse_obj_as(RestErrResponse, _response.json())) # type: ignore if _response.status_code == 404: @@ -1375,10 +1399,23 @@ async def main() -> None: raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text) raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) - async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListModelSyncResponseEnvelope: + async def list( + self, + *, + active: typing.Optional[bool] = None, + mode: typing.Optional[SyncMode] = None, + target_connection_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListModelSyncResponseEnvelope: """ Parameters ---------- + active : typing.Optional[bool] + + mode : typing.Optional[SyncMode] + + target_connection_id : typing.Optional[str] + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1400,17 +1437,27 @@ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) async def main() -> None: - await client.model_sync.list() + await client.model_sync.list( + active=True, + target_connection_id="0b155265-c537-44c9-9359-a3ceb468a4da", + ) asyncio.run(main()) """ _response = await self._client_wrapper.httpx_client.request( - "api/syncs", method="GET", request_options=request_options + "api/syncs", + method="GET", + params={"active": active, "mode": mode, "target_connection_id": target_connection_id}, + request_options=request_options, ) try: if 200 <= _response.status_code < 300: return pydantic_v1.parse_obj_as(ListModelSyncResponseEnvelope, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) if _response.status_code == 401: raise UnauthorizedError(pydantic_v1.parse_obj_as(RestErrResponse, _response.json())) # type: ignore if _response.status_code == 404: diff --git a/src/polytomic/model_sync/executions/client.py b/src/polytomic/model_sync/executions/client.py index 2403d18..33bc6ea 100644 --- a/src/polytomic/model_sync/executions/client.py +++ b/src/polytomic/model_sync/executions/client.py @@ -17,6 +17,7 @@ from ...types.get_execution_response_envelope import GetExecutionResponseEnvelope from ...types.list_execution_response_envelope import ListExecutionResponseEnvelope from ...types.rest_err_response import RestErrResponse +from ...types.v_2_execution_log_type import V2ExecutionLogType class ExecutionsClient: @@ -123,7 +124,12 @@ def get( raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) def get_log_urls( - self, sync_id: str, id: str, type: str, *, request_options: typing.Optional[RequestOptions] = None + self, + sync_id: str, + id: str, + type: V2ExecutionLogType, + *, + request_options: typing.Optional[RequestOptions] = None, ) -> ExecutionLogsResponseEnvelope: """ Parameters @@ -132,7 +138,7 @@ def get_log_urls( id : str - type : str + type : V2ExecutionLogType request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -187,7 +193,7 @@ def get_logs( self, sync_id: str, id: str, - type: str, + type: V2ExecutionLogType, filename: str, *, request_options: typing.Optional[RequestOptions] = None, @@ -199,7 +205,7 @@ def get_logs( id : str - type : str + type : V2ExecutionLogType filename : str @@ -220,7 +226,7 @@ def get_logs( ) client.model_sync.executions.get_logs( sync_id="248df4b7-aa70-47b8-a036-33ac447e668d", - id="248df4b7-aa70-47b8-a036-33ac447e668d", + id="0ecd09c1-b901-4d27-9053-f0367c427254", type="records", filename="path/to/file.json", ) @@ -373,7 +379,12 @@ async def main() -> None: raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) async def get_log_urls( - self, sync_id: str, id: str, type: str, *, request_options: typing.Optional[RequestOptions] = None + self, + sync_id: str, + id: str, + type: V2ExecutionLogType, + *, + request_options: typing.Optional[RequestOptions] = None, ) -> ExecutionLogsResponseEnvelope: """ Parameters @@ -382,7 +393,7 @@ async def get_log_urls( id : str - type : str + type : V2ExecutionLogType request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -445,7 +456,7 @@ async def get_logs( self, sync_id: str, id: str, - type: str, + type: V2ExecutionLogType, filename: str, *, request_options: typing.Optional[RequestOptions] = None, @@ -457,7 +468,7 @@ async def get_logs( id : str - type : str + type : V2ExecutionLogType filename : str @@ -483,7 +494,7 @@ async def get_logs( async def main() -> None: await client.model_sync.executions.get_logs( sync_id="248df4b7-aa70-47b8-a036-33ac447e668d", - id="248df4b7-aa70-47b8-a036-33ac447e668d", + id="0ecd09c1-b901-4d27-9053-f0367c427254", type="records", filename="path/to/file.json", ) diff --git a/src/polytomic/models/client.py b/src/polytomic/models/client.py index 3851a31..704a0eb 100644 --- a/src/polytomic/models/client.py +++ b/src/polytomic/models/client.py @@ -15,6 +15,7 @@ from ..errors.unauthorized_error import UnauthorizedError from ..types.api_error import ApiError as types_api_error_ApiError from ..types.enrichment import Enrichment +from ..types.get_model_sync_source_meta_envelope import GetModelSyncSourceMetaEnvelope from ..types.model_list_response_envelope import ModelListResponseEnvelope from ..types.model_model_field_request import ModelModelFieldRequest from ..types.model_relation import ModelRelation @@ -32,6 +33,72 @@ class ModelsClient: def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper + def get_enrichment_source( + self, + id: str, + *, + params: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetModelSyncSourceMetaEnvelope: + """ + Parameters + ---------- + id : str + + params : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetModelSyncSourceMetaEnvelope + OK + + Examples + -------- + from polytomic.client import Polytomic + + client = Polytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", + ) + client.models.get_enrichment_source( + id="248df4b7-aa70-47b8-a036-33ac447e668d", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"api/connections/{jsonable_encoder(id)}/modelsync/enrichment-source", + method="GET", + params={"params": jsonable_encoder(params)}, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(GetModelSyncSourceMetaEnvelope, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(RestErrResponse, _response.json())) # type: ignore + if _response.status_code == 403: + raise ForbiddenError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + if _response.status_code == 404: + raise NotFoundError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + if _response.status_code == 500: + raise InternalServerError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text) + raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) + def post( self, connection_id: str, @@ -653,6 +720,80 @@ class AsyncModelsClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper + async def get_enrichment_source( + self, + id: str, + *, + params: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetModelSyncSourceMetaEnvelope: + """ + Parameters + ---------- + id : str + + params : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetModelSyncSourceMetaEnvelope + OK + + Examples + -------- + import asyncio + + from polytomic.client import AsyncPolytomic + + client = AsyncPolytomic( + version="YOUR_VERSION", + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.models.get_enrichment_source( + id="248df4b7-aa70-47b8-a036-33ac447e668d", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/connections/{jsonable_encoder(id)}/modelsync/enrichment-source", + method="GET", + params={"params": jsonable_encoder(params)}, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return pydantic_v1.parse_obj_as(GetModelSyncSourceMetaEnvelope, _response.json()) # type: ignore + if _response.status_code == 400: + raise BadRequestError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + if _response.status_code == 401: + raise UnauthorizedError(pydantic_v1.parse_obj_as(RestErrResponse, _response.json())) # type: ignore + if _response.status_code == 403: + raise ForbiddenError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + if _response.status_code == 404: + raise NotFoundError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + if _response.status_code == 500: + raise InternalServerError( + pydantic_v1.parse_obj_as(types_api_error_ApiError, _response.json()) # type: ignore + ) + _response_json = _response.json() + except JSONDecodeError: + raise core_api_error_ApiError(status_code=_response.status_code, body=_response.text) + raise core_api_error_ApiError(status_code=_response.status_code, body=_response_json) + async def post( self, connection_id: str, diff --git a/src/polytomic/types/__init__.py b/src/polytomic/types/__init__.py index bd02171..d5f8745 100644 --- a/src/polytomic/types/__init__.py +++ b/src/polytomic/types/__init__.py @@ -1,5 +1,6 @@ # This file was auto-generated by Fern from our API Definition. +from .types_type import TypesType from .activate_sync_envelope import ActivateSyncEnvelope from .activate_sync_input import ActivateSyncInput from .activate_sync_output import ActivateSyncOutput @@ -152,11 +153,17 @@ from .target_response_envelope import TargetResponseEnvelope from .user import User from .user_envelope import UserEnvelope +from .util_field_type import UtilFieldType from .v_2_enricher_configuration import V2EnricherConfiguration from .v_2_enricher_mapping import V2EnricherMapping +from .v_2_execution_log_type import V2ExecutionLogType from .v_2_get_enrichment_input_fields_response_envelope import V2GetEnrichmentInputFieldsResponseEnvelope from .v_2_sample_record import V2SampleRecord from .v_2_schema_configuration_fields_item import V2SchemaConfigurationFieldsItem +from .v_4_bulk_sync_execution_logs import V4BulkSyncExecutionLogs +from .v_4_bulk_sync_execution_logs_envelope import V4BulkSyncExecutionLogsEnvelope +from .v_4_export_sync_logs_envelope import V4ExportSyncLogsEnvelope +from .v_4_export_sync_logs_response import V4ExportSyncLogsResponse from .v_4_query_results_envelope import V4QueryResultsEnvelope from .v_4_run_query_envelope import V4RunQueryEnvelope from .v_4_run_query_result import V4RunQueryResult @@ -317,13 +324,20 @@ "TargetObject", "TargetResponse", "TargetResponseEnvelope", + "TypesType", "User", "UserEnvelope", + "UtilFieldType", "V2EnricherConfiguration", "V2EnricherMapping", + "V2ExecutionLogType", "V2GetEnrichmentInputFieldsResponseEnvelope", "V2SampleRecord", "V2SchemaConfigurationFieldsItem", + "V4BulkSyncExecutionLogs", + "V4BulkSyncExecutionLogsEnvelope", + "V4ExportSyncLogsEnvelope", + "V4ExportSyncLogsResponse", "V4QueryResultsEnvelope", "V4RunQueryEnvelope", "V4RunQueryResult", diff --git a/src/polytomic/types/bulk_sync_schema_execution.py b/src/polytomic/types/bulk_sync_schema_execution.py index 7e74901..5d5791d 100644 --- a/src/polytomic/types/bulk_sync_schema_execution.py +++ b/src/polytomic/types/bulk_sync_schema_execution.py @@ -16,6 +16,7 @@ class BulkSyncSchemaExecution(pydantic_v1.BaseModel): started_at: typing.Optional[dt.datetime] = None status: typing.Optional[BulkSchemaExecutionStatus] = None status_message: typing.Optional[str] = None + warning_count: typing.Optional[int] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/polytomic/types/bulk_sync_schema_execution_status.py b/src/polytomic/types/bulk_sync_schema_execution_status.py index 872a526..cbee136 100644 --- a/src/polytomic/types/bulk_sync_schema_execution_status.py +++ b/src/polytomic/types/bulk_sync_schema_execution_status.py @@ -21,6 +21,7 @@ class BulkSyncSchemaExecutionStatus(pydantic_v1.BaseModel): started_at: typing.Optional[dt.datetime] = None status: typing.Optional[BulkSchemaExecutionStatus] = None status_message: typing.Optional[str] = None + warning_count: typing.Optional[int] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/polytomic/types/schema_field.py b/src/polytomic/types/schema_field.py index 909e2a8..48cd9c9 100644 --- a/src/polytomic/types/schema_field.py +++ b/src/polytomic/types/schema_field.py @@ -7,14 +7,21 @@ from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 from .pick_value import PickValue from .schema_association import SchemaAssociation +from .types_type import TypesType +from .util_field_type import UtilFieldType class SchemaField(pydantic_v1.BaseModel): association: typing.Optional[SchemaAssociation] = None id: typing.Optional[str] = None name: typing.Optional[str] = None - remote_type: typing.Optional[str] = None - type: typing.Optional[str] = None + remote_type: typing.Optional[str] = pydantic_v1.Field(default=None) + """ + The type of the field from the remote system. + """ + + type: typing.Optional[UtilFieldType] = None + type_spec: typing.Optional[TypesType] = None values: typing.Optional[typing.List[PickValue]] = None def json(self, **kwargs: typing.Any) -> str: diff --git a/src/polytomic/types/types_type.py b/src/polytomic/types/types_type.py new file mode 100644 index 0000000..cbdeef0 --- /dev/null +++ b/src/polytomic/types/types_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated from our API Definition. + +import typing + +TypesType = typing.Any diff --git a/src/polytomic/types/util_field_type.py b/src/polytomic/types/util_field_type.py new file mode 100644 index 0000000..e70ab9b --- /dev/null +++ b/src/polytomic/types/util_field_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated from our API Definition. + +import typing + +UtilFieldType = typing.Union[ + typing.Literal["unknown", "string", "number", "boolean", "datetime", "array", "object"], typing.Any +] diff --git a/src/polytomic/types/v_2_execution_log_type.py b/src/polytomic/types/v_2_execution_log_type.py new file mode 100644 index 0000000..48216e1 --- /dev/null +++ b/src/polytomic/types/v_2_execution_log_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated from our API Definition. + +import typing + +V2ExecutionLogType = typing.Union[ + typing.Literal["records", "errors", "warnings", "inserts", "updates", "deletes"], typing.Any +] diff --git a/src/polytomic/types/v_4_bulk_sync_execution_logs.py b/src/polytomic/types/v_4_bulk_sync_execution_logs.py new file mode 100644 index 0000000..8b85565 --- /dev/null +++ b/src/polytomic/types/v_4_bulk_sync_execution_logs.py @@ -0,0 +1,5 @@ +# This file was auto-generated from our API Definition. + +import typing + +V4BulkSyncExecutionLogs = typing.Dict[str, typing.Any] diff --git a/src/polytomic/types/v_4_bulk_sync_execution_logs_envelope.py b/src/polytomic/types/v_4_bulk_sync_execution_logs_envelope.py new file mode 100644 index 0000000..de794fa --- /dev/null +++ b/src/polytomic/types/v_4_bulk_sync_execution_logs_envelope.py @@ -0,0 +1,30 @@ +# This file was auto-generated from our API Definition. + +import datetime as dt +import typing + +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .v_4_bulk_sync_execution_logs import V4BulkSyncExecutionLogs + + +class V4BulkSyncExecutionLogsEnvelope(pydantic_v1.BaseModel): + data: typing.Optional[V4BulkSyncExecutionLogs] = None + + 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_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/polytomic/types/v_4_export_sync_logs_envelope.py b/src/polytomic/types/v_4_export_sync_logs_envelope.py new file mode 100644 index 0000000..d810fb9 --- /dev/null +++ b/src/polytomic/types/v_4_export_sync_logs_envelope.py @@ -0,0 +1,32 @@ +# This file was auto-generated from our API Definition. + +import datetime as dt +import typing + +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 +from .job_response import JobResponse +from .v_4_export_sync_logs_response import V4ExportSyncLogsResponse + + +class V4ExportSyncLogsEnvelope(pydantic_v1.BaseModel): + data: typing.Optional[V4ExportSyncLogsResponse] = None + job: typing.Optional[JobResponse] = None + + 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_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/polytomic/types/v_4_export_sync_logs_response.py b/src/polytomic/types/v_4_export_sync_logs_response.py new file mode 100644 index 0000000..ffa6b41 --- /dev/null +++ b/src/polytomic/types/v_4_export_sync_logs_response.py @@ -0,0 +1,29 @@ +# This file was auto-generated from our API Definition. + +import datetime as dt +import typing + +from ..core.datetime_utils import serialize_datetime +from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1 + + +class V4ExportSyncLogsResponse(pydantic_v1.BaseModel): + url: typing.Optional[str] = None + + 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_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + class Config: + frozen = True + smart_union = True + extra = pydantic_v1.Extra.allow + json_encoders = {dt.datetime: serialize_datetime}