diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..4d75d59 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# This allows generated code to be indexed correctly +*.py linguist-generated=false \ No newline at end of file diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock new file mode 100755 index 0000000..b7c8bac --- /dev/null +++ b/.speakeasy/gen.lock @@ -0,0 +1,151 @@ +lockVersion: 2.0.0 +id: 4221a8f6-76c6-4af1-9607-e31f7d7c264a +management: + docChecksum: a08d8b55b00bfb4ba4828a322fd16614 + docVersion: 0.1.0 + speakeasyVersion: 1.296.1 + generationVersion: 2.338.1 + releaseVersion: 0.22.0 + configChecksum: 5084fe258dff39a930b76574b13b3a38 + repoURL: https://github.com/fabra-io/python-sdk.git + repoSubDirectory: . + installationURL: https://github.com/fabra-io/python-sdk.git + published: true +features: + python: + additionalDependencies: 0.1.0 + core: 4.6.8 + globalSecurity: 2.83.5 + globalSecurityCallbacks: 0.1.0 + globalSecurityFlattening: 0.1.0 + globalServerURLs: 2.82.2 + responseFormat: 0.1.0 + sdkHooks: 0.1.0 +generatedFiles: + - src/fabra/sdkconfiguration.py + - src/fabra/connection.py + - src/fabra/customer_data.py + - src/fabra/destination.py + - src/fabra/link_token.py + - src/fabra/object.py + - src/fabra/source.py + - src/fabra/sync.py + - src/fabra/sdk.py + - py.typed + - pylintrc + - setup.py + - src/fabra/__init__.py + - src/fabra/utils/__init__.py + - src/fabra/utils/retries.py + - src/fabra/utils/utils.py + - src/fabra/models/errors/sdkerror.py + - src/fabra/models/operations/get_namespaces.py + - src/fabra/models/operations/get_schema.py + - src/fabra/models/operations/get_tables.py + - src/fabra/models/operations/query_object.py + - src/fabra/models/operations/create_destination.py + - src/fabra/models/operations/get_destinations.py + - src/fabra/models/operations/create_link_token.py + - src/fabra/models/operations/create_object.py + - src/fabra/models/operations/get_objects.py + - src/fabra/models/operations/create_source.py + - src/fabra/models/operations/get_sources.py + - src/fabra/models/operations/create_sync.py + - src/fabra/models/operations/get_syncs.py + - src/fabra/models/components/namespaces.py + - src/fabra/models/components/httpmetadata.py + - src/fabra/models/components/field.py + - src/fabra/models/components/fieldtype.py + - src/fabra/models/components/queryfilter.py + - src/fabra/models/components/destination.py + - src/fabra/models/components/connection.py + - src/fabra/models/components/connectiontype.py + - src/fabra/models/components/destinationinput.py + - src/fabra/models/components/snowflakeconfig.py + - src/fabra/models/components/redshiftconfig.py + - src/fabra/models/components/mongodbconfig.py + - src/fabra/models/components/bigqueryconfig.py + - src/fabra/models/components/createlinktokenresponse.py + - src/fabra/models/components/createlinktokenrequest.py + - src/fabra/models/components/object.py + - src/fabra/models/components/objectfield.py + - src/fabra/models/components/objectinput.py + - src/fabra/models/components/frequencyunits.py + - src/fabra/models/components/source.py + - src/fabra/models/components/sourceinput.py + - src/fabra/models/components/sync.py + - src/fabra/models/components/fieldmapping.py + - src/fabra/models/components/syncinput.py + - src/fabra/models/components/security.py + - src/fabra/models/__init__.py + - src/fabra/models/errors/__init__.py + - src/fabra/models/operations/__init__.py + - src/fabra/models/components/__init__.py + - docs/models/operations/getnamespacesrequest.md + - docs/models/operations/getnamespacesresponse.md + - docs/models/operations/getschemarequest.md + - docs/models/operations/getschemaresponsebody.md + - docs/models/operations/getschemaresponse.md + - docs/models/operations/gettablesrequest.md + - docs/models/operations/gettablesresponsebody.md + - docs/models/operations/gettablesresponse.md + - docs/models/operations/queryobjectrequestbody.md + - docs/models/operations/queryobjectrequest.md + - docs/models/operations/examplefield3.md + - docs/models/operations/queryobjectresponsebody.md + - docs/models/operations/queryobjectresponse.md + - docs/models/operations/createdestinationresponsebody.md + - docs/models/operations/createdestinationresponse.md + - docs/models/operations/getdestinationsresponsebody.md + - docs/models/operations/getdestinationsresponse.md + - docs/models/operations/createlinktokenresponse.md + - docs/models/operations/createobjectresponsebody.md + - docs/models/operations/createobjectresponse.md + - docs/models/operations/getobjectsresponsebody.md + - docs/models/operations/getobjectsresponse.md + - docs/models/operations/createsourceresponsebody.md + - docs/models/operations/createsourceresponse.md + - docs/models/operations/getsourcesresponsebody.md + - docs/models/operations/getsourcesresponse.md + - docs/models/operations/createsyncresponsebody.md + - docs/models/operations/createsyncresponse.md + - docs/models/operations/getsyncsresponsebody.md + - docs/models/operations/getsyncsresponse.md + - docs/models/components/namespaces.md + - docs/models/components/httpmetadata.md + - docs/models/components/field.md + - docs/models/components/fieldtype.md + - docs/models/components/queryfilter.md + - docs/models/components/destination.md + - docs/models/components/connection.md + - docs/models/components/connectiontype.md + - docs/models/components/destinationinput.md + - docs/models/components/snowflakeconfig.md + - docs/models/components/redshiftconfig.md + - docs/models/components/mongodbconfig.md + - docs/models/components/bigqueryconfig.md + - docs/models/components/createlinktokenresponse.md + - docs/models/components/createlinktokenrequest.md + - docs/models/components/object.md + - docs/models/components/objectfield.md + - docs/models/components/objectinput.md + - docs/models/components/frequencyunits.md + - docs/models/components/source.md + - docs/models/components/sourceinput.md + - docs/models/components/sync.md + - docs/models/components/fieldmapping.md + - docs/models/components/syncinput.md + - docs/models/components/security.md + - docs/sdks/fabra/README.md + - docs/sdks/connection/README.md + - docs/sdks/customerdata/README.md + - docs/sdks/destination/README.md + - docs/sdks/linktoken/README.md + - docs/sdks/object/README.md + - docs/sdks/source/README.md + - docs/sdks/sync/README.md + - USAGE.md + - .gitattributes + - src/fabra/_hooks/sdkhooks.py + - src/fabra/_hooks/types.py + - src/fabra/_hooks/__init__.py diff --git a/README.md b/README.md index 7139a98..610865a 100755 --- a/README.md +++ b/README.md @@ -6,41 +6,42 @@ - + ## SDK Installation ```bash pip install fabra ``` - + + ## SDK Example Usage - + +### Example + ```python import fabra from fabra.models import operations s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) -req = operations.GetNamespacesRequest( - connection_id=548814, -) -res = s.connection.get_namespaces(req) +res = s.connection.get_namespaces(request=operations.GetNamespacesRequest( + connection_id=995455, +)) if res.namespaces is not None: # handle response + pass + ``` - + - + ## Available Resources and Operations - ### [connection](docs/sdks/connection/README.md) * [get_namespaces](docs/sdks/connection/README.md#get_namespaces) - Get all namespaces @@ -74,6 +75,152 @@ if res.namespaces is not None: * [create_sync](docs/sdks/sync/README.md#create_sync) - Create a new sync * [get_syncs](docs/sdks/sync/README.md#get_syncs) - Get all syncs - + + + +## Error Handling + +Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type. + +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | + +### Example + +```python +import fabra +from fabra.models import errors, operations + +s = fabra.Fabra( + api_key_auth="", +) + +res = None +try: + res = s.connection.get_namespaces(request=operations.GetNamespacesRequest( + connection_id=995455, +)) + +except errors.SDKError as e: + # handle exception + raise(e) + +if res.namespaces is not None: + # handle response + pass + +``` + + + +## Server Selection + +### Select Server by Index + +You can override the default server globally by passing a server index to the `server_idx: int` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers: + +| # | Server | Variables | +| - | ------ | --------- | +| 0 | `https://api.fabra.io` | None | + +#### Example + +```python +import fabra +from fabra.models import operations + +s = fabra.Fabra( + server_idx=0, + api_key_auth="", +) + + +res = s.connection.get_namespaces(request=operations.GetNamespacesRequest( + connection_id=995455, +)) + +if res.namespaces is not None: + # handle response + pass + +``` + + +### Override Server URL Per-Client + +The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example: +```python +import fabra +from fabra.models import operations + +s = fabra.Fabra( + server_url="https://api.fabra.io", + api_key_auth="", +) + + +res = s.connection.get_namespaces(request=operations.GetNamespacesRequest( + connection_id=995455, +)) + +if res.namespaces is not None: + # handle response + pass + +``` + + + +## Custom HTTP Client + +The Python SDK makes API calls using the [requests](https://pypi.org/project/requests/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `requests.Session` object. + +For example, you could specify a header for every request that this sdk makes as follows: +```python +import fabra +import requests + +http_client = requests.Session() +http_client.headers.update({'x-custom-header': 'someValue'}) +s = fabra.Fabra(client=http_client) +``` + + + +## Authentication + +### Per-Client Security Schemes + +This SDK supports the following security scheme globally: + +| Name | Type | Scheme | +| -------------- | -------------- | -------------- | +| `api_key_auth` | apiKey | API key | + +To authenticate with the API the `api_key_auth` parameter must be set when initializing the SDK client instance. For example: +```python +import fabra +from fabra.models import operations + +s = fabra.Fabra( + api_key_auth="", +) + + +res = s.connection.get_namespaces(request=operations.GetNamespacesRequest( + connection_id=995455, +)) + +if res.namespaces is not None: + # handle response + pass + +``` + + + + + ### SDK Generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks) diff --git a/RELEASES.md b/RELEASES.md index 090f2b6..b844b60 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -354,4 +354,14 @@ Based on: - OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml - Speakeasy CLI 1.49.0 (2.41.4) https://github.com/speakeasy-api/speakeasy ### Releases -- [PyPI v0.21.0] https://pypi.org/project/fabra/0.21.0 - . \ No newline at end of file +- [PyPI v0.21.0] https://pypi.org/project/fabra/0.21.0 - . + +## 2024-05-27 00:06:32 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.296.1 (2.338.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.22.0] . +### Releases +- [PyPI v0.22.0] https://pypi.org/project/fabra/0.22.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md old mode 100755 new mode 100644 index 2387a7d..92ee6e9 --- a/USAGE.md +++ b/USAGE.md @@ -1,21 +1,20 @@ - + ```python import fabra from fabra.models import operations s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) -req = operations.GetNamespacesRequest( - connection_id=548814, -) -res = s.connection.get_namespaces(req) +res = s.connection.get_namespaces(request=operations.GetNamespacesRequest( + connection_id=995455, +)) if res.namespaces is not None: # handle response + pass + ``` - \ No newline at end of file + \ No newline at end of file diff --git a/docs/models/shared/bigqueryconfig.md b/docs/models/components/bigqueryconfig.md old mode 100755 new mode 100644 similarity index 80% rename from docs/models/shared/bigqueryconfig.md rename to docs/models/components/bigqueryconfig.md index b2df208..65487a5 --- a/docs/models/shared/bigqueryconfig.md +++ b/docs/models/components/bigqueryconfig.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | Example | | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | -| `credentials` | *Optional[str]* | :heavy_minus_sign: | N/A | Paste JSON from GCP | -| `location` | *str* | :heavy_check_mark: | N/A | us-west1 | \ No newline at end of file +| `location` | *str* | :heavy_check_mark: | N/A | us-west1 | +| `credentials` | *Optional[str]* | :heavy_minus_sign: | N/A | Paste JSON from GCP | \ No newline at end of file diff --git a/docs/models/components/connection.md b/docs/models/components/connection.md new file mode 100644 index 0000000..9ba26f1 --- /dev/null +++ b/docs/models/components/connection.md @@ -0,0 +1,9 @@ +# Connection + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `connection_type` | [Optional[components.ConnectionType]](../../models/components/connectiontype.md) | :heavy_minus_sign: | N/A | | +| `id` | *Optional[int]* | :heavy_minus_sign: | N/A | 1 | \ No newline at end of file diff --git a/docs/models/shared/connectiontype.md b/docs/models/components/connectiontype.md old mode 100755 new mode 100644 similarity index 100% rename from docs/models/shared/connectiontype.md rename to docs/models/components/connectiontype.md diff --git a/docs/models/shared/createlinktokenrequest.md b/docs/models/components/createlinktokenrequest.md old mode 100755 new mode 100644 similarity index 100% rename from docs/models/shared/createlinktokenrequest.md rename to docs/models/components/createlinktokenrequest.md diff --git a/docs/models/shared/createlinktokenresponse.md b/docs/models/components/createlinktokenresponse.md old mode 100755 new mode 100644 similarity index 91% rename from docs/models/shared/createlinktokenresponse.md rename to docs/models/components/createlinktokenresponse.md index 21bb022..8e63ad9 --- a/docs/models/shared/createlinktokenresponse.md +++ b/docs/models/components/createlinktokenresponse.md @@ -1,7 +1,5 @@ # CreateLinkTokenResponse -Successfully created link token - ## Fields diff --git a/docs/models/components/destination.md b/docs/models/components/destination.md new file mode 100644 index 0000000..1cba4ba --- /dev/null +++ b/docs/models/components/destination.md @@ -0,0 +1,10 @@ +# Destination + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `connection` | [Optional[components.Connection]](../../models/components/connection.md) | :heavy_minus_sign: | N/A | | +| `display_name` | *Optional[str]* | :heavy_minus_sign: | N/A | BigQuery | +| `id` | *Optional[int]* | :heavy_minus_sign: | N/A | 10 | \ No newline at end of file diff --git a/docs/models/components/destinationinput.md b/docs/models/components/destinationinput.md new file mode 100644 index 0000000..1de08b8 --- /dev/null +++ b/docs/models/components/destinationinput.md @@ -0,0 +1,13 @@ +# DestinationInput + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `connection_type` | [components.ConnectionType](../../models/components/connectiontype.md) | :heavy_check_mark: | N/A | | +| `display_name` | *str* | :heavy_check_mark: | N/A | BigQuery | +| `bigquery_config` | [Optional[components.BigQueryConfig]](../../models/components/bigqueryconfig.md) | :heavy_minus_sign: | N/A | | +| `mongodb_config` | [Optional[components.MongoDbConfig]](../../models/components/mongodbconfig.md) | :heavy_minus_sign: | N/A | | +| `redshift_config` | [Optional[components.RedshiftConfig]](../../models/components/redshiftconfig.md) | :heavy_minus_sign: | N/A | | +| `snowflake_config` | [Optional[components.SnowflakeConfig]](../../models/components/snowflakeconfig.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/components/field.md b/docs/models/components/field.md new file mode 100644 index 0000000..4f1120a --- /dev/null +++ b/docs/models/components/field.md @@ -0,0 +1,9 @@ +# Field + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | event_name | +| `type` | [Optional[components.FieldType]](../../models/components/fieldtype.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/shared/fieldmapping.md b/docs/models/components/fieldmapping.md old mode 100755 new mode 100644 similarity index 100% rename from docs/models/shared/fieldmapping.md rename to docs/models/components/fieldmapping.md diff --git a/docs/models/shared/fieldtype.md b/docs/models/components/fieldtype.md old mode 100755 new mode 100644 similarity index 100% rename from docs/models/shared/fieldtype.md rename to docs/models/components/fieldtype.md diff --git a/docs/models/shared/frequencyunits.md b/docs/models/components/frequencyunits.md old mode 100755 new mode 100644 similarity index 100% rename from docs/models/shared/frequencyunits.md rename to docs/models/components/frequencyunits.md diff --git a/docs/models/components/httpmetadata.md b/docs/models/components/httpmetadata.md new file mode 100644 index 0000000..5febcce --- /dev/null +++ b/docs/models/components/httpmetadata.md @@ -0,0 +1,9 @@ +# HTTPMetadata + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| `response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `request` | [requests.Request](https://requests.readthedocs.io/en/latest/api/#requests.Request) | :heavy_check_mark: | Raw HTTP request; suitable for debugging | \ No newline at end of file diff --git a/docs/models/shared/mongodbconfig.md b/docs/models/components/mongodbconfig.md old mode 100755 new mode 100644 similarity index 90% rename from docs/models/shared/mongodbconfig.md rename to docs/models/components/mongodbconfig.md index 5475018..0587295 --- a/docs/models/shared/mongodbconfig.md +++ b/docs/models/components/mongodbconfig.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | Example | | --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | -| `connection_options` | *Optional[str]* | :heavy_minus_sign: | N/A | retryWrites=true&w=majority | | `host` | *str* | :heavy_check_mark: | N/A | examplecluster.abc123.mongodb.net | | `password` | *str* | :heavy_check_mark: | N/A | securePassword123 | -| `username` | *str* | :heavy_check_mark: | N/A | jane_doe | \ No newline at end of file +| `username` | *str* | :heavy_check_mark: | N/A | jane_doe | +| `connection_options` | *Optional[str]* | :heavy_minus_sign: | N/A | retryWrites=true&w=majority | \ No newline at end of file diff --git a/docs/models/components/namespaces.md b/docs/models/components/namespaces.md new file mode 100644 index 0000000..85f0b30 --- /dev/null +++ b/docs/models/components/namespaces.md @@ -0,0 +1,8 @@ +# Namespaces + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | +| `namespaces` | List[*str*] | :heavy_minus_sign: | N/A | [
"marketing",
"analytics",
"finance"
] | \ No newline at end of file diff --git a/docs/models/shared/object.md b/docs/models/components/object.md old mode 100755 new mode 100644 similarity index 96% rename from docs/models/shared/object.md rename to docs/models/components/object.md index be413fa..a19eed4 --- a/docs/models/shared/object.md +++ b/docs/models/components/object.md @@ -10,5 +10,5 @@ | `end_customer_id_field` | *Optional[str]* | :heavy_minus_sign: | This is where Fabra will insert the End Customer ID specified in the sync configuration | end_customer_id | | `id` | *Optional[int]* | :heavy_minus_sign: | N/A | 10 | | `namespace` | *Optional[str]* | :heavy_minus_sign: | N/A | bigquery_dataset | -| `object_fields` | list[[ObjectField](../../models/shared/objectfield.md)] | :heavy_minus_sign: | N/A | | +| `object_fields` | List[[components.ObjectField](../../models/components/objectfield.md)] | :heavy_minus_sign: | N/A | | | `table_name` | *Optional[str]* | :heavy_minus_sign: | N/A | events | \ No newline at end of file diff --git a/docs/models/components/objectfield.md b/docs/models/components/objectfield.md new file mode 100644 index 0000000..abeba0f --- /dev/null +++ b/docs/models/components/objectfield.md @@ -0,0 +1,9 @@ +# ObjectField + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | event_name | +| `type` | [Optional[components.FieldType]](../../models/components/fieldtype.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/shared/objectinput.md b/docs/models/components/objectinput.md old mode 100755 new mode 100644 similarity index 95% rename from docs/models/shared/objectinput.md rename to docs/models/components/objectinput.md index 4c67a62..10a4315 --- a/docs/models/shared/objectinput.md +++ b/docs/models/components/objectinput.md @@ -5,13 +5,13 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -| `cursor_field` | *Optional[str]* | :heavy_minus_sign: | N/A | updated_at | | `destination_id` | *int* | :heavy_check_mark: | N/A | 2 | | `display_name` | *str* | :heavy_check_mark: | N/A | BigQuery | | `end_customer_id_field` | *str* | :heavy_check_mark: | This is where Fabra will insert the End Customer ID specified when creating a source. | end_customer_id | | `frequency` | *int* | :heavy_check_mark: | N/A | 30 | -| `frequency_units` | [FrequencyUnits](../../models/shared/frequencyunits.md) | :heavy_check_mark: | N/A | | +| `frequency_units` | [components.FrequencyUnits](../../models/components/frequencyunits.md) | :heavy_check_mark: | N/A | | | `namespace` | *str* | :heavy_check_mark: | N/A | bigquery_dataset | -| `object_fields` | list[[ObjectField](../../models/shared/objectfield.md)] | :heavy_minus_sign: | N/A | | -| `primary_key` | *Optional[str]* | :heavy_minus_sign: | N/A | event_id | -| `table_name` | *str* | :heavy_check_mark: | N/A | events | \ No newline at end of file +| `table_name` | *str* | :heavy_check_mark: | N/A | events | +| `cursor_field` | *Optional[str]* | :heavy_minus_sign: | N/A | updated_at | +| `object_fields` | List[[components.ObjectField](../../models/components/objectfield.md)] | :heavy_minus_sign: | N/A | | +| `primary_key` | *Optional[str]* | :heavy_minus_sign: | N/A | event_id | \ No newline at end of file diff --git a/docs/models/shared/queryfilter.md b/docs/models/components/queryfilter.md old mode 100755 new mode 100644 similarity index 100% rename from docs/models/shared/queryfilter.md rename to docs/models/components/queryfilter.md diff --git a/docs/models/shared/redshiftconfig.md b/docs/models/components/redshiftconfig.md old mode 100755 new mode 100644 similarity index 100% rename from docs/models/shared/redshiftconfig.md rename to docs/models/components/redshiftconfig.md diff --git a/docs/models/shared/namespaces.md b/docs/models/components/security.md old mode 100755 new mode 100644 similarity index 65% rename from docs/models/shared/namespaces.md rename to docs/models/components/security.md index a84026c..056b871 --- a/docs/models/shared/namespaces.md +++ b/docs/models/components/security.md @@ -1,10 +1,8 @@ -# Namespaces - -Successfully fetched namespaces +# Security ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `namespaces` | list[*str*] | :heavy_minus_sign: | N/A | \ No newline at end of file +| `api_key_auth` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/shared/snowflakeconfig.md b/docs/models/components/snowflakeconfig.md old mode 100755 new mode 100644 similarity index 100% rename from docs/models/shared/snowflakeconfig.md rename to docs/models/components/snowflakeconfig.md diff --git a/docs/models/components/source.md b/docs/models/components/source.md new file mode 100644 index 0000000..b91864d --- /dev/null +++ b/docs/models/components/source.md @@ -0,0 +1,11 @@ +# Source + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `connection` | [Optional[components.Connection]](../../models/components/connection.md) | :heavy_minus_sign: | N/A | | +| `display_name` | *Optional[str]* | :heavy_minus_sign: | N/A | Frontend Events | +| `end_customer_id` | *Optional[str]* | :heavy_minus_sign: | N/A | abcd-1234-efgh-5678 | +| `id` | *Optional[int]* | :heavy_minus_sign: | N/A | 10 | \ No newline at end of file diff --git a/docs/models/components/sourceinput.md b/docs/models/components/sourceinput.md new file mode 100644 index 0000000..c04b240 --- /dev/null +++ b/docs/models/components/sourceinput.md @@ -0,0 +1,14 @@ +# SourceInput + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `connection_type` | [components.ConnectionType](../../models/components/connectiontype.md) | :heavy_check_mark: | N/A | | +| `display_name` | *str* | :heavy_check_mark: | N/A | Frontend Events | +| `end_customer_id` | *str* | :heavy_check_mark: | N/A | abcd-1234-efgh-5678 | +| `bigquery_config` | [Optional[components.BigQueryConfig]](../../models/components/bigqueryconfig.md) | :heavy_minus_sign: | N/A | | +| `mongodb_config` | [Optional[components.MongoDbConfig]](../../models/components/mongodbconfig.md) | :heavy_minus_sign: | N/A | | +| `redshift_config` | [Optional[components.RedshiftConfig]](../../models/components/redshiftconfig.md) | :heavy_minus_sign: | N/A | | +| `snowflake_config` | [Optional[components.SnowflakeConfig]](../../models/components/snowflakeconfig.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/shared/sync.md b/docs/models/components/sync.md old mode 100755 new mode 100644 similarity index 95% rename from docs/models/shared/sync.md rename to docs/models/components/sync.md index 97ab678..dcd59b6 --- a/docs/models/shared/sync.md +++ b/docs/models/components/sync.md @@ -10,9 +10,9 @@ | `destination_id` | *Optional[int]* | :heavy_minus_sign: | N/A | 2 | | `display_name` | *Optional[str]* | :heavy_minus_sign: | N/A | Event Sync | | `end_customer_id` | *Optional[str]* | :heavy_minus_sign: | N/A | abc123 | -| `field_mappings` | list[[FieldMapping](../../models/shared/fieldmapping.md)] | :heavy_minus_sign: | N/A | | +| `field_mappings` | List[[components.FieldMapping](../../models/components/fieldmapping.md)] | :heavy_minus_sign: | N/A | [
{
"source_field_name": "event_name",
"destination_field_name": "event"
}
] | | `frequency` | *Optional[int]* | :heavy_minus_sign: | N/A | | -| `frequency_units` | [Optional[FrequencyUnits]](../../models/shared/frequencyunits.md) | :heavy_minus_sign: | N/A | | +| `frequency_units` | [Optional[components.FrequencyUnits]](../../models/components/frequencyunits.md) | :heavy_minus_sign: | N/A | | | `id` | *Optional[int]* | :heavy_minus_sign: | N/A | 10 | | `namespace` | *Optional[str]* | :heavy_minus_sign: | N/A | end_customer_bigquery_dataset | | `object_id` | *Optional[int]* | :heavy_minus_sign: | N/A | 3 | diff --git a/docs/models/shared/syncinput.md b/docs/models/components/syncinput.md old mode 100755 new mode 100644 similarity index 95% rename from docs/models/shared/syncinput.md rename to docs/models/components/syncinput.md index 4119cbe..2257411 --- a/docs/models/shared/syncinput.md +++ b/docs/models/components/syncinput.md @@ -5,16 +5,16 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `cursor_field` | *Optional[str]* | :heavy_minus_sign: | N/A | updated_at | -| `custom_join` | *Optional[str]* | :heavy_minus_sign: | N/A | select * from events join additional_properties on events.id = additional_properties.event_id; | | `destination_id` | *int* | :heavy_check_mark: | N/A | 2 | | `display_name` | *str* | :heavy_check_mark: | N/A | Event Sync | | `end_customer_id` | *str* | :heavy_check_mark: | N/A | abc123 | -| `field_mappings` | list[[FieldMapping](../../models/shared/fieldmapping.md)] | :heavy_check_mark: | N/A | | +| `field_mappings` | List[[components.FieldMapping](../../models/components/fieldmapping.md)] | :heavy_check_mark: | N/A | [
{
"source_field_name": "event_name",
"destination_field_name": "event"
}
] | +| `object_id` | *int* | :heavy_check_mark: | N/A | 3 | +| `source_id` | *int* | :heavy_check_mark: | N/A | 1 | +| `cursor_field` | *Optional[str]* | :heavy_minus_sign: | N/A | updated_at | +| `custom_join` | *Optional[str]* | :heavy_minus_sign: | N/A | select * from events join additional_properties on events.id = additional_properties.event_id; | | `frequency` | *Optional[int]* | :heavy_minus_sign: | N/A | 30 | -| `frequency_units` | [Optional[FrequencyUnits]](../../models/shared/frequencyunits.md) | :heavy_minus_sign: | N/A | | +| `frequency_units` | [Optional[components.FrequencyUnits]](../../models/components/frequencyunits.md) | :heavy_minus_sign: | N/A | | | `namespace` | *Optional[str]* | :heavy_minus_sign: | N/A | end_customer_bigquery_dataset | -| `object_id` | *int* | :heavy_check_mark: | N/A | 3 | | `primary_key` | *Optional[str]* | :heavy_minus_sign: | N/A | event_id | -| `source_id` | *int* | :heavy_check_mark: | N/A | 1 | | `table_name` | *Optional[str]* | :heavy_minus_sign: | N/A | end_customer_events | \ No newline at end of file diff --git a/docs/models/operations/createdestination200applicationjson.md b/docs/models/operations/createdestination200applicationjson.md deleted file mode 100755 index 2c2af48..0000000 --- a/docs/models/operations/createdestination200applicationjson.md +++ /dev/null @@ -1,10 +0,0 @@ -# CreateDestination200ApplicationJSON - -Successfully created destination - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `destination` | [Optional[shared.Destination]](../../models/shared/destination.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createdestinationresponse.md b/docs/models/operations/createdestinationresponse.md old mode 100755 new mode 100644 index f6c8184..0c90c30 --- a/docs/models/operations/createdestinationresponse.md +++ b/docs/models/operations/createdestinationresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `create_destination_200_application_json_object` | [Optional[CreateDestination200ApplicationJSON]](../../models/operations/createdestination200applicationjson.md) | :heavy_minus_sign: | Successfully created destination | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[operations.CreateDestinationResponseBody]](../../models/operations/createdestinationresponsebody.md) | :heavy_minus_sign: | Successfully created destination | \ No newline at end of file diff --git a/docs/models/operations/createdestinationresponsebody.md b/docs/models/operations/createdestinationresponsebody.md new file mode 100644 index 0000000..a99f821 --- /dev/null +++ b/docs/models/operations/createdestinationresponsebody.md @@ -0,0 +1,10 @@ +# CreateDestinationResponseBody + +Successfully created destination + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `destination` | [Optional[components.Destination]](../../models/components/destination.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createlinktokenresponse.md b/docs/models/operations/createlinktokenresponse.md old mode 100755 new mode 100644 index bfd6830..9fcf97c --- a/docs/models/operations/createlinktokenresponse.md +++ b/docs/models/operations/createlinktokenresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `create_link_token_response` | [Optional[shared.CreateLinkTokenResponse]](../../models/shared/createlinktokenresponse.md) | :heavy_minus_sign: | Successfully created link token | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `create_link_token_response` | [Optional[components.CreateLinkTokenResponse]](../../models/components/createlinktokenresponse.md) | :heavy_minus_sign: | Successfully created link token | \ No newline at end of file diff --git a/docs/models/operations/createobjectresponse.md b/docs/models/operations/createobjectresponse.md old mode 100755 new mode 100644 index 7b5c28b..aaaf163 --- a/docs/models/operations/createobjectresponse.md +++ b/docs/models/operations/createobjectresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `create_object_200_application_json_object` | [Optional[CreateObject200ApplicationJSON]](../../models/operations/createobject200applicationjson.md) | :heavy_minus_sign: | Successfully created object | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[operations.CreateObjectResponseBody]](../../models/operations/createobjectresponsebody.md) | :heavy_minus_sign: | Successfully created object | \ No newline at end of file diff --git a/docs/models/operations/createobjectresponsebody.md b/docs/models/operations/createobjectresponsebody.md new file mode 100644 index 0000000..872608c --- /dev/null +++ b/docs/models/operations/createobjectresponsebody.md @@ -0,0 +1,10 @@ +# CreateObjectResponseBody + +Successfully created object + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `object` | [Optional[components.Object]](../../models/components/object.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createsource200applicationjson.md b/docs/models/operations/createsource200applicationjson.md deleted file mode 100755 index 7bb2fc3..0000000 --- a/docs/models/operations/createsource200applicationjson.md +++ /dev/null @@ -1,10 +0,0 @@ -# CreateSource200ApplicationJSON - -Successfully created source - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `source` | [Optional[shared.Source]](../../models/shared/source.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createsourceresponse.md b/docs/models/operations/createsourceresponse.md old mode 100755 new mode 100644 index 7472968..c41459c --- a/docs/models/operations/createsourceresponse.md +++ b/docs/models/operations/createsourceresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `create_source_200_application_json_object` | [Optional[CreateSource200ApplicationJSON]](../../models/operations/createsource200applicationjson.md) | :heavy_minus_sign: | Successfully created source | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[operations.CreateSourceResponseBody]](../../models/operations/createsourceresponsebody.md) | :heavy_minus_sign: | Successfully created source | \ No newline at end of file diff --git a/docs/models/operations/createsourceresponsebody.md b/docs/models/operations/createsourceresponsebody.md new file mode 100644 index 0000000..e71a67e --- /dev/null +++ b/docs/models/operations/createsourceresponsebody.md @@ -0,0 +1,10 @@ +# CreateSourceResponseBody + +Successfully created source + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `source` | [Optional[components.Source]](../../models/components/source.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createsync200applicationjson.md b/docs/models/operations/createsync200applicationjson.md deleted file mode 100755 index 71ebf88..0000000 --- a/docs/models/operations/createsync200applicationjson.md +++ /dev/null @@ -1,10 +0,0 @@ -# CreateSync200ApplicationJSON - -Successfully created sync - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `sync` | [Optional[shared.Sync]](../../models/shared/sync.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createsyncresponse.md b/docs/models/operations/createsyncresponse.md old mode 100755 new mode 100644 index 3fde2b3..ff0ede2 --- a/docs/models/operations/createsyncresponse.md +++ b/docs/models/operations/createsyncresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `create_sync_200_application_json_object` | [Optional[CreateSync200ApplicationJSON]](../../models/operations/createsync200applicationjson.md) | :heavy_minus_sign: | Successfully created sync | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[operations.CreateSyncResponseBody]](../../models/operations/createsyncresponsebody.md) | :heavy_minus_sign: | Successfully created sync | \ No newline at end of file diff --git a/docs/models/operations/createsyncresponsebody.md b/docs/models/operations/createsyncresponsebody.md new file mode 100644 index 0000000..beddba7 --- /dev/null +++ b/docs/models/operations/createsyncresponsebody.md @@ -0,0 +1,10 @@ +# CreateSyncResponseBody + +Successfully created sync + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `sync` | [Optional[components.Sync]](../../models/components/sync.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/queryobject200applicationjsonexamplefield3.md b/docs/models/operations/examplefield3.md old mode 100755 new mode 100644 similarity index 90% rename from docs/models/operations/queryobject200applicationjsonexamplefield3.md rename to docs/models/operations/examplefield3.md index 8925fba..f51d432 --- a/docs/models/operations/queryobject200applicationjsonexamplefield3.md +++ b/docs/models/operations/examplefield3.md @@ -1,4 +1,4 @@ -# QueryObject200ApplicationJSONExampleField3 +# ExampleField3 ## Fields diff --git a/docs/models/operations/getdestinations200applicationjson.md b/docs/models/operations/getdestinations200applicationjson.md deleted file mode 100755 index 3fc651a..0000000 --- a/docs/models/operations/getdestinations200applicationjson.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetDestinations200ApplicationJSON - -Successfully fetched destinations - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `destinations` | list[[shared.Destination](../../models/shared/destination.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getdestinationsresponse.md b/docs/models/operations/getdestinationsresponse.md old mode 100755 new mode 100644 index 09187b7..203cc2d --- a/docs/models/operations/getdestinationsresponse.md +++ b/docs/models/operations/getdestinationsresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `get_destinations_200_application_json_object` | [Optional[GetDestinations200ApplicationJSON]](../../models/operations/getdestinations200applicationjson.md) | :heavy_minus_sign: | Successfully fetched destinations | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[operations.GetDestinationsResponseBody]](../../models/operations/getdestinationsresponsebody.md) | :heavy_minus_sign: | Successfully fetched destinations | \ No newline at end of file diff --git a/docs/models/operations/getdestinationsresponsebody.md b/docs/models/operations/getdestinationsresponsebody.md new file mode 100644 index 0000000..2d74b03 --- /dev/null +++ b/docs/models/operations/getdestinationsresponsebody.md @@ -0,0 +1,10 @@ +# GetDestinationsResponseBody + +Successfully fetched destinations + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `destinations` | List[[components.Destination](../../models/components/destination.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getnamespacesrequest.md b/docs/models/operations/getnamespacesrequest.md old mode 100755 new mode 100644 diff --git a/docs/models/operations/getnamespacesresponse.md b/docs/models/operations/getnamespacesresponse.md old mode 100755 new mode 100644 index 4969242..7e71d01 --- a/docs/models/operations/getnamespacesresponse.md +++ b/docs/models/operations/getnamespacesresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `namespaces` | [Optional[shared.Namespaces]](../../models/shared/namespaces.md) | :heavy_minus_sign: | Successfully fetched namespaces | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `namespaces` | [Optional[components.Namespaces]](../../models/components/namespaces.md) | :heavy_minus_sign: | Successfully fetched namespaces | \ No newline at end of file diff --git a/docs/models/operations/getobjects200applicationjson.md b/docs/models/operations/getobjects200applicationjson.md deleted file mode 100755 index 3288543..0000000 --- a/docs/models/operations/getobjects200applicationjson.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetObjects200ApplicationJSON - -Successfully fetched objects - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `objects` | list[[shared.Object](../../models/shared/object.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getobjectsresponse.md b/docs/models/operations/getobjectsresponse.md old mode 100755 new mode 100644 index 01e381d..46175e5 --- a/docs/models/operations/getobjectsresponse.md +++ b/docs/models/operations/getobjectsresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `get_objects_200_application_json_object` | [Optional[GetObjects200ApplicationJSON]](../../models/operations/getobjects200applicationjson.md) | :heavy_minus_sign: | Successfully fetched objects | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[operations.GetObjectsResponseBody]](../../models/operations/getobjectsresponsebody.md) | :heavy_minus_sign: | Successfully fetched objects | \ No newline at end of file diff --git a/docs/models/operations/getobjectsresponsebody.md b/docs/models/operations/getobjectsresponsebody.md new file mode 100644 index 0000000..03ae114 --- /dev/null +++ b/docs/models/operations/getobjectsresponsebody.md @@ -0,0 +1,10 @@ +# GetObjectsResponseBody + +Successfully fetched objects + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `objects` | List[[components.Object](../../models/components/object.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getschema200applicationjson.md b/docs/models/operations/getschema200applicationjson.md deleted file mode 100755 index 7bbb97c..0000000 --- a/docs/models/operations/getschema200applicationjson.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetSchema200ApplicationJSON - -Successfully fetched schema - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `schema` | list[[shared.Field](../../models/shared/field.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getschemarequest.md b/docs/models/operations/getschemarequest.md old mode 100755 new mode 100644 diff --git a/docs/models/operations/getschemaresponse.md b/docs/models/operations/getschemaresponse.md old mode 100755 new mode 100644 index 2328b47..4a05942 --- a/docs/models/operations/getschemaresponse.md +++ b/docs/models/operations/getschemaresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `get_schema_200_application_json_object` | [Optional[GetSchema200ApplicationJSON]](../../models/operations/getschema200applicationjson.md) | :heavy_minus_sign: | Successfully fetched schema | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[operations.GetSchemaResponseBody]](../../models/operations/getschemaresponsebody.md) | :heavy_minus_sign: | Successfully fetched schema | \ No newline at end of file diff --git a/docs/models/operations/getschemaresponsebody.md b/docs/models/operations/getschemaresponsebody.md new file mode 100644 index 0000000..6883bfd --- /dev/null +++ b/docs/models/operations/getschemaresponsebody.md @@ -0,0 +1,10 @@ +# GetSchemaResponseBody + +Successfully fetched schema + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `schema` | List[[components.Field](../../models/components/field.md)] | :heavy_minus_sign: | N/A | [
{
"name": "id",
"type": "string"
},
{
"name": "event_name",
"type": "string"
},
{
"name": "created_at",
"type": "timestamp"
},
{
"name": "updated_at",
"type": "timestamp"
}
] | \ No newline at end of file diff --git a/docs/models/operations/getsources200applicationjson.md b/docs/models/operations/getsources200applicationjson.md deleted file mode 100755 index 2141823..0000000 --- a/docs/models/operations/getsources200applicationjson.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetSources200ApplicationJSON - -Successfully fetched sources - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `sources` | list[[shared.Source](../../models/shared/source.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getsourcesresponse.md b/docs/models/operations/getsourcesresponse.md old mode 100755 new mode 100644 index 928903a..baf0725 --- a/docs/models/operations/getsourcesresponse.md +++ b/docs/models/operations/getsourcesresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `get_sources_200_application_json_object` | [Optional[GetSources200ApplicationJSON]](../../models/operations/getsources200applicationjson.md) | :heavy_minus_sign: | Successfully fetched sources | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[operations.GetSourcesResponseBody]](../../models/operations/getsourcesresponsebody.md) | :heavy_minus_sign: | Successfully fetched sources | \ No newline at end of file diff --git a/docs/models/operations/getsourcesresponsebody.md b/docs/models/operations/getsourcesresponsebody.md new file mode 100644 index 0000000..fd11522 --- /dev/null +++ b/docs/models/operations/getsourcesresponsebody.md @@ -0,0 +1,10 @@ +# GetSourcesResponseBody + +Successfully fetched sources + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `sources` | List[[components.Source](../../models/components/source.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getsyncs200applicationjson.md b/docs/models/operations/getsyncs200applicationjson.md deleted file mode 100755 index ec0eebc..0000000 --- a/docs/models/operations/getsyncs200applicationjson.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetSyncs200ApplicationJSON - -Successfully fetched syncs - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `syncs` | list[[shared.Sync](../../models/shared/sync.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getsyncsresponse.md b/docs/models/operations/getsyncsresponse.md old mode 100755 new mode 100644 index 0a930ba..def4190 --- a/docs/models/operations/getsyncsresponse.md +++ b/docs/models/operations/getsyncsresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `get_syncs_200_application_json_object` | [Optional[GetSyncs200ApplicationJSON]](../../models/operations/getsyncs200applicationjson.md) | :heavy_minus_sign: | Successfully fetched syncs | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[operations.GetSyncsResponseBody]](../../models/operations/getsyncsresponsebody.md) | :heavy_minus_sign: | Successfully fetched syncs | \ No newline at end of file diff --git a/docs/models/operations/createobject200applicationjson.md b/docs/models/operations/getsyncsresponsebody.md old mode 100755 new mode 100644 similarity index 76% rename from docs/models/operations/createobject200applicationjson.md rename to docs/models/operations/getsyncsresponsebody.md index bafacf5..2b0211b --- a/docs/models/operations/createobject200applicationjson.md +++ b/docs/models/operations/getsyncsresponsebody.md @@ -1,10 +1,10 @@ -# CreateObject200ApplicationJSON +# GetSyncsResponseBody -Successfully created object +Successfully fetched syncs ## Fields | Field | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `object` | [Optional[shared.Object]](../../models/shared/object.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `syncs` | List[[components.Sync](../../models/components/sync.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/gettables200applicationjson.md b/docs/models/operations/gettables200applicationjson.md deleted file mode 100755 index d2bb32a..0000000 --- a/docs/models/operations/gettables200applicationjson.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetTables200ApplicationJSON - -Successfully fetched tables - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `tables` | list[*str*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/gettablesrequest.md b/docs/models/operations/gettablesrequest.md old mode 100755 new mode 100644 diff --git a/docs/models/operations/gettablesresponse.md b/docs/models/operations/gettablesresponse.md old mode 100755 new mode 100644 index 63aff55..7c1d5bd --- a/docs/models/operations/gettablesresponse.md +++ b/docs/models/operations/gettablesresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `get_tables_200_application_json_object` | [Optional[GetTables200ApplicationJSON]](../../models/operations/gettables200applicationjson.md) | :heavy_minus_sign: | Successfully fetched tables | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[operations.GetTablesResponseBody]](../../models/operations/gettablesresponsebody.md) | :heavy_minus_sign: | Successfully fetched tables | \ No newline at end of file diff --git a/docs/models/operations/gettablesresponsebody.md b/docs/models/operations/gettablesresponsebody.md new file mode 100644 index 0000000..46b82aa --- /dev/null +++ b/docs/models/operations/gettablesresponsebody.md @@ -0,0 +1,10 @@ +# GetTablesResponseBody + +Successfully fetched tables + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | ---------------------------------- | ---------------------------------- | +| `tables` | List[*str*] | :heavy_minus_sign: | N/A | [
"events",
"users",
"companies"
] | \ No newline at end of file diff --git a/docs/models/operations/queryobject200applicationjson.md b/docs/models/operations/queryobject200applicationjson.md deleted file mode 100755 index 8150833..0000000 --- a/docs/models/operations/queryobject200applicationjson.md +++ /dev/null @@ -1,12 +0,0 @@ -# QueryObject200ApplicationJSON - -The response payload will match the schema you defined when creating the object - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `example_field_1` | *Optional[int]* | :heavy_minus_sign: | N/A | 1 | -| `example_field_2` | *Optional[str]* | :heavy_minus_sign: | N/A | hello | -| `example_field_3` | [Optional[QueryObject200ApplicationJSONExampleField3]](../../models/operations/queryobject200applicationjsonexamplefield3.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/queryobjectrequest.md b/docs/models/operations/queryobjectrequest.md old mode 100755 new mode 100644 index 87469b4..ed1679d --- a/docs/models/operations/queryobjectrequest.md +++ b/docs/models/operations/queryobjectrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -| `request_body` | [Optional[QueryObjectRequestBody]](../../models/operations/queryobjectrequestbody.md) | :heavy_minus_sign: | N/A | -| `end_customer_id` | *str* | :heavy_check_mark: | N/A | -| `object_id` | *int* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `end_customer_id` | *str* | :heavy_check_mark: | N/A | +| `object_id` | *int* | :heavy_check_mark: | N/A | +| `request_body` | [Optional[operations.QueryObjectRequestBody]](../../models/operations/queryobjectrequestbody.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/queryobjectrequestbody.md b/docs/models/operations/queryobjectrequestbody.md old mode 100755 new mode 100644 index 4f48514..1deb3c6 --- a/docs/models/operations/queryobjectrequestbody.md +++ b/docs/models/operations/queryobjectrequestbody.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `filters` | list[[shared.QueryFilter](../../models/shared/queryfilter.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `filters` | List[[components.QueryFilter](../../models/components/queryfilter.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/queryobjectresponse.md b/docs/models/operations/queryobjectresponse.md old mode 100755 new mode 100644 index bd5f4b8..d435767 --- a/docs/models/operations/queryobjectresponse.md +++ b/docs/models/operations/queryobjectresponse.md @@ -3,9 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | -| `status_code` | *int* | :heavy_check_mark: | N/A | -| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | N/A | -| `query_object_200_application_json_object` | [Optional[QueryObject200ApplicationJSON]](../../models/operations/queryobject200applicationjson.md) | :heavy_minus_sign: | The response payload will match the schema you defined when creating the object | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `http_meta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `object` | [Optional[operations.QueryObjectResponseBody]](../../models/operations/queryobjectresponsebody.md) | :heavy_minus_sign: | The response payload will match the schema you defined when creating the object | \ No newline at end of file diff --git a/docs/models/operations/queryobjectresponsebody.md b/docs/models/operations/queryobjectresponsebody.md new file mode 100644 index 0000000..94c1943 --- /dev/null +++ b/docs/models/operations/queryobjectresponsebody.md @@ -0,0 +1,12 @@ +# QueryObjectResponseBody + +The response payload will match the schema you defined when creating the object + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `example_field_1` | *Optional[int]* | :heavy_minus_sign: | N/A | 1 | +| `example_field_2` | *Optional[str]* | :heavy_minus_sign: | N/A | hello | +| `example_field_3` | [Optional[operations.ExampleField3]](../../models/operations/examplefield3.md) | :heavy_minus_sign: | N/A | {
"nested": "data"
} | \ No newline at end of file diff --git a/docs/models/shared/connection.md b/docs/models/shared/connection.md deleted file mode 100755 index e04b426..0000000 --- a/docs/models/shared/connection.md +++ /dev/null @@ -1,9 +0,0 @@ -# Connection - - -## Fields - -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | -| `connection_type` | [Optional[ConnectionType]](../../models/shared/connectiontype.md) | :heavy_minus_sign: | N/A | | -| `id` | *Optional[int]* | :heavy_minus_sign: | N/A | 1 | \ No newline at end of file diff --git a/docs/models/shared/destination.md b/docs/models/shared/destination.md deleted file mode 100755 index f002bd6..0000000 --- a/docs/models/shared/destination.md +++ /dev/null @@ -1,10 +0,0 @@ -# Destination - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | -| `connection` | [Optional[Connection]](../../models/shared/connection.md) | :heavy_minus_sign: | N/A | | -| `display_name` | *Optional[str]* | :heavy_minus_sign: | N/A | BigQuery | -| `id` | *Optional[int]* | :heavy_minus_sign: | N/A | 10 | \ No newline at end of file diff --git a/docs/models/shared/destinationinput.md b/docs/models/shared/destinationinput.md deleted file mode 100755 index bd71ba1..0000000 --- a/docs/models/shared/destinationinput.md +++ /dev/null @@ -1,13 +0,0 @@ -# DestinationInput - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `bigquery_config` | [Optional[BigQueryConfig]](../../models/shared/bigqueryconfig.md) | :heavy_minus_sign: | N/A | | -| `connection_type` | [ConnectionType](../../models/shared/connectiontype.md) | :heavy_check_mark: | N/A | | -| `display_name` | *str* | :heavy_check_mark: | N/A | BigQuery | -| `mongodb_config` | [Optional[MongoDbConfig]](../../models/shared/mongodbconfig.md) | :heavy_minus_sign: | N/A | | -| `redshift_config` | [Optional[RedshiftConfig]](../../models/shared/redshiftconfig.md) | :heavy_minus_sign: | N/A | | -| `snowflake_config` | [Optional[SnowflakeConfig]](../../models/shared/snowflakeconfig.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/shared/field.md b/docs/models/shared/field.md deleted file mode 100755 index 2364804..0000000 --- a/docs/models/shared/field.md +++ /dev/null @@ -1,9 +0,0 @@ -# Field - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | -| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | event_name | -| `type` | [Optional[FieldType]](../../models/shared/fieldtype.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/shared/objectfield.md b/docs/models/shared/objectfield.md deleted file mode 100755 index 5dc2b00..0000000 --- a/docs/models/shared/objectfield.md +++ /dev/null @@ -1,9 +0,0 @@ -# ObjectField - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | -| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | event_name | -| `type` | [Optional[FieldType]](../../models/shared/fieldtype.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/shared/security.md b/docs/models/shared/security.md deleted file mode 100755 index 702fdfe..0000000 --- a/docs/models/shared/security.md +++ /dev/null @@ -1,8 +0,0 @@ -# Security - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `api_key_auth` | *str* | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/shared/source.md b/docs/models/shared/source.md deleted file mode 100755 index bdd1528..0000000 --- a/docs/models/shared/source.md +++ /dev/null @@ -1,11 +0,0 @@ -# Source - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | -| `connection` | [Optional[Connection]](../../models/shared/connection.md) | :heavy_minus_sign: | N/A | | -| `display_name` | *Optional[str]* | :heavy_minus_sign: | N/A | Frontend Events | -| `end_customer_id` | *Optional[str]* | :heavy_minus_sign: | N/A | abcd-1234-efgh-5678 | -| `id` | *Optional[int]* | :heavy_minus_sign: | N/A | 10 | \ No newline at end of file diff --git a/docs/models/shared/sourceinput.md b/docs/models/shared/sourceinput.md deleted file mode 100755 index 84650ef..0000000 --- a/docs/models/shared/sourceinput.md +++ /dev/null @@ -1,14 +0,0 @@ -# SourceInput - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `bigquery_config` | [Optional[BigQueryConfig]](../../models/shared/bigqueryconfig.md) | :heavy_minus_sign: | N/A | | -| `connection_type` | [ConnectionType](../../models/shared/connectiontype.md) | :heavy_check_mark: | N/A | | -| `display_name` | *str* | :heavy_check_mark: | N/A | Frontend Events | -| `end_customer_id` | *str* | :heavy_check_mark: | N/A | abcd-1234-efgh-5678 | -| `mongodb_config` | [Optional[MongoDbConfig]](../../models/shared/mongodbconfig.md) | :heavy_minus_sign: | N/A | | -| `redshift_config` | [Optional[RedshiftConfig]](../../models/shared/redshiftconfig.md) | :heavy_minus_sign: | N/A | | -| `snowflake_config` | [Optional[SnowflakeConfig]](../../models/shared/snowflakeconfig.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/sdks/connection/README.md b/docs/sdks/connection/README.md old mode 100755 new mode 100644 index 40cfa39..a88c107 --- a/docs/sdks/connection/README.md +++ b/docs/sdks/connection/README.md @@ -1,4 +1,5 @@ -# connection +# Connection +(*connection*) ## Overview @@ -21,19 +22,18 @@ import fabra from fabra.models import operations s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) -req = operations.GetNamespacesRequest( - connection_id=592845, -) -res = s.connection.get_namespaces(req) +res = s.connection.get_namespaces(request=operations.GetNamespacesRequest( + connection_id=995455, +)) if res.namespaces is not None: # handle response + pass + ``` ### Parameters @@ -46,7 +46,11 @@ if res.namespaces is not None: ### Response **[operations.GetNamespacesResponse](../../models/operations/getnamespacesresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | ## get_schema @@ -59,21 +63,20 @@ import fabra from fabra.models import operations s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) -req = operations.GetSchemaRequest( - connection_id=715190, - namespace='quibusdam', - table_name='unde', -) -res = s.connection.get_schema(req) +res = s.connection.get_schema(request=operations.GetSchemaRequest( + connection_id=367941, + namespace='', + table_name='', +)) -if res.get_schema_200_application_json_object is not None: +if res.object is not None: # handle response + pass + ``` ### Parameters @@ -86,7 +89,11 @@ if res.get_schema_200_application_json_object is not None: ### Response **[operations.GetSchemaResponse](../../models/operations/getschemaresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | ## get_tables @@ -99,20 +106,19 @@ import fabra from fabra.models import operations s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) -req = operations.GetTablesRequest( - connection_id=857946, - namespace='corrupti', -) -res = s.connection.get_tables(req) +res = s.connection.get_tables(request=operations.GetTablesRequest( + connection_id=820803, + namespace='', +)) -if res.get_tables_200_application_json_object is not None: +if res.object is not None: # handle response + pass + ``` ### Parameters @@ -125,4 +131,8 @@ if res.get_tables_200_application_json_object is not None: ### Response **[operations.GetTablesResponse](../../models/operations/gettablesresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/customerdata/README.md b/docs/sdks/customerdata/README.md old mode 100755 new mode 100644 index f48e827..2cf603d --- a/docs/sdks/customerdata/README.md +++ b/docs/sdks/customerdata/README.md @@ -1,4 +1,5 @@ -# customer_data +# CustomerData +(*customer_data*) ### Available Operations @@ -12,43 +13,30 @@ Query a single object record directly from a customer's source. The response pay ```python import fabra -from fabra.models import operations, shared +from fabra.models import components, operations s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) -req = operations.QueryObjectRequest( + +res = s.customer_data.query_object(request=operations.QueryObjectRequest( + end_customer_id='', + object_id=906396, request_body=operations.QueryObjectRequestBody( filters=[ - shared.QueryFilter( - field_name='user_id', - field_value='2', - ), - shared.QueryFilter( - field_name='user_id', - field_value='2', - ), - shared.QueryFilter( - field_name='user_id', - field_value='2', - ), - shared.QueryFilter( + components.QueryFilter( field_name='user_id', field_value='2', ), ], ), - end_customer_id='vel', - object_id=623564, -) - -res = s.customer_data.query_object(req) +)) -if res.query_object_200_application_json_object is not None: +if res.object is not None: # handle response + pass + ``` ### Parameters @@ -61,4 +49,8 @@ if res.query_object_200_application_json_object is not None: ### Response **[operations.QueryObjectResponse](../../models/operations/queryobjectresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/destination/README.md b/docs/sdks/destination/README.md old mode 100755 new mode 100644 index 3a989f4..49fc48c --- a/docs/sdks/destination/README.md +++ b/docs/sdks/destination/README.md @@ -1,4 +1,5 @@ -# destination +# Destination +(*destination*) ## Overview @@ -17,35 +18,34 @@ Create a new destination ```python import fabra -from fabra.models import shared +from fabra.models import components s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) -req = shared.DestinationInput( - bigquery_config=shared.BigQueryConfig( - credentials='Paste JSON from GCP', + +res = s.destination.create_destination(request=components.DestinationInput( + connection_type=components.ConnectionType.SNOWFLAKE, + display_name='BigQuery', + bigquery_config=components.BigQueryConfig( location='us-west1', + credentials='Paste JSON from GCP', ), - connection_type=shared.ConnectionType.MONGODB, - display_name='BigQuery', - mongodb_config=shared.MongoDbConfig( - connection_options='retryWrites=true&w=majority', + mongodb_config=components.MongoDbConfig( host='examplecluster.abc123.mongodb.net', password='securePassword123', username='jane_doe', + connection_options='retryWrites=true&w=majority', ), - redshift_config=shared.RedshiftConfig( + redshift_config=components.RedshiftConfig( database_name='your_database', host='examplecluster.12345.us-west-1.redshift.amazonaws.com', password='securePassword123', port='5432', username='jane_doe', ), - snowflake_config=shared.SnowflakeConfig( + snowflake_config=components.SnowflakeConfig( database_name='your_database', host='abc123.us-east4.gcp.snowflakecomputing.com', password='securePassword123', @@ -53,25 +53,29 @@ req = shared.DestinationInput( username='jane_doe', warehouse_name='your_warehouse', ), -) +)) -res = s.destination.create_destination(req) - -if res.create_destination_200_application_json_object is not None: +if res.object is not None: # handle response + pass + ``` ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `request` | [shared.DestinationInput](../../models/shared/destinationinput.md) | :heavy_check_mark: | The request object to use for the request. | +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `request` | [components.DestinationInput](../../models/components/destinationinput.md) | :heavy_check_mark: | The request object to use for the request. | ### Response **[operations.CreateDestinationResponse](../../models/operations/createdestinationresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | ## get_destinations @@ -82,22 +86,25 @@ Get all destinations ```python import fabra - s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) res = s.destination.get_destinations() -if res.get_destinations_200_application_json_object is not None: +if res.object is not None: # handle response + pass + ``` ### Response **[operations.GetDestinationsResponse](../../models/operations/getdestinationsresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/fabra/README.md b/docs/sdks/fabra/README.md old mode 100755 new mode 100644 index f9253da..08b370d --- a/docs/sdks/fabra/README.md +++ b/docs/sdks/fabra/README.md @@ -1,5 +1,6 @@ # Fabra SDK + ## Overview ### Available Operations diff --git a/docs/sdks/linktoken/README.md b/docs/sdks/linktoken/README.md old mode 100755 new mode 100644 index 17a41cb..9f8b847 --- a/docs/sdks/linktoken/README.md +++ b/docs/sdks/linktoken/README.md @@ -1,4 +1,5 @@ -# link_token +# LinkToken +(*link_token*) ## Overview @@ -16,32 +17,35 @@ Create a new link token ```python import fabra -from fabra.models import shared +from fabra.models import components s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) -req = shared.CreateLinkTokenRequest( - end_customer_id='abcd-1234-efgh-5678', -) -res = s.link_token.create_link_token(req) +res = s.link_token.create_link_token(request=components.CreateLinkTokenRequest( + end_customer_id='abcd-1234-efgh-5678', +)) if res.create_link_token_response is not None: # handle response + pass + ``` ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `request` | [shared.CreateLinkTokenRequest](../../models/shared/createlinktokenrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `request` | [components.CreateLinkTokenRequest](../../models/components/createlinktokenrequest.md) | :heavy_check_mark: | The request object to use for the request. | ### Response **[operations.CreateLinkTokenResponse](../../models/operations/createlinktokenresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/object/README.md b/docs/sdks/object/README.md old mode 100755 new mode 100644 index 2c965bc..c301021 --- a/docs/sdks/object/README.md +++ b/docs/sdks/object/README.md @@ -1,4 +1,5 @@ -# object +# Object +(*object*) ## Overview @@ -17,53 +18,51 @@ Create a new object ```python import fabra -from fabra.models import shared +from fabra.models import components s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) -req = shared.ObjectInput( - cursor_field='updated_at', + +res = s.object.create_object(request=components.ObjectInput( destination_id=2, display_name='BigQuery', end_customer_id_field='end_customer_id', frequency=30, - frequency_units=shared.FrequencyUnits.HOURS, + frequency_units=components.FrequencyUnits.MINUTES, namespace='bigquery_dataset', + table_name='events', + cursor_field='updated_at', object_fields=[ - shared.ObjectField( - name='event_name', - type=shared.FieldType.INTEGER, - ), - shared.ObjectField( + components.ObjectField( name='event_name', - type=shared.FieldType.BOOLEAN, ), ], primary_key='event_id', - table_name='events', -) - -res = s.object.create_object(req) +)) -if res.create_object_200_application_json_object is not None: +if res.object is not None: # handle response + pass + ``` ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `request` | [shared.ObjectInput](../../models/shared/objectinput.md) | :heavy_check_mark: | The request object to use for the request. | +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `request` | [components.ObjectInput](../../models/components/objectinput.md) | :heavy_check_mark: | The request object to use for the request. | ### Response **[operations.CreateObjectResponse](../../models/operations/createobjectresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | ## get_objects @@ -74,22 +73,25 @@ Get all objects ```python import fabra - s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) res = s.object.get_objects() -if res.get_objects_200_application_json_object is not None: +if res.object is not None: # handle response + pass + ``` ### Response **[operations.GetObjectsResponse](../../models/operations/getobjectsresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/source/README.md b/docs/sdks/source/README.md old mode 100755 new mode 100644 index 6509355..cfb8656 --- a/docs/sdks/source/README.md +++ b/docs/sdks/source/README.md @@ -1,4 +1,5 @@ -# source +# Source +(*source*) ## Overview @@ -17,36 +18,35 @@ Create a new source ```python import fabra -from fabra.models import shared +from fabra.models import components s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) -req = shared.SourceInput( - bigquery_config=shared.BigQueryConfig( - credentials='Paste JSON from GCP', - location='us-west1', - ), - connection_type=shared.ConnectionType.SNOWFLAKE, + +res = s.source.create_source(request=components.SourceInput( + connection_type=components.ConnectionType.WEBHOOK, display_name='Frontend Events', end_customer_id='abcd-1234-efgh-5678', - mongodb_config=shared.MongoDbConfig( - connection_options='retryWrites=true&w=majority', + bigquery_config=components.BigQueryConfig( + location='us-west1', + credentials='Paste JSON from GCP', + ), + mongodb_config=components.MongoDbConfig( host='examplecluster.abc123.mongodb.net', password='securePassword123', username='jane_doe', + connection_options='retryWrites=true&w=majority', ), - redshift_config=shared.RedshiftConfig( + redshift_config=components.RedshiftConfig( database_name='your_database', host='examplecluster.12345.us-west-1.redshift.amazonaws.com', password='securePassword123', port='5432', username='jane_doe', ), - snowflake_config=shared.SnowflakeConfig( + snowflake_config=components.SnowflakeConfig( database_name='your_database', host='abc123.us-east4.gcp.snowflakecomputing.com', password='securePassword123', @@ -54,25 +54,29 @@ req = shared.SourceInput( username='jane_doe', warehouse_name='your_warehouse', ), -) - -res = s.source.create_source(req) +)) -if res.create_source_200_application_json_object is not None: +if res.object is not None: # handle response + pass + ``` ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `request` | [shared.SourceInput](../../models/shared/sourceinput.md) | :heavy_check_mark: | The request object to use for the request. | +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `request` | [components.SourceInput](../../models/components/sourceinput.md) | :heavy_check_mark: | The request object to use for the request. | ### Response **[operations.CreateSourceResponse](../../models/operations/createsourceresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | ## get_sources @@ -83,22 +87,25 @@ Get all sources ```python import fabra - s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) res = s.source.get_sources() -if res.get_sources_200_application_json_object is not None: +if res.object is not None: # handle response + pass + ``` ### Response **[operations.GetSourcesResponse](../../models/operations/getsourcesresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/sync/README.md b/docs/sdks/sync/README.md old mode 100755 new mode 100644 index 4e4145d..0887e8d --- a/docs/sdks/sync/README.md +++ b/docs/sdks/sync/README.md @@ -1,4 +1,5 @@ -# sync +# Sync +(*sync*) ## Overview @@ -17,64 +18,54 @@ Create a new sync ```python import fabra -from fabra.models import shared +from fabra.models import components s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) -req = shared.SyncInput( - cursor_field='updated_at', - custom_join='select * from events join additional_properties on events.id = additional_properties.event_id;', + +res = s.sync.create_sync(request=components.SyncInput( destination_id=2, display_name='Event Sync', end_customer_id='abc123', field_mappings=[ - shared.FieldMapping( - destination_field_name='event', - source_field_name='event_name', - ), - shared.FieldMapping( - destination_field_name='event', - source_field_name='event_name', - ), - shared.FieldMapping( - destination_field_name='event', - source_field_name='event_name', - ), - shared.FieldMapping( + components.FieldMapping( destination_field_name='event', source_field_name='event_name', ), ], + object_id=3, + source_id=1, + cursor_field='updated_at', + custom_join='select * from events join additional_properties on events.id = additional_properties.event_id;', frequency=30, - frequency_units=shared.FrequencyUnits.HOURS, namespace='end_customer_bigquery_dataset', - object_id=3, primary_key='event_id', - source_id=1, table_name='end_customer_events', -) - -res = s.sync.create_sync(req) +)) -if res.create_sync_200_application_json_object is not None: +if res.object is not None: # handle response + pass + ``` ### Parameters -| Parameter | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `request` | [shared.SyncInput](../../models/shared/syncinput.md) | :heavy_check_mark: | The request object to use for the request. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `request` | [components.SyncInput](../../models/components/syncinput.md) | :heavy_check_mark: | The request object to use for the request. | ### Response **[operations.CreateSyncResponse](../../models/operations/createsyncresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | ## get_syncs @@ -85,22 +76,25 @@ Get all syncs ```python import fabra - s = fabra.Fabra( - security=shared.Security( - api_key_auth="", - ), + api_key_auth="", ) res = s.sync.get_syncs() -if res.get_syncs_200_application_json_object is not None: +if res.object is not None: # handle response + pass + ``` ### Response **[operations.GetSyncsResponse](../../models/operations/getsyncsresponse.md)** +### Errors +| Error Object | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4xx-5xx | */* | diff --git a/gen.yaml b/gen.yaml index df6370a..cb3342e 100644 --- a/gen.yaml +++ b/gen.yaml @@ -1,17 +1,38 @@ -configVersion: 1.0.0 -management: - docChecksum: a08d8b55b00bfb4ba4828a322fd16614 - docVersion: 0.1.0 - speakeasyVersion: 1.49.0 - generationVersion: 2.41.4 +configVersion: 2.0.0 generation: sdkClassName: Fabra + usageSnippets: + optionalPropertyRendering: withExample + fixes: + nameResolutionDec2023: false + parameterOrderingFeb2024: false + requestResponseComponentNamesFeb2024: false + auth: + oAuth2ClientCredentialsEnabled: false sdkFlattening: false - singleTagPerOp: false telemetryEnabled: false python: - version: 0.21.0 + version: 0.22.0 + additionalDependencies: + dependencies: {} + extraDependencies: + dev: {} author: fabra + clientServerStatusCodesAsErrors: true description: Python Client SDK Generated by Speakeasy + flattenGlobalSecurity: true + imports: + option: openapi + paths: + callbacks: models/callbacks + errors: models/errors + operations: models/operations + shared: models/components + webhooks: models/webhooks + inputModelSuffix: input maxMethodParams: 0 + methodArguments: require-security-and-request + outputModelSuffix: output packageName: fabra + projectUrls: {} + responseFormat: envelope-http diff --git a/py.typed b/py.typed new file mode 100644 index 0000000..3e38f1a --- /dev/null +++ b/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. The package enables type hints. diff --git a/pylintrc b/pylintrc old mode 100755 new mode 100644 index 1ce47d8..6a1c3fc --- a/pylintrc +++ b/pylintrc @@ -88,7 +88,7 @@ persistent=yes # Minimum Python version to use for version dependent checks. Will default to # the version used to run pylint. -py-version=3.9 +py-version=3.8 # Discover python modules and packages in the file system subtree. recursive=no @@ -116,12 +116,12 @@ argument-naming-style=snake_case #argument-rgx= # Naming style matching correct attribute names. -attr-naming-style=snake_case +#attr-naming-style=snake_case # Regular expression matching correct attribute names. Overrides attr-naming- # style. If left empty, attribute names will be checked with the set naming # style. -#attr-rgx= +attr-rgx=[^\W\d][^\W]*|__.*__$ # Bad variable names which should always be refused, separated by a comma. bad-names= @@ -180,6 +180,7 @@ good-names=i, ex, Run, _, + e, id # Good variable names regexes, separated by a comma. If names match any regex, @@ -438,7 +439,11 @@ disable=raw-checker-failed, using-constant-test, too-many-statements, cyclic-import, - too-many-nested-blocks + too-many-nested-blocks, + too-many-boolean-expressions, + no-else-raise, + bare-except, + broad-exception-caught # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option @@ -619,7 +624,7 @@ additional-builtins= allow-global-unused-variables=yes # List of names allowed to shadow builtins -allowed-redefined-builtins= +allowed-redefined-builtins=id,object # List of strings which can identify a callback function by name. A callback # name must start or end with one of those strings. diff --git a/setup.py b/setup.py old mode 100755 new mode 100644 index ad4b387..80ee29a --- a/setup.py +++ b/setup.py @@ -1,42 +1,55 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" import setuptools +import re try: - with open("README.md", "r") as fh: + with open('README.md', 'r') as fh: long_description = fh.read() + GITHUB_URL = 'https://github.com/fabra-io/python-sdk.git' + GITHUB_URL = GITHUB_URL[: -len('.git')] if GITHUB_URL.endswith('.git') else GITHUB_URL + # links on PyPI should have absolute URLs + long_description = re.sub( + r'(\[[^\]]+\]\()((?!https?:)[^\)]+)(\))', + lambda m: m.group(1) + GITHUB_URL + '/blob/master/' + m.group(2) + m.group(3), + long_description, + ) except FileNotFoundError: - long_description = "" + long_description = '' setuptools.setup( - name="fabra", - version="0.21.0", - author="fabra", - description="Python Client SDK Generated by Speakeasy", + name='fabra', + version='0.22.0', + author='fabra', + description='Python Client SDK Generated by Speakeasy', + url='https://github.com/fabra-io/python-sdk.git', long_description=long_description, - long_description_content_type="text/markdown", - packages=setuptools.find_packages(where="src"), + long_description_content_type='text/markdown', + packages=setuptools.find_packages(where='src'), install_requires=[ - "certifi>=2022.12.7", - "charset-normalizer>=2.1.1", - "dataclasses-json-speakeasy>=0.5.8", - "idna>=3.3", - "jsonpath-python>=1.0.6 ", - "marshmallow>=3.17.1", - "marshmallow-enum>=1.5.1", - "mypy-extensions>=0.4.3", - "packaging>=21.3", - "pyparsing>=3.0.9", + "certifi>=2023.7.22", + "charset-normalizer>=3.2.0", + "dataclasses-json>=0.6.4", + "idna>=3.4", + "jsonpath-python>=1.0.6", + "marshmallow>=3.19.0", + "mypy-extensions>=1.0.0", + "packaging>=23.1", "python-dateutil>=2.8.2", - "requests>=2.28.1", + "requests>=2.31.0", "six>=1.16.0", - "typing-inspect>=0.8.0", - "typing_extensions>=4.3.0", - "urllib3>=1.26.12", + "typing-inspect>=0.9.0", + "typing_extensions>=4.7.1", + "urllib3>=1.26.18", ], extras_require={ - "dev":["pylint==2.16.2"] + "dev": [ + "pylint==3.1.0", + ], }, package_dir={'': 'src'}, - python_requires='>=3.9' + python_requires='>=3.8', + package_data={ + 'fabra': ['py.typed'] + }, ) diff --git a/src/fabra/__init__.py b/src/fabra/__init__.py old mode 100755 new mode 100644 diff --git a/src/fabra/_hooks/__init__.py b/src/fabra/_hooks/__init__.py new file mode 100644 index 0000000..b2ab14b --- /dev/null +++ b/src/fabra/_hooks/__init__.py @@ -0,0 +1,4 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from .sdkhooks import * +from .types import * diff --git a/src/fabra/_hooks/sdkhooks.py b/src/fabra/_hooks/sdkhooks.py new file mode 100644 index 0000000..1bd70b2 --- /dev/null +++ b/src/fabra/_hooks/sdkhooks.py @@ -0,0 +1,55 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +import requests +from .types import SDKInitHook, BeforeRequestContext, BeforeRequestHook, AfterSuccessContext, AfterSuccessHook, AfterErrorContext, AfterErrorHook, Hooks +from typing import List, Optional, Tuple + + +class SDKHooks(Hooks): + def __init__(self): + self.sdk_init_hooks: List[SDKInitHook] = [] + self.before_request_hooks: List[BeforeRequestHook] = [] + self.after_success_hooks: List[AfterSuccessHook] = [] + self.after_error_hooks: List[AfterErrorHook] = [] + + def register_sdk_init_hook(self, hook: SDKInitHook) -> None: + self.sdk_init_hooks.append(hook) + + def register_before_request_hook(self, hook: BeforeRequestHook) -> None: + self.before_request_hooks.append(hook) + + def register_after_success_hook(self, hook: AfterSuccessHook) -> None: + self.after_success_hooks.append(hook) + + def register_after_error_hook(self, hook: AfterErrorHook) -> None: + self.after_error_hooks.append(hook) + + def sdk_init(self, base_url: str, client: requests.Session) -> Tuple[str, requests.Session]: + for hook in self.sdk_init_hooks: + base_url, client = hook.sdk_init(base_url, client) + return base_url, client + + def before_request(self, hook_ctx: BeforeRequestContext, request: requests.PreparedRequest) -> requests.PreparedRequest: + for hook in self.before_request_hooks: + out = hook.before_request(hook_ctx, request) + if isinstance(out, Exception): + raise out + request = out + + return request + + def after_success(self, hook_ctx: AfterSuccessContext, response: requests.Response) -> requests.Response: + for hook in self.after_success_hooks: + out = hook.after_success(hook_ctx, response) + if isinstance(out, Exception): + raise out + response = out + return response + + def after_error(self, hook_ctx: AfterErrorContext, response: Optional[requests.Response], error: Optional[Exception]) -> Tuple[Optional[requests.Response], Optional[Exception]]: + for hook in self.after_error_hooks: + result = hook.after_error(hook_ctx, response, error) + if isinstance(result, Exception): + raise result + response, error = result + return response, error diff --git a/src/fabra/_hooks/types.py b/src/fabra/_hooks/types.py new file mode 100644 index 0000000..b24c141 --- /dev/null +++ b/src/fabra/_hooks/types.py @@ -0,0 +1,74 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +import requests as requests_http +from abc import ABC, abstractmethod +from typing import Any, Callable, List, Optional, Tuple, Union + + +class HookContext: + operation_id: str + oauth2_scopes: Optional[List[str]] = None + security_source: Optional[Union[Any, Callable[[], Any]]] = None + + def __init__(self, operation_id: str, oauth2_scopes: Optional[List[str]], security_source: Optional[Union[Any, Callable[[], Any]]]): + self.operation_id = operation_id + self.oauth2_scopes = oauth2_scopes + self.security_source = security_source + + +class BeforeRequestContext(HookContext): + def __init__(self, hook_ctx: HookContext): + super().__init__(hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source) + + +class AfterSuccessContext(HookContext): + def __init__(self, hook_ctx: HookContext): + super().__init__(hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source) + + + +class AfterErrorContext(HookContext): + def __init__(self, hook_ctx: HookContext): + super().__init__(hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source) + + +class SDKInitHook(ABC): + @abstractmethod + def sdk_init(self, base_url: str, client: requests_http.Session) -> Tuple[str, requests_http.Session]: + pass + + +class BeforeRequestHook(ABC): + @abstractmethod + def before_request(self, hook_ctx: BeforeRequestContext, request: requests_http.PreparedRequest) -> Union[requests_http.PreparedRequest, Exception]: + pass + + +class AfterSuccessHook(ABC): + @abstractmethod + def after_success(self, hook_ctx: AfterSuccessContext, response: requests_http.Response) -> Union[requests_http.Response, Exception]: + pass + + +class AfterErrorHook(ABC): + @abstractmethod + def after_error(self, hook_ctx: AfterErrorContext, response: Optional[requests_http.Response], error: Optional[Exception]) -> Union[Tuple[Optional[requests_http.Response], Optional[Exception]], Exception]: + pass + + +class Hooks(ABC): + @abstractmethod + def register_sdk_init_hook(self, hook: SDKInitHook): + pass + + @abstractmethod + def register_before_request_hook(self, hook: BeforeRequestHook): + pass + + @abstractmethod + def register_after_success_hook(self, hook: AfterSuccessHook): + pass + + @abstractmethod + def register_after_error_hook(self, hook: AfterErrorHook): + pass diff --git a/src/fabra/connection.py b/src/fabra/connection.py old mode 100755 new mode 100644 index 8bddbf5..1e7f678 --- a/src/fabra/connection.py +++ b/src/fabra/connection.py @@ -1,8 +1,10 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" +import requests as requests_http from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext +from fabra.models import components, errors, operations from typing import Optional class Connection: @@ -13,84 +15,172 @@ def __init__(self, sdk_config: SDKConfiguration) -> None: self.sdk_configuration = sdk_config + def get_namespaces(self, request: operations.GetNamespacesRequest) -> operations.GetNamespacesResponse: r"""Get all namespaces""" + hook_ctx = HookContext(operation_id='get_namespaces', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/connection/namespaces' - headers = {} - query_params = utils.get_query_params(operations.GetNamespacesRequest, request) - headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - client = self.sdk_configuration.security_client + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) - http_res = client.request('GET', url, params=query_params, headers=headers) - content_type = http_res.headers.get('Content-Type') + query_params = { **utils.get_query_params(request), **query_params } + headers['Accept'] = 'application/json' + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client + + try: + req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.GetNamespacesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.GetNamespacesResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.Namespaces]) + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[components.Namespaces]) res.namespaces = out - elif http_res.status_code in [401, 500]: - pass + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res + def get_schema(self, request: operations.GetSchemaRequest) -> operations.GetSchemaResponse: r"""Get schema for table""" + hook_ctx = HookContext(operation_id='get_schema', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/connection/schema' - headers = {} - query_params = utils.get_query_params(operations.GetSchemaRequest, request) - headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - client = self.sdk_configuration.security_client + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + query_params = { **utils.get_query_params(request), **query_params } + headers['Accept'] = 'application/json' + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('GET', url, params=query_params, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.GetSchemaResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.GetSchemaResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[operations.GetSchema200ApplicationJSON]) - res.get_schema_200_application_json_object = out - elif http_res.status_code in [401, 500]: - pass + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[operations.GetSchemaResponseBody]) + res.object = out + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res + def get_tables(self, request: operations.GetTablesRequest) -> operations.GetTablesResponse: r"""Get all tables""" + hook_ctx = HookContext(operation_id='get_tables', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/connection/tables' - headers = {} - query_params = utils.get_query_params(operations.GetTablesRequest, request) - headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - client = self.sdk_configuration.security_client + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + query_params = { **utils.get_query_params(request), **query_params } + headers['Accept'] = 'application/json' + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('GET', url, params=query_params, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.GetTablesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.GetTablesResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[operations.GetTables200ApplicationJSON]) - res.get_tables_200_application_json_object = out - elif http_res.status_code in [401, 500]: - pass + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[operations.GetTablesResponseBody]) + res.object = out + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res - \ No newline at end of file + + diff --git a/src/fabra/customer_data.py b/src/fabra/customer_data.py old mode 100755 new mode 100644 index 1e820e5..60f4122 --- a/src/fabra/customer_data.py +++ b/src/fabra/customer_data.py @@ -1,8 +1,10 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" +import requests as requests_http from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations +from fabra._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext +from fabra.models import components, errors, operations from typing import Optional class CustomerData: @@ -12,34 +14,64 @@ def __init__(self, sdk_config: SDKConfiguration) -> None: self.sdk_configuration = sdk_config + def query_object(self, request: operations.QueryObjectRequest) -> operations.QueryObjectResponse: r"""Query object record for customer Query a single object record directly from a customer's source. The response payload will match the object schema you've defined. """ + hook_ctx = HookContext(operation_id='query_object', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) - url = utils.generate_url(operations.QueryObjectRequest, base_url, '/customer/{endCustomerID}/object/{objectID}/record', request) - headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "request_body", 'json') - if req_content_type not in ('multipart/form-data', 'multipart/mixed'): + url = utils.generate_url(base_url, '/customer/{endCustomerID}/object/{objectID}/record', request) + + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + req_content_type, data, form = utils.serialize_request_body(request, operations.QueryObjectRequest, "request_body", False, True, 'json') + if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'): headers['content-type'] = req_content_type headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - - client = self.sdk_configuration.security_client + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('POST', url, data=data, files=form, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.QueryObjectResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.QueryObjectResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[operations.QueryObject200ApplicationJSON]) - res.query_object_200_application_json_object = out - elif http_res.status_code in [401, 500]: - pass + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[operations.QueryObjectResponseBody]) + res.object = out + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res - \ No newline at end of file + + diff --git a/src/fabra/destination.py b/src/fabra/destination.py old mode 100755 new mode 100644 index 40b368a..e434a2b --- a/src/fabra/destination.py +++ b/src/fabra/destination.py @@ -1,8 +1,10 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" +import requests as requests_http from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext +from fabra.models import components, errors, operations from typing import Optional class Destination: @@ -13,60 +15,119 @@ def __init__(self, sdk_config: SDKConfiguration) -> None: self.sdk_configuration = sdk_config - def create_destination(self, request: shared.DestinationInput) -> operations.CreateDestinationResponse: + + def create_destination(self, request: components.DestinationInput) -> operations.CreateDestinationResponse: r"""Create a new destination""" + hook_ctx = HookContext(operation_id='create_destination', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/destination' - headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "request", 'json') - if req_content_type not in ('multipart/form-data', 'multipart/mixed'): + + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + req_content_type, data, form = utils.serialize_request_body(request, components.DestinationInput, "request", False, False, 'json') + if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'): headers['content-type'] = req_content_type if data is None and form is None: raise Exception('request body is required') headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - - client = self.sdk_configuration.security_client + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('POST', url, data=data, files=form, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.CreateDestinationResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.CreateDestinationResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[operations.CreateDestination200ApplicationJSON]) - res.create_destination_200_application_json_object = out - elif http_res.status_code in [401, 500]: - pass + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[operations.CreateDestinationResponseBody]) + res.object = out + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res + def get_destinations(self) -> operations.GetDestinationsResponse: r"""Get all destinations""" + hook_ctx = HookContext(operation_id='get_destinations', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/destinations' - headers = {} - headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - client = self.sdk_configuration.security_client + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + headers['Accept'] = 'application/json' + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('GET', url, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.GetDestinationsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.GetDestinationsResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[operations.GetDestinations200ApplicationJSON]) - res.get_destinations_200_application_json_object = out - elif http_res.status_code in [401, 500]: - pass + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[operations.GetDestinationsResponseBody]) + res.object = out + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res - \ No newline at end of file + + diff --git a/src/fabra/link_token.py b/src/fabra/link_token.py old mode 100755 new mode 100644 index c0d60a3..859868c --- a/src/fabra/link_token.py +++ b/src/fabra/link_token.py @@ -1,8 +1,10 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" +import requests as requests_http from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext +from fabra.models import components, errors, operations from typing import Optional class LinkToken: @@ -13,34 +15,64 @@ def __init__(self, sdk_config: SDKConfiguration) -> None: self.sdk_configuration = sdk_config - def create_link_token(self, request: shared.CreateLinkTokenRequest) -> operations.CreateLinkTokenResponse: + + def create_link_token(self, request: components.CreateLinkTokenRequest) -> operations.CreateLinkTokenResponse: r"""Create a new link token""" + hook_ctx = HookContext(operation_id='create_link_token', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/link_token' - headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "request", 'json') - if req_content_type not in ('multipart/form-data', 'multipart/mixed'): + + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + req_content_type, data, form = utils.serialize_request_body(request, components.CreateLinkTokenRequest, "request", False, False, 'json') + if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'): headers['content-type'] = req_content_type if data is None and form is None: raise Exception('request body is required') headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - - client = self.sdk_configuration.security_client + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('POST', url, data=data, files=form, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.CreateLinkTokenResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.CreateLinkTokenResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[shared.CreateLinkTokenResponse]) + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[components.CreateLinkTokenResponse]) res.create_link_token_response = out - elif http_res.status_code in [401, 500]: - pass + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res - \ No newline at end of file + + diff --git a/src/fabra/models/__init__.py b/src/fabra/models/__init__.py old mode 100755 new mode 100644 index 889f8ad..722bb99 --- a/src/fabra/models/__init__.py +++ b/src/fabra/models/__init__.py @@ -1,2 +1,4 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +# package diff --git a/src/fabra/models/shared/__init__.py b/src/fabra/models/components/__init__.py old mode 100755 new mode 100644 similarity index 81% rename from src/fabra/models/shared/__init__.py rename to src/fabra/models/components/__init__.py index 89e84c5..e8d9063 --- a/src/fabra/models/shared/__init__.py +++ b/src/fabra/models/components/__init__.py @@ -11,6 +11,7 @@ from .fieldmapping import * from .fieldtype import * from .frequencyunits import * +from .httpmetadata import * from .mongodbconfig import * from .namespaces import * from .object import * @@ -25,4 +26,4 @@ from .sync import * from .syncinput import * -__all__ = ["BigQueryConfig","Connection","ConnectionType","CreateLinkTokenRequest","CreateLinkTokenResponse","Destination","DestinationInput","Field","FieldMapping","FieldType","FrequencyUnits","MongoDbConfig","Namespaces","Object","ObjectField","ObjectInput","QueryFilter","RedshiftConfig","Security","SnowflakeConfig","Source","SourceInput","Sync","SyncInput"] +__all__ = ["BigQueryConfig","Connection","ConnectionType","CreateLinkTokenRequest","CreateLinkTokenResponse","Destination","DestinationInput","Field","FieldMapping","FieldType","FrequencyUnits","HTTPMetadata","MongoDbConfig","Namespaces","Object","ObjectField","ObjectInput","QueryFilter","RedshiftConfig","Security","SnowflakeConfig","Source","SourceInput","Sync","SyncInput"] diff --git a/src/fabra/models/shared/bigqueryconfig.py b/src/fabra/models/components/bigqueryconfig.py old mode 100755 new mode 100644 similarity index 99% rename from src/fabra/models/shared/bigqueryconfig.py rename to src/fabra/models/components/bigqueryconfig.py index 76bfcb6..371e295 --- a/src/fabra/models/shared/bigqueryconfig.py +++ b/src/fabra/models/components/bigqueryconfig.py @@ -8,7 +8,6 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class BigQueryConfig: location: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('location') }}) diff --git a/src/fabra/models/shared/connection.py b/src/fabra/models/components/connection.py old mode 100755 new mode 100644 similarity index 63% rename from src/fabra/models/shared/connection.py rename to src/fabra/models/components/connection.py index 22fec5a..6160371 --- a/src/fabra/models/shared/connection.py +++ b/src/fabra/models/components/connection.py @@ -2,17 +2,16 @@ from __future__ import annotations import dataclasses -from ..shared import connectiontype as shared_connectiontype +from .connectiontype import ConnectionType from dataclasses_json import Undefined, dataclass_json from fabra import utils from typing import Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class Connection: - connection_type: Optional[shared_connectiontype.ConnectionType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('connection_type'), 'exclude': lambda f: f is None }}) + connection_type: Optional[ConnectionType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('connection_type'), 'exclude': lambda f: f is None }}) id: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('id'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/shared/connectiontype.py b/src/fabra/models/components/connectiontype.py old mode 100755 new mode 100644 similarity index 99% rename from src/fabra/models/shared/connectiontype.py rename to src/fabra/models/components/connectiontype.py index 4ca6579..d18d197 --- a/src/fabra/models/shared/connectiontype.py +++ b/src/fabra/models/components/connectiontype.py @@ -3,6 +3,7 @@ from __future__ import annotations from enum import Enum + class ConnectionType(str, Enum): SNOWFLAKE = 'snowflake' BIGQUERY = 'bigquery' diff --git a/src/fabra/models/shared/createlinktokenrequest.py b/src/fabra/models/components/createlinktokenrequest.py old mode 100755 new mode 100644 similarity index 99% rename from src/fabra/models/shared/createlinktokenrequest.py rename to src/fabra/models/components/createlinktokenrequest.py index 5ca5630..e565f56 --- a/src/fabra/models/shared/createlinktokenrequest.py +++ b/src/fabra/models/components/createlinktokenrequest.py @@ -7,7 +7,6 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class CreateLinkTokenRequest: end_customer_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_customer_id') }}) diff --git a/src/fabra/models/shared/createlinktokenresponse.py b/src/fabra/models/components/createlinktokenresponse.py old mode 100755 new mode 100644 similarity index 92% rename from src/fabra/models/shared/createlinktokenresponse.py rename to src/fabra/models/components/createlinktokenresponse.py index 0dfeedf..6a5590a --- a/src/fabra/models/shared/createlinktokenresponse.py +++ b/src/fabra/models/components/createlinktokenresponse.py @@ -8,10 +8,8 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class CreateLinkTokenResponse: - r"""Successfully created link token""" link_token: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('link_token'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/shared/destination.py b/src/fabra/models/components/destination.py old mode 100755 new mode 100644 similarity index 72% rename from src/fabra/models/shared/destination.py rename to src/fabra/models/components/destination.py index cc87433..add2ead --- a/src/fabra/models/shared/destination.py +++ b/src/fabra/models/components/destination.py @@ -2,17 +2,16 @@ from __future__ import annotations import dataclasses -from ..shared import connection as shared_connection +from .connection import Connection from dataclasses_json import Undefined, dataclass_json from fabra import utils from typing import Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class Destination: - connection: Optional[shared_connection.Connection] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('connection'), 'exclude': lambda f: f is None }}) + connection: Optional[Connection] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('connection'), 'exclude': lambda f: f is None }}) display_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('display_name'), 'exclude': lambda f: f is None }}) id: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('id'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/components/destinationinput.py b/src/fabra/models/components/destinationinput.py new file mode 100644 index 0000000..92d51da --- /dev/null +++ b/src/fabra/models/components/destinationinput.py @@ -0,0 +1,25 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +from .bigqueryconfig import BigQueryConfig +from .connectiontype import ConnectionType +from .mongodbconfig import MongoDbConfig +from .redshiftconfig import RedshiftConfig +from .snowflakeconfig import SnowflakeConfig +from dataclasses_json import Undefined, dataclass_json +from fabra import utils +from typing import Optional + + +@dataclass_json(undefined=Undefined.EXCLUDE) +@dataclasses.dataclass +class DestinationInput: + connection_type: ConnectionType = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('connection_type') }}) + display_name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('display_name') }}) + bigquery_config: Optional[BigQueryConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('bigquery_config'), 'exclude': lambda f: f is None }}) + mongodb_config: Optional[MongoDbConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('mongodb_config'), 'exclude': lambda f: f is None }}) + redshift_config: Optional[RedshiftConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('redshift_config'), 'exclude': lambda f: f is None }}) + snowflake_config: Optional[SnowflakeConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('snowflake_config'), 'exclude': lambda f: f is None }}) + + diff --git a/src/fabra/models/shared/field.py b/src/fabra/models/components/field.py old mode 100755 new mode 100644 similarity index 66% rename from src/fabra/models/shared/field.py rename to src/fabra/models/components/field.py index 7dbd231..34d7383 --- a/src/fabra/models/shared/field.py +++ b/src/fabra/models/components/field.py @@ -2,17 +2,16 @@ from __future__ import annotations import dataclasses -from ..shared import fieldtype as shared_fieldtype +from .fieldtype import FieldType from dataclasses_json import Undefined, dataclass_json from fabra import utils from typing import Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class Field: name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('name'), 'exclude': lambda f: f is None }}) - type: Optional[shared_fieldtype.FieldType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type'), 'exclude': lambda f: f is None }}) + type: Optional[FieldType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/shared/fieldmapping.py b/src/fabra/models/components/fieldmapping.py old mode 100755 new mode 100644 similarity index 99% rename from src/fabra/models/shared/fieldmapping.py rename to src/fabra/models/components/fieldmapping.py index 2756ef3..0c8d777 --- a/src/fabra/models/shared/fieldmapping.py +++ b/src/fabra/models/components/fieldmapping.py @@ -8,7 +8,6 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class FieldMapping: destination_field_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('destination_field_name'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/shared/fieldtype.py b/src/fabra/models/components/fieldtype.py old mode 100755 new mode 100644 similarity index 99% rename from src/fabra/models/shared/fieldtype.py rename to src/fabra/models/components/fieldtype.py index aa0a801..d28e29b --- a/src/fabra/models/shared/fieldtype.py +++ b/src/fabra/models/components/fieldtype.py @@ -3,6 +3,7 @@ from __future__ import annotations from enum import Enum + class FieldType(str, Enum): STRING = 'string' INTEGER = 'integer' diff --git a/src/fabra/models/shared/frequencyunits.py b/src/fabra/models/components/frequencyunits.py old mode 100755 new mode 100644 similarity index 99% rename from src/fabra/models/shared/frequencyunits.py rename to src/fabra/models/components/frequencyunits.py index 256789d..1a8922b --- a/src/fabra/models/shared/frequencyunits.py +++ b/src/fabra/models/components/frequencyunits.py @@ -3,6 +3,7 @@ from __future__ import annotations from enum import Enum + class FrequencyUnits(str, Enum): MINUTES = 'minutes' HOURS = 'hours' diff --git a/src/fabra/models/components/httpmetadata.py b/src/fabra/models/components/httpmetadata.py new file mode 100644 index 0000000..5a87cb4 --- /dev/null +++ b/src/fabra/models/components/httpmetadata.py @@ -0,0 +1,17 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +import requests as requests_http +from dataclasses_json import Undefined, dataclass_json + + +@dataclass_json(undefined=Undefined.EXCLUDE) +@dataclasses.dataclass +class HTTPMetadata: + response: requests_http.Response = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + r"""Raw HTTP response; suitable for custom response parsing""" + request: requests_http.Request = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + r"""Raw HTTP request; suitable for debugging""" + + diff --git a/src/fabra/models/shared/mongodbconfig.py b/src/fabra/models/components/mongodbconfig.py old mode 100755 new mode 100644 similarity index 99% rename from src/fabra/models/shared/mongodbconfig.py rename to src/fabra/models/components/mongodbconfig.py index 2500a9e..749acc0 --- a/src/fabra/models/shared/mongodbconfig.py +++ b/src/fabra/models/components/mongodbconfig.py @@ -8,7 +8,6 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class MongoDbConfig: host: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('host') }}) diff --git a/src/fabra/models/shared/namespaces.py b/src/fabra/models/components/namespaces.py old mode 100755 new mode 100644 similarity index 75% rename from src/fabra/models/shared/namespaces.py rename to src/fabra/models/components/namespaces.py index 020c341..d03d5ad --- a/src/fabra/models/shared/namespaces.py +++ b/src/fabra/models/components/namespaces.py @@ -4,14 +4,12 @@ import dataclasses from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional +from typing import List, Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class Namespaces: - r"""Successfully fetched namespaces""" - namespaces: Optional[list[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('namespaces'), 'exclude': lambda f: f is None }}) + namespaces: Optional[List[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('namespaces'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/shared/object.py b/src/fabra/models/components/object.py old mode 100755 new mode 100644 similarity index 83% rename from src/fabra/models/shared/object.py rename to src/fabra/models/components/object.py index cd30b07..c21587a --- a/src/fabra/models/shared/object.py +++ b/src/fabra/models/components/object.py @@ -2,14 +2,13 @@ from __future__ import annotations import dataclasses -from ..shared import objectfield as shared_objectfield +from .objectfield import ObjectField from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional +from typing import List, Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class Object: destination_id: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('destination_id'), 'exclude': lambda f: f is None }}) @@ -18,7 +17,7 @@ class Object: r"""This is where Fabra will insert the End Customer ID specified in the sync configuration""" id: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('id'), 'exclude': lambda f: f is None }}) namespace: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('namespace'), 'exclude': lambda f: f is None }}) - object_fields: Optional[list[shared_objectfield.ObjectField]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('object_fields'), 'exclude': lambda f: f is None }}) + object_fields: Optional[List[ObjectField]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('object_fields'), 'exclude': lambda f: f is None }}) table_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('table_name'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/shared/objectfield.py b/src/fabra/models/components/objectfield.py old mode 100755 new mode 100644 similarity index 67% rename from src/fabra/models/shared/objectfield.py rename to src/fabra/models/components/objectfield.py index fedc4fc..9a6a70d --- a/src/fabra/models/shared/objectfield.py +++ b/src/fabra/models/components/objectfield.py @@ -2,17 +2,16 @@ from __future__ import annotations import dataclasses -from ..shared import fieldtype as shared_fieldtype +from .fieldtype import FieldType from dataclasses_json import Undefined, dataclass_json from fabra import utils from typing import Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class ObjectField: name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('name'), 'exclude': lambda f: f is None }}) - type: Optional[shared_fieldtype.FieldType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type'), 'exclude': lambda f: f is None }}) + type: Optional[FieldType] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('type'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/shared/objectinput.py b/src/fabra/models/components/objectinput.py old mode 100755 new mode 100644 similarity index 74% rename from src/fabra/models/shared/objectinput.py rename to src/fabra/models/components/objectinput.py index f42c59a..dd68ac5 --- a/src/fabra/models/shared/objectinput.py +++ b/src/fabra/models/components/objectinput.py @@ -2,15 +2,14 @@ from __future__ import annotations import dataclasses -from ..shared import frequencyunits as shared_frequencyunits -from ..shared import objectfield as shared_objectfield +from .frequencyunits import FrequencyUnits +from .objectfield import ObjectField from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional +from typing import List, Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class ObjectInput: destination_id: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('destination_id') }}) @@ -18,11 +17,11 @@ class ObjectInput: end_customer_id_field: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_customer_id_field') }}) r"""This is where Fabra will insert the End Customer ID specified when creating a source.""" frequency: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('frequency') }}) - frequency_units: shared_frequencyunits.FrequencyUnits = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('frequency_units') }}) + frequency_units: FrequencyUnits = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('frequency_units') }}) namespace: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('namespace') }}) table_name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('table_name') }}) cursor_field: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('cursor_field'), 'exclude': lambda f: f is None }}) - object_fields: Optional[list[shared_objectfield.ObjectField]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('object_fields'), 'exclude': lambda f: f is None }}) + object_fields: Optional[List[ObjectField]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('object_fields'), 'exclude': lambda f: f is None }}) primary_key: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('primary_key'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/shared/queryfilter.py b/src/fabra/models/components/queryfilter.py old mode 100755 new mode 100644 similarity index 99% rename from src/fabra/models/shared/queryfilter.py rename to src/fabra/models/components/queryfilter.py index a224db1..1bd89d3 --- a/src/fabra/models/shared/queryfilter.py +++ b/src/fabra/models/components/queryfilter.py @@ -7,7 +7,6 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class QueryFilter: field_name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('field_name') }}) diff --git a/src/fabra/models/shared/redshiftconfig.py b/src/fabra/models/components/redshiftconfig.py old mode 100755 new mode 100644 similarity index 99% rename from src/fabra/models/shared/redshiftconfig.py rename to src/fabra/models/components/redshiftconfig.py index b5bafe7..6f8a6f1 --- a/src/fabra/models/shared/redshiftconfig.py +++ b/src/fabra/models/components/redshiftconfig.py @@ -7,7 +7,6 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class RedshiftConfig: database_name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('database_name') }}) diff --git a/src/fabra/models/shared/security.py b/src/fabra/models/components/security.py old mode 100755 new mode 100644 similarity index 99% rename from src/fabra/models/shared/security.py rename to src/fabra/models/components/security.py index 4d93a03..c1a10e8 --- a/src/fabra/models/shared/security.py +++ b/src/fabra/models/components/security.py @@ -4,7 +4,6 @@ import dataclasses - @dataclasses.dataclass class Security: api_key_auth: str = dataclasses.field(metadata={'security': { 'scheme': True, 'type': 'apiKey', 'sub_type': 'header', 'field_name': 'X-API-KEY' }}) diff --git a/src/fabra/models/shared/snowflakeconfig.py b/src/fabra/models/components/snowflakeconfig.py old mode 100755 new mode 100644 similarity index 99% rename from src/fabra/models/shared/snowflakeconfig.py rename to src/fabra/models/components/snowflakeconfig.py index f6698d1..e31a529 --- a/src/fabra/models/shared/snowflakeconfig.py +++ b/src/fabra/models/components/snowflakeconfig.py @@ -7,7 +7,6 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class SnowflakeConfig: database_name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('database_name') }}) diff --git a/src/fabra/models/shared/source.py b/src/fabra/models/components/source.py old mode 100755 new mode 100644 similarity index 76% rename from src/fabra/models/shared/source.py rename to src/fabra/models/components/source.py index 49859c0..8eab68a --- a/src/fabra/models/shared/source.py +++ b/src/fabra/models/components/source.py @@ -2,17 +2,16 @@ from __future__ import annotations import dataclasses -from ..shared import connection as shared_connection +from .connection import Connection from dataclasses_json import Undefined, dataclass_json from fabra import utils from typing import Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class Source: - connection: Optional[shared_connection.Connection] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('connection'), 'exclude': lambda f: f is None }}) + connection: Optional[Connection] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('connection'), 'exclude': lambda f: f is None }}) display_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('display_name'), 'exclude': lambda f: f is None }}) end_customer_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_customer_id'), 'exclude': lambda f: f is None }}) id: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('id'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/components/sourceinput.py b/src/fabra/models/components/sourceinput.py new file mode 100644 index 0000000..987101f --- /dev/null +++ b/src/fabra/models/components/sourceinput.py @@ -0,0 +1,26 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from __future__ import annotations +import dataclasses +from .bigqueryconfig import BigQueryConfig +from .connectiontype import ConnectionType +from .mongodbconfig import MongoDbConfig +from .redshiftconfig import RedshiftConfig +from .snowflakeconfig import SnowflakeConfig +from dataclasses_json import Undefined, dataclass_json +from fabra import utils +from typing import Optional + + +@dataclass_json(undefined=Undefined.EXCLUDE) +@dataclasses.dataclass +class SourceInput: + connection_type: ConnectionType = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('connection_type') }}) + display_name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('display_name') }}) + end_customer_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_customer_id') }}) + bigquery_config: Optional[BigQueryConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('bigquery_config'), 'exclude': lambda f: f is None }}) + mongodb_config: Optional[MongoDbConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('mongodb_config'), 'exclude': lambda f: f is None }}) + redshift_config: Optional[RedshiftConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('redshift_config'), 'exclude': lambda f: f is None }}) + snowflake_config: Optional[SnowflakeConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('snowflake_config'), 'exclude': lambda f: f is None }}) + + diff --git a/src/fabra/models/shared/sync.py b/src/fabra/models/components/sync.py old mode 100755 new mode 100644 similarity index 80% rename from src/fabra/models/shared/sync.py rename to src/fabra/models/components/sync.py index 8c43f39..6076a8b --- a/src/fabra/models/shared/sync.py +++ b/src/fabra/models/components/sync.py @@ -2,15 +2,14 @@ from __future__ import annotations import dataclasses -from ..shared import fieldmapping as shared_fieldmapping -from ..shared import frequencyunits as shared_frequencyunits +from .fieldmapping import FieldMapping +from .frequencyunits import FrequencyUnits from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional +from typing import List, Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class Sync: cursor_field: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('cursor_field'), 'exclude': lambda f: f is None }}) @@ -18,9 +17,9 @@ class Sync: destination_id: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('destination_id'), 'exclude': lambda f: f is None }}) display_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('display_name'), 'exclude': lambda f: f is None }}) end_customer_id: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_customer_id'), 'exclude': lambda f: f is None }}) - field_mappings: Optional[list[shared_fieldmapping.FieldMapping]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('field_mappings'), 'exclude': lambda f: f is None }}) + field_mappings: Optional[List[FieldMapping]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('field_mappings'), 'exclude': lambda f: f is None }}) frequency: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('frequency'), 'exclude': lambda f: f is None }}) - frequency_units: Optional[shared_frequencyunits.FrequencyUnits] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('frequency_units'), 'exclude': lambda f: f is None }}) + frequency_units: Optional[FrequencyUnits] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('frequency_units'), 'exclude': lambda f: f is None }}) id: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('id'), 'exclude': lambda f: f is None }}) namespace: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('namespace'), 'exclude': lambda f: f is None }}) object_id: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('object_id'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/shared/syncinput.py b/src/fabra/models/components/syncinput.py old mode 100755 new mode 100644 similarity index 79% rename from src/fabra/models/shared/syncinput.py rename to src/fabra/models/components/syncinput.py index 7136816..eddb413 --- a/src/fabra/models/shared/syncinput.py +++ b/src/fabra/models/components/syncinput.py @@ -2,27 +2,26 @@ from __future__ import annotations import dataclasses -from ..shared import fieldmapping as shared_fieldmapping -from ..shared import frequencyunits as shared_frequencyunits +from .fieldmapping import FieldMapping +from .frequencyunits import FrequencyUnits from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional +from typing import List, Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class SyncInput: destination_id: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('destination_id') }}) display_name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('display_name') }}) end_customer_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_customer_id') }}) - field_mappings: list[shared_fieldmapping.FieldMapping] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('field_mappings') }}) + field_mappings: List[FieldMapping] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('field_mappings') }}) object_id: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('object_id') }}) source_id: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('source_id') }}) cursor_field: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('cursor_field'), 'exclude': lambda f: f is None }}) custom_join: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('custom_join'), 'exclude': lambda f: f is None }}) frequency: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('frequency'), 'exclude': lambda f: f is None }}) - frequency_units: Optional[shared_frequencyunits.FrequencyUnits] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('frequency_units'), 'exclude': lambda f: f is None }}) + frequency_units: Optional[FrequencyUnits] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('frequency_units'), 'exclude': lambda f: f is None }}) namespace: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('namespace'), 'exclude': lambda f: f is None }}) primary_key: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('primary_key'), 'exclude': lambda f: f is None }}) table_name: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('table_name'), 'exclude': lambda f: f is None }}) diff --git a/src/fabra/models/errors/__init__.py b/src/fabra/models/errors/__init__.py new file mode 100644 index 0000000..88d0916 --- /dev/null +++ b/src/fabra/models/errors/__init__.py @@ -0,0 +1,5 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from .sdkerror import * + +__all__ = ["SDKError"] diff --git a/src/fabra/models/errors/sdkerror.py b/src/fabra/models/errors/sdkerror.py new file mode 100644 index 0000000..6bb02bb --- /dev/null +++ b/src/fabra/models/errors/sdkerror.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +import requests as requests_http + + +class SDKError(Exception): + """Represents an error returned by the API.""" + message: str + status_code: int + body: str + raw_response: requests_http.Response + + def __init__(self, message: str, status_code: int, body: str, raw_response: requests_http.Response): + self.message = message + self.status_code = status_code + self.body = body + self.raw_response = raw_response + + def __str__(self): + body = '' + if len(self.body) > 0: + body = f'\n{self.body}' + + return f'{self.message}: Status {self.status_code}{body}' diff --git a/src/fabra/models/operations/__init__.py b/src/fabra/models/operations/__init__.py old mode 100755 new mode 100644 index 9ef4ab7..77f978a --- a/src/fabra/models/operations/__init__.py +++ b/src/fabra/models/operations/__init__.py @@ -14,4 +14,4 @@ from .get_tables import * from .query_object import * -__all__ = ["CreateDestination200ApplicationJSON","CreateDestinationResponse","CreateLinkTokenResponse","CreateObject200ApplicationJSON","CreateObjectResponse","CreateSource200ApplicationJSON","CreateSourceResponse","CreateSync200ApplicationJSON","CreateSyncResponse","GetDestinations200ApplicationJSON","GetDestinationsResponse","GetNamespacesRequest","GetNamespacesResponse","GetObjects200ApplicationJSON","GetObjectsResponse","GetSchema200ApplicationJSON","GetSchemaRequest","GetSchemaResponse","GetSources200ApplicationJSON","GetSourcesResponse","GetSyncs200ApplicationJSON","GetSyncsResponse","GetTables200ApplicationJSON","GetTablesRequest","GetTablesResponse","QueryObject200ApplicationJSON","QueryObject200ApplicationJSONExampleField3","QueryObjectRequest","QueryObjectRequestBody","QueryObjectResponse"] +__all__ = ["CreateDestinationResponse","CreateDestinationResponseBody","CreateLinkTokenResponse","CreateObjectResponse","CreateObjectResponseBody","CreateSourceResponse","CreateSourceResponseBody","CreateSyncResponse","CreateSyncResponseBody","ExampleField3","GetDestinationsResponse","GetDestinationsResponseBody","GetNamespacesRequest","GetNamespacesResponse","GetObjectsResponse","GetObjectsResponseBody","GetSchemaRequest","GetSchemaResponse","GetSchemaResponseBody","GetSourcesResponse","GetSourcesResponseBody","GetSyncsResponse","GetSyncsResponseBody","GetTablesRequest","GetTablesResponse","GetTablesResponseBody","QueryObjectRequest","QueryObjectRequestBody","QueryObjectResponse","QueryObjectResponseBody"] diff --git a/src/fabra/models/operations/create_destination.py b/src/fabra/models/operations/create_destination.py old mode 100755 new mode 100644 index 5399c44..268934c --- a/src/fabra/models/operations/create_destination.py +++ b/src/fabra/models/operations/create_destination.py @@ -2,30 +2,27 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import destination as shared_destination +from ...models.components import destination as components_destination +from ...models.components import httpmetadata as components_httpmetadata from dataclasses_json import Undefined, dataclass_json from fabra import utils from typing import Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class CreateDestination200ApplicationJSON: +class CreateDestinationResponseBody: r"""Successfully created destination""" - destination: Optional[shared_destination.Destination] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('destination'), 'exclude': lambda f: f is None }}) + destination: Optional[components_destination.Destination] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('destination'), 'exclude': lambda f: f is None }}) - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class CreateDestinationResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - create_destination_200_application_json_object: Optional[CreateDestination200ApplicationJSON] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + object: Optional[CreateDestinationResponseBody] = dataclasses.field(default=None) r"""Successfully created destination""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/create_link_token.py b/src/fabra/models/operations/create_link_token.py old mode 100755 new mode 100644 index 75b8ee2..c1ad415 --- a/src/fabra/models/operations/create_link_token.py +++ b/src/fabra/models/operations/create_link_token.py @@ -2,18 +2,17 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import createlinktokenresponse as shared_createlinktokenresponse +from ...models.components import createlinktokenresponse as components_createlinktokenresponse +from ...models.components import httpmetadata as components_httpmetadata +from dataclasses_json import Undefined, dataclass_json from typing import Optional - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class CreateLinkTokenResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - create_link_token_response: Optional[shared_createlinktokenresponse.CreateLinkTokenResponse] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + create_link_token_response: Optional[components_createlinktokenresponse.CreateLinkTokenResponse] = dataclasses.field(default=None) r"""Successfully created link token""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/create_object.py b/src/fabra/models/operations/create_object.py old mode 100755 new mode 100644 index 6cf0dc0..3023b81 --- a/src/fabra/models/operations/create_object.py +++ b/src/fabra/models/operations/create_object.py @@ -2,30 +2,27 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import object as shared_object +from ...models.components import httpmetadata as components_httpmetadata +from ...models.components import object as components_object from dataclasses_json import Undefined, dataclass_json from fabra import utils from typing import Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class CreateObject200ApplicationJSON: +class CreateObjectResponseBody: r"""Successfully created object""" - object: Optional[shared_object.Object] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('object'), 'exclude': lambda f: f is None }}) + object: Optional[components_object.Object] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('object'), 'exclude': lambda f: f is None }}) - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class CreateObjectResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - create_object_200_application_json_object: Optional[CreateObject200ApplicationJSON] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + object: Optional[CreateObjectResponseBody] = dataclasses.field(default=None) r"""Successfully created object""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/create_source.py b/src/fabra/models/operations/create_source.py old mode 100755 new mode 100644 index 3013645..e582dc3 --- a/src/fabra/models/operations/create_source.py +++ b/src/fabra/models/operations/create_source.py @@ -2,30 +2,27 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import source as shared_source +from ...models.components import httpmetadata as components_httpmetadata +from ...models.components import source as components_source from dataclasses_json import Undefined, dataclass_json from fabra import utils from typing import Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class CreateSource200ApplicationJSON: +class CreateSourceResponseBody: r"""Successfully created source""" - source: Optional[shared_source.Source] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('source'), 'exclude': lambda f: f is None }}) + source: Optional[components_source.Source] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('source'), 'exclude': lambda f: f is None }}) - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class CreateSourceResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - create_source_200_application_json_object: Optional[CreateSource200ApplicationJSON] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + object: Optional[CreateSourceResponseBody] = dataclasses.field(default=None) r"""Successfully created source""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/create_sync.py b/src/fabra/models/operations/create_sync.py old mode 100755 new mode 100644 index f71d5a1..c2f33bf --- a/src/fabra/models/operations/create_sync.py +++ b/src/fabra/models/operations/create_sync.py @@ -2,30 +2,27 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import sync as shared_sync +from ...models.components import httpmetadata as components_httpmetadata +from ...models.components import sync as components_sync from dataclasses_json import Undefined, dataclass_json from fabra import utils from typing import Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class CreateSync200ApplicationJSON: +class CreateSyncResponseBody: r"""Successfully created sync""" - sync: Optional[shared_sync.Sync] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('sync'), 'exclude': lambda f: f is None }}) + sync: Optional[components_sync.Sync] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('sync'), 'exclude': lambda f: f is None }}) - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class CreateSyncResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - create_sync_200_application_json_object: Optional[CreateSync200ApplicationJSON] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + object: Optional[CreateSyncResponseBody] = dataclasses.field(default=None) r"""Successfully created sync""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/get_destinations.py b/src/fabra/models/operations/get_destinations.py old mode 100755 new mode 100644 index 0036b50..c8ba23c --- a/src/fabra/models/operations/get_destinations.py +++ b/src/fabra/models/operations/get_destinations.py @@ -2,30 +2,27 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import destination as shared_destination +from ...models.components import destination as components_destination +from ...models.components import httpmetadata as components_httpmetadata from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional +from typing import List, Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class GetDestinations200ApplicationJSON: +class GetDestinationsResponseBody: r"""Successfully fetched destinations""" - destinations: Optional[list[shared_destination.Destination]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('destinations'), 'exclude': lambda f: f is None }}) + destinations: Optional[List[components_destination.Destination]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('destinations'), 'exclude': lambda f: f is None }}) - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class GetDestinationsResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - get_destinations_200_application_json_object: Optional[GetDestinations200ApplicationJSON] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + object: Optional[GetDestinationsResponseBody] = dataclasses.field(default=None) r"""Successfully fetched destinations""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/get_namespaces.py b/src/fabra/models/operations/get_namespaces.py old mode 100755 new mode 100644 index 128addc..a7beeee --- a/src/fabra/models/operations/get_namespaces.py +++ b/src/fabra/models/operations/get_namespaces.py @@ -2,12 +2,12 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import namespaces as shared_namespaces +from ...models.components import httpmetadata as components_httpmetadata +from ...models.components import namespaces as components_namespaces +from dataclasses_json import Undefined, dataclass_json from typing import Optional - @dataclasses.dataclass class GetNamespacesRequest: connection_id: int = dataclasses.field(metadata={'query_param': { 'field_name': 'connectionID', 'style': 'form', 'explode': True }}) @@ -15,13 +15,11 @@ class GetNamespacesRequest: - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class GetNamespacesResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - namespaces: Optional[shared_namespaces.Namespaces] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + namespaces: Optional[components_namespaces.Namespaces] = dataclasses.field(default=None) r"""Successfully fetched namespaces""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/get_objects.py b/src/fabra/models/operations/get_objects.py old mode 100755 new mode 100644 index 14668f2..a2d95c3 --- a/src/fabra/models/operations/get_objects.py +++ b/src/fabra/models/operations/get_objects.py @@ -2,30 +2,27 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import object as shared_object +from ...models.components import httpmetadata as components_httpmetadata +from ...models.components import object as components_object from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional +from typing import List, Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class GetObjects200ApplicationJSON: +class GetObjectsResponseBody: r"""Successfully fetched objects""" - objects: Optional[list[shared_object.Object]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('objects'), 'exclude': lambda f: f is None }}) + objects: Optional[List[components_object.Object]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('objects'), 'exclude': lambda f: f is None }}) - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class GetObjectsResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - get_objects_200_application_json_object: Optional[GetObjects200ApplicationJSON] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + object: Optional[GetObjectsResponseBody] = dataclasses.field(default=None) r"""Successfully fetched objects""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/get_schema.py b/src/fabra/models/operations/get_schema.py old mode 100755 new mode 100644 index a1e3b43..50c9506 --- a/src/fabra/models/operations/get_schema.py +++ b/src/fabra/models/operations/get_schema.py @@ -2,12 +2,11 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import field as shared_field +from ...models.components import field as components_field +from ...models.components import httpmetadata as components_httpmetadata from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional - +from typing import List, Optional @dataclasses.dataclass @@ -20,22 +19,19 @@ class GetSchemaRequest: @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class GetSchema200ApplicationJSON: +class GetSchemaResponseBody: r"""Successfully fetched schema""" - schema: Optional[list[shared_field.Field]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('schema'), 'exclude': lambda f: f is None }}) + schema: Optional[List[components_field.Field]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('schema'), 'exclude': lambda f: f is None }}) - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class GetSchemaResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - get_schema_200_application_json_object: Optional[GetSchema200ApplicationJSON] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + object: Optional[GetSchemaResponseBody] = dataclasses.field(default=None) r"""Successfully fetched schema""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/get_sources.py b/src/fabra/models/operations/get_sources.py old mode 100755 new mode 100644 index 5672f1b..dae568e --- a/src/fabra/models/operations/get_sources.py +++ b/src/fabra/models/operations/get_sources.py @@ -2,30 +2,27 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import source as shared_source +from ...models.components import httpmetadata as components_httpmetadata +from ...models.components import source as components_source from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional +from typing import List, Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class GetSources200ApplicationJSON: +class GetSourcesResponseBody: r"""Successfully fetched sources""" - sources: Optional[list[shared_source.Source]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('sources'), 'exclude': lambda f: f is None }}) + sources: Optional[List[components_source.Source]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('sources'), 'exclude': lambda f: f is None }}) - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class GetSourcesResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - get_sources_200_application_json_object: Optional[GetSources200ApplicationJSON] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + object: Optional[GetSourcesResponseBody] = dataclasses.field(default=None) r"""Successfully fetched sources""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/get_syncs.py b/src/fabra/models/operations/get_syncs.py old mode 100755 new mode 100644 index 6b85c64..b625ec9 --- a/src/fabra/models/operations/get_syncs.py +++ b/src/fabra/models/operations/get_syncs.py @@ -2,30 +2,27 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import sync as shared_sync +from ...models.components import httpmetadata as components_httpmetadata +from ...models.components import sync as components_sync from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional +from typing import List, Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class GetSyncs200ApplicationJSON: +class GetSyncsResponseBody: r"""Successfully fetched syncs""" - syncs: Optional[list[shared_sync.Sync]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('syncs'), 'exclude': lambda f: f is None }}) + syncs: Optional[List[components_sync.Sync]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('syncs'), 'exclude': lambda f: f is None }}) - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class GetSyncsResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - get_syncs_200_application_json_object: Optional[GetSyncs200ApplicationJSON] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + object: Optional[GetSyncsResponseBody] = dataclasses.field(default=None) r"""Successfully fetched syncs""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/get_tables.py b/src/fabra/models/operations/get_tables.py old mode 100755 new mode 100644 index e0e396f..0a8f5c1 --- a/src/fabra/models/operations/get_tables.py +++ b/src/fabra/models/operations/get_tables.py @@ -2,11 +2,10 @@ from __future__ import annotations import dataclasses -import requests as requests_http +from ...models.components import httpmetadata as components_httpmetadata from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional - +from typing import List, Optional @dataclasses.dataclass @@ -18,22 +17,19 @@ class GetTablesRequest: @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class GetTables200ApplicationJSON: +class GetTablesResponseBody: r"""Successfully fetched tables""" - tables: Optional[list[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('tables'), 'exclude': lambda f: f is None }}) + tables: Optional[List[str]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('tables'), 'exclude': lambda f: f is None }}) - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class GetTablesResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - get_tables_200_application_json_object: Optional[GetTables200ApplicationJSON] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + object: Optional[GetTablesResponseBody] = dataclasses.field(default=None) r"""Successfully fetched tables""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/operations/query_object.py b/src/fabra/models/operations/query_object.py old mode 100755 new mode 100644 index c47c19a..ceaf649 --- a/src/fabra/models/operations/query_object.py +++ b/src/fabra/models/operations/query_object.py @@ -2,23 +2,21 @@ from __future__ import annotations import dataclasses -import requests as requests_http -from ..shared import queryfilter as shared_queryfilter +from ...models.components import httpmetadata as components_httpmetadata +from ...models.components import queryfilter as components_queryfilter from dataclasses_json import Undefined, dataclass_json from fabra import utils -from typing import Optional +from typing import List, Optional @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class QueryObjectRequestBody: - filters: Optional[list[shared_queryfilter.QueryFilter]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('filters'), 'exclude': lambda f: f is None }}) + filters: Optional[List[components_queryfilter.QueryFilter]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('filters'), 'exclude': lambda f: f is None }}) - @dataclasses.dataclass class QueryObjectRequest: end_customer_id: str = dataclasses.field(metadata={'path_param': { 'field_name': 'endCustomerID', 'style': 'simple', 'explode': False }}) @@ -29,9 +27,8 @@ class QueryObjectRequest: @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class QueryObject200ApplicationJSONExampleField3: +class ExampleField3: nested_field_1: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('nested_field_1'), 'exclude': lambda f: f is None }}) nested_field_2: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('nested_field_2'), 'exclude': lambda f: f is None }}) @@ -39,24 +36,21 @@ class QueryObject200ApplicationJSONExampleField3: @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass -class QueryObject200ApplicationJSON: +class QueryObjectResponseBody: r"""The response payload will match the schema you defined when creating the object""" example_field_1: Optional[int] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('example_field_1'), 'exclude': lambda f: f is None }}) example_field_2: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('example_field_2'), 'exclude': lambda f: f is None }}) - example_field_3: Optional[QueryObject200ApplicationJSONExampleField3] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('example_field_3'), 'exclude': lambda f: f is None }}) + example_field_3: Optional[ExampleField3] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('example_field_3'), 'exclude': lambda f: f is None }}) - +@dataclass_json(undefined=Undefined.EXCLUDE) @dataclasses.dataclass class QueryObjectResponse: - content_type: str = dataclasses.field() - status_code: int = dataclasses.field() - query_object_200_application_json_object: Optional[QueryObject200ApplicationJSON] = dataclasses.field(default=None) + http_meta: components_httpmetadata.HTTPMetadata = dataclasses.field(metadata={'dataclasses_json': { 'exclude': lambda f: True }}) + object: Optional[QueryObjectResponseBody] = dataclasses.field(default=None) r"""The response payload will match the schema you defined when creating the object""" - raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) diff --git a/src/fabra/models/shared/destinationinput.py b/src/fabra/models/shared/destinationinput.py deleted file mode 100755 index e986e18..0000000 --- a/src/fabra/models/shared/destinationinput.py +++ /dev/null @@ -1,26 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" - -from __future__ import annotations -import dataclasses -from ..shared import bigqueryconfig as shared_bigqueryconfig -from ..shared import connectiontype as shared_connectiontype -from ..shared import mongodbconfig as shared_mongodbconfig -from ..shared import redshiftconfig as shared_redshiftconfig -from ..shared import snowflakeconfig as shared_snowflakeconfig -from dataclasses_json import Undefined, dataclass_json -from fabra import utils -from typing import Optional - - -@dataclass_json(undefined=Undefined.EXCLUDE) - -@dataclasses.dataclass -class DestinationInput: - connection_type: shared_connectiontype.ConnectionType = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('connection_type') }}) - display_name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('display_name') }}) - bigquery_config: Optional[shared_bigqueryconfig.BigQueryConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('bigquery_config'), 'exclude': lambda f: f is None }}) - mongodb_config: Optional[shared_mongodbconfig.MongoDbConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('mongodb_config'), 'exclude': lambda f: f is None }}) - redshift_config: Optional[shared_redshiftconfig.RedshiftConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('redshift_config'), 'exclude': lambda f: f is None }}) - snowflake_config: Optional[shared_snowflakeconfig.SnowflakeConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('snowflake_config'), 'exclude': lambda f: f is None }}) - - diff --git a/src/fabra/models/shared/sourceinput.py b/src/fabra/models/shared/sourceinput.py deleted file mode 100755 index 1a2b804..0000000 --- a/src/fabra/models/shared/sourceinput.py +++ /dev/null @@ -1,27 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" - -from __future__ import annotations -import dataclasses -from ..shared import bigqueryconfig as shared_bigqueryconfig -from ..shared import connectiontype as shared_connectiontype -from ..shared import mongodbconfig as shared_mongodbconfig -from ..shared import redshiftconfig as shared_redshiftconfig -from ..shared import snowflakeconfig as shared_snowflakeconfig -from dataclasses_json import Undefined, dataclass_json -from fabra import utils -from typing import Optional - - -@dataclass_json(undefined=Undefined.EXCLUDE) - -@dataclasses.dataclass -class SourceInput: - connection_type: shared_connectiontype.ConnectionType = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('connection_type') }}) - display_name: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('display_name') }}) - end_customer_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('end_customer_id') }}) - bigquery_config: Optional[shared_bigqueryconfig.BigQueryConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('bigquery_config'), 'exclude': lambda f: f is None }}) - mongodb_config: Optional[shared_mongodbconfig.MongoDbConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('mongodb_config'), 'exclude': lambda f: f is None }}) - redshift_config: Optional[shared_redshiftconfig.RedshiftConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('redshift_config'), 'exclude': lambda f: f is None }}) - snowflake_config: Optional[shared_snowflakeconfig.SnowflakeConfig] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('snowflake_config'), 'exclude': lambda f: f is None }}) - - diff --git a/src/fabra/object.py b/src/fabra/object.py old mode 100755 new mode 100644 index 4ec71f3..28a72bd --- a/src/fabra/object.py +++ b/src/fabra/object.py @@ -1,8 +1,10 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" +import requests as requests_http from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext +from fabra.models import components, errors, operations from typing import Optional class Object: @@ -13,60 +15,119 @@ def __init__(self, sdk_config: SDKConfiguration) -> None: self.sdk_configuration = sdk_config - def create_object(self, request: shared.ObjectInput) -> operations.CreateObjectResponse: + + def create_object(self, request: components.ObjectInput) -> operations.CreateObjectResponse: r"""Create a new object""" + hook_ctx = HookContext(operation_id='create_object', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/object' - headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "request", 'json') - if req_content_type not in ('multipart/form-data', 'multipart/mixed'): + + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + req_content_type, data, form = utils.serialize_request_body(request, components.ObjectInput, "request", False, False, 'json') + if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'): headers['content-type'] = req_content_type if data is None and form is None: raise Exception('request body is required') headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - - client = self.sdk_configuration.security_client + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('POST', url, data=data, files=form, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.CreateObjectResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.CreateObjectResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[operations.CreateObject200ApplicationJSON]) - res.create_object_200_application_json_object = out - elif http_res.status_code in [401, 500]: - pass + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[operations.CreateObjectResponseBody]) + res.object = out + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res + def get_objects(self) -> operations.GetObjectsResponse: r"""Get all objects""" + hook_ctx = HookContext(operation_id='get_objects', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/objects' - headers = {} - headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - client = self.sdk_configuration.security_client + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + headers['Accept'] = 'application/json' + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('GET', url, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.GetObjectsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.GetObjectsResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[operations.GetObjects200ApplicationJSON]) - res.get_objects_200_application_json_object = out - elif http_res.status_code in [401, 500]: - pass + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[operations.GetObjectsResponseBody]) + res.object = out + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res - \ No newline at end of file + + diff --git a/src/fabra/sdk.py b/src/fabra/sdk.py old mode 100755 new mode 100644 index 24343a7..1639fc6 --- a/src/fabra/sdk.py +++ b/src/fabra/sdk.py @@ -9,8 +9,11 @@ from .sdkconfiguration import SDKConfiguration from .source import Source from .sync import Sync +from .utils.retries import RetryConfig from fabra import utils -from fabra.models import shared +from fabra._hooks import SDKHooks +from fabra.models import components +from typing import Callable, Dict, Optional, Union class Fabra: connection: Connection @@ -30,38 +33,63 @@ class Fabra: sdk_configuration: SDKConfiguration def __init__(self, - security: shared.Security = None, - server_idx: int = None, - server_url: str = None, - url_params: dict[str, str] = None, - client: requests_http.Session = None + api_key_auth: Union[str, Callable[[], str]], + server_idx: Optional[int] = None, + server_url: Optional[str] = None, + url_params: Optional[Dict[str, str]] = None, + client: Optional[requests_http.Session] = None, + retry_config: Optional[RetryConfig] = None ) -> None: """Instantiates the SDK configuring it with the provided parameters. - - :param security: The security details required for authentication - :type security: shared.Security + + :param api_key_auth: The api_key_auth required for authentication + :type api_key_auth: Union[str, Callable[[], str]] :param server_idx: The index of the server to use for all operations :type server_idx: int :param server_url: The server URL to use for all operations :type server_url: str :param url_params: Parameters to optionally template the server URL with - :type url_params: dict[str, str] + :type url_params: Dict[str, str] :param client: The requests.Session HTTP client to use for all operations - :type client: requests_http.Session + :type client: requests_http.Session + :param retry_config: The utils.RetryConfig to use globally + :type retry_config: RetryConfig """ if client is None: client = requests_http.Session() - - security_client = utils.configure_security_client(client, security) - + + if callable(api_key_auth): + def security(): + return components.Security(api_key_auth = api_key_auth()) + else: + security = components.Security(api_key_auth = api_key_auth) + if server_url is not None: if url_params is not None: server_url = utils.template_url(server_url, url_params) + + + self.sdk_configuration = SDKConfiguration( + client, + security, + server_url, + server_idx, + retry_config=retry_config + ) + + hooks = SDKHooks() + + current_server_url, *_ = self.sdk_configuration.get_server_details() + server_url, self.sdk_configuration.client = hooks.sdk_init(current_server_url, self.sdk_configuration.client) + if current_server_url != server_url: + self.sdk_configuration.server_url = server_url + + # pylint: disable=protected-access + self.sdk_configuration.__dict__['_hooks'] = hooks - self.sdk_configuration = SDKConfiguration(client, security_client, server_url, server_idx) - self._init_sdks() - + + def _init_sdks(self): self.connection = Connection(self.sdk_configuration) self.customer_data = CustomerData(self.sdk_configuration) @@ -70,4 +98,3 @@ def _init_sdks(self): self.object = Object(self.sdk_configuration) self.source = Source(self.sdk_configuration) self.sync = Sync(self.sdk_configuration) - \ No newline at end of file diff --git a/src/fabra/sdkconfiguration.py b/src/fabra/sdkconfiguration.py old mode 100755 new mode 100644 index d92dfa5..d63f81f --- a/src/fabra/sdkconfiguration.py +++ b/src/fabra/sdkconfiguration.py @@ -1,7 +1,13 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" -import requests + +import requests as requests_http +from ._hooks import SDKHooks +from .utils import utils +from .utils.retries import RetryConfig from dataclasses import dataclass +from fabra.models import components +from typing import Callable, Dict, Optional, Tuple, Union SERVERS = [ @@ -11,19 +17,28 @@ @dataclass class SDKConfiguration: - client: requests.Session - security_client: requests.Session - server_url: str = '' - server_idx: int = 0 + client: requests_http.Session + security: Union[components.Security,Callable[[], components.Security]] = None + server_url: Optional[str] = '' + server_idx: Optional[int] = 0 language: str = 'python' openapi_doc_version: str = '0.1.0' - sdk_version: str = '0.21.0' - gen_version: str = '2.41.4' + sdk_version: str = '0.22.0' + gen_version: str = '2.338.1' + user_agent: str = 'speakeasy-sdk/python 0.22.0 2.338.1 0.1.0 fabra' + retry_config: Optional[RetryConfig] = None + + def __post_init__(self): + self._hooks = SDKHooks() - def get_server_details(self) -> tuple[str, dict[str, str]]: - if self.server_url: - return self.server_url.removesuffix('/'), {} + def get_server_details(self) -> Tuple[str, Dict[str, str]]: + if self.server_url is not None and self.server_url != '': + return utils.remove_suffix(self.server_url, '/'), {} if self.server_idx is None: self.server_idx = 0 return SERVERS[self.server_idx], {} + + + def get_hooks(self) -> SDKHooks: + return self._hooks diff --git a/src/fabra/source.py b/src/fabra/source.py old mode 100755 new mode 100644 index 9920414..320f537 --- a/src/fabra/source.py +++ b/src/fabra/source.py @@ -1,8 +1,10 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" +import requests as requests_http from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext +from fabra.models import components, errors, operations from typing import Optional class Source: @@ -13,60 +15,119 @@ def __init__(self, sdk_config: SDKConfiguration) -> None: self.sdk_configuration = sdk_config - def create_source(self, request: shared.SourceInput) -> operations.CreateSourceResponse: + + def create_source(self, request: components.SourceInput) -> operations.CreateSourceResponse: r"""Create a new source""" + hook_ctx = HookContext(operation_id='create_source', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/source' - headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "request", 'json') - if req_content_type not in ('multipart/form-data', 'multipart/mixed'): + + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + req_content_type, data, form = utils.serialize_request_body(request, components.SourceInput, "request", False, False, 'json') + if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'): headers['content-type'] = req_content_type if data is None and form is None: raise Exception('request body is required') headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - - client = self.sdk_configuration.security_client + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('POST', url, data=data, files=form, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.CreateSourceResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.CreateSourceResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[operations.CreateSource200ApplicationJSON]) - res.create_source_200_application_json_object = out - elif http_res.status_code in [401, 500]: - pass + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[operations.CreateSourceResponseBody]) + res.object = out + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res + def get_sources(self) -> operations.GetSourcesResponse: r"""Get all sources""" + hook_ctx = HookContext(operation_id='get_sources', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/sources' - headers = {} - headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - client = self.sdk_configuration.security_client + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + headers['Accept'] = 'application/json' + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('GET', url, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.GetSourcesResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.GetSourcesResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[operations.GetSources200ApplicationJSON]) - res.get_sources_200_application_json_object = out - elif http_res.status_code in [401, 500]: - pass + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[operations.GetSourcesResponseBody]) + res.object = out + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res - \ No newline at end of file + + diff --git a/src/fabra/sync.py b/src/fabra/sync.py old mode 100755 new mode 100644 index fd9d6e7..f411d29 --- a/src/fabra/sync.py +++ b/src/fabra/sync.py @@ -1,8 +1,10 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" +import requests as requests_http from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext +from fabra.models import components, errors, operations from typing import Optional class Sync: @@ -13,60 +15,119 @@ def __init__(self, sdk_config: SDKConfiguration) -> None: self.sdk_configuration = sdk_config - def create_sync(self, request: shared.SyncInput) -> operations.CreateSyncResponse: + + def create_sync(self, request: components.SyncInput) -> operations.CreateSyncResponse: r"""Create a new sync""" + hook_ctx = HookContext(operation_id='create_sync', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/sync' - headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "request", 'json') - if req_content_type not in ('multipart/form-data', 'multipart/mixed'): + + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + req_content_type, data, form = utils.serialize_request_body(request, components.SyncInput, "request", False, False, 'json') + if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'): headers['content-type'] = req_content_type if data is None and form is None: raise Exception('request body is required') headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - - client = self.sdk_configuration.security_client + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('POST', url, data=data, files=form, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.CreateSyncResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.CreateSyncResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[operations.CreateSync200ApplicationJSON]) - res.create_sync_200_application_json_object = out - elif http_res.status_code in [401, 500]: - pass + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[operations.CreateSyncResponseBody]) + res.object = out + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res + def get_syncs(self) -> operations.GetSyncsResponse: r"""Get all syncs""" + hook_ctx = HookContext(operation_id='get_syncs', oauth2_scopes=[], security_source=self.sdk_configuration.security) base_url = utils.template_url(*self.sdk_configuration.get_server_details()) url = base_url + '/syncs' - headers = {} - headers['Accept'] = 'application/json' - headers['user-agent'] = f'speakeasy-sdk/{self.sdk_configuration.language} {self.sdk_configuration.sdk_version} {self.sdk_configuration.gen_version} {self.sdk_configuration.openapi_doc_version}' - client = self.sdk_configuration.security_client + if callable(self.sdk_configuration.security): + headers, query_params = utils.get_security(self.sdk_configuration.security()) + else: + headers, query_params = utils.get_security(self.sdk_configuration.security) + + headers['Accept'] = 'application/json' + headers['user-agent'] = self.sdk_configuration.user_agent + client = self.sdk_configuration.client - http_res = client.request('GET', url, headers=headers) - content_type = http_res.headers.get('Content-Type') + try: + req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers)) + req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req) + http_res = client.send(req) + except Exception as e: + _, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e) + if e is not None: + raise e - res = operations.GetSyncsResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) + if utils.match_status_codes(['401','4XX','500','5XX'], http_res.status_code): + result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None) + if e is not None: + raise e + if result is not None: + http_res = result + else: + http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res) + + + + res = operations.GetSyncsResponse(http_meta=components.HTTPMetadata(request=req, response=http_res)) if http_res.status_code == 200: - if utils.match_content_type(content_type, 'application/json'): - out = utils.unmarshal_json(http_res.text, Optional[operations.GetSyncs200ApplicationJSON]) - res.get_syncs_200_application_json_object = out - elif http_res.status_code in [401, 500]: - pass + # pylint: disable=no-else-return + if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'): + out = utils.unmarshal_json(http_res.text, Optional[operations.GetSyncsResponseBody]) + res.object = out + else: + content_type = http_res.headers.get('Content-Type') + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) + elif http_res.status_code == 401 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600: + raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res) + else: + raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res) return res - \ No newline at end of file + + diff --git a/src/fabra/utils/__init__.py b/src/fabra/utils/__init__.py old mode 100755 new mode 100644 diff --git a/src/fabra/utils/retries.py b/src/fabra/utils/retries.py old mode 100755 new mode 100644 index 2138c1b..c40fc41 --- a/src/fabra/utils/retries.py +++ b/src/fabra/utils/retries.py @@ -2,6 +2,7 @@ import random import time +from typing import List import requests @@ -32,9 +33,9 @@ def __init__(self, strategy: str, backoff: BackoffStrategy, retry_connection_err class Retries: config: RetryConfig - status_codes: list[str] + status_codes: List[str] - def __init__(self, config: RetryConfig, status_codes: list[str]): + def __init__(self, config: RetryConfig, status_codes: List[str]): self.config = config self.status_codes = status_codes @@ -74,12 +75,12 @@ def do_request(): if res.status_code == parsed_code: raise TemporaryError(res) except requests.exceptions.ConnectionError as exception: - if not retries.config.config.retry_connection_errors: + if retries.config.retry_connection_errors: raise raise PermanentError(exception) from exception except requests.exceptions.Timeout as exception: - if not retries.config.config.retry_connection_errors: + if retries.config.retry_connection_errors: raise raise PermanentError(exception) from exception @@ -113,7 +114,6 @@ def retry_with_backoff(func, initial_interval=500, max_interval=60000, exponent= raise sleep = ((initial_interval/1000) * exponent**retries + random.uniform(0, 1)) - if sleep > max_interval/1000: - sleep = max_interval/1000 + sleep = min(sleep, max_interval / 1000) time.sleep(sleep) retries += 1 diff --git a/src/fabra/utils/utils.py b/src/fabra/utils/utils.py old mode 100755 new mode 100644 index 6b39ecf..c263197 --- a/src/fabra/utils/utils.py +++ b/src/fabra/utils/utils.py @@ -3,37 +3,35 @@ import base64 import json import re -from dataclasses import Field, dataclass, fields, is_dataclass, make_dataclass +import sys +from dataclasses import Field, fields, is_dataclass, make_dataclass from datetime import date, datetime +from decimal import Decimal from email.message import Message from enum import Enum -from typing import Any, Callable, Optional, Tuple, Union, get_args, get_origin +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Union, + get_args, + get_origin, +) from xmlrpc.client import boolean - +from typing_inspect import is_optional_type import dateutil.parser -import requests from dataclasses_json import DataClassJsonMixin -class SecurityClient: - client: requests.Session - query_params: dict[str, str] = {} - - def __init__(self, client: requests.Session): - self.client = client - - def request(self, method, url, **kwargs): - params = kwargs.get('params', {}) - kwargs["params"] = self.query_params | params - - return self.client.request(method, url, **kwargs) - - -def configure_security_client(client: requests.Session, security: dataclass): - client = SecurityClient(client) +def get_security(security: Any) -> Tuple[Dict[str, str], Dict[str, str]]: + headers: Dict[str, str] = {} + query_params: Dict[str, str] = {} if security is None: - return client + return headers, query_params sec_fields: Tuple[Field, ...] = fields(security) for sec_field in sec_fields: @@ -41,285 +39,380 @@ def configure_security_client(client: requests.Session, security: dataclass): if value is None: continue - metadata = sec_field.metadata.get('security') + metadata = sec_field.metadata.get("security") if metadata is None: continue - if metadata.get('option'): - _parse_security_option(client, value) - return client - if metadata.get('scheme'): + if metadata.get("option"): + _parse_security_option(headers, query_params, value) + return headers, query_params + if metadata.get("scheme"): # Special case for basic auth which could be a flattened struct if metadata.get("sub_type") == "basic" and not is_dataclass(value): - _parse_security_scheme(client, metadata, security) + _parse_security_scheme(headers, query_params, metadata, security) else: - _parse_security_scheme(client, metadata, value) + _parse_security_scheme(headers, query_params, metadata, value) - return client + return headers, query_params -def _parse_security_option(client: SecurityClient, option: dataclass): +def _parse_security_option( + headers: Dict[str, str], query_params: Dict[str, str], option: Any +): opt_fields: Tuple[Field, ...] = fields(option) for opt_field in opt_fields: - metadata = opt_field.metadata.get('security') - if metadata is None or metadata.get('scheme') is None: + metadata = opt_field.metadata.get("security") + if metadata is None or metadata.get("scheme") is None: continue _parse_security_scheme( - client, metadata, getattr(option, opt_field.name)) + headers, query_params, metadata, getattr(option, opt_field.name) + ) -def _parse_security_scheme(client: SecurityClient, scheme_metadata: dict, scheme: any): - scheme_type = scheme_metadata.get('type') - sub_type = scheme_metadata.get('sub_type') +def _parse_security_scheme( + headers: Dict[str, str], + query_params: Dict[str, str], + scheme_metadata: Dict, + scheme: Any, +): + scheme_type = scheme_metadata.get("type") + sub_type = scheme_metadata.get("sub_type") if is_dataclass(scheme): - if scheme_type == 'http' and sub_type == 'basic': - _parse_basic_auth_scheme(client, scheme) + if scheme_type == "http" and sub_type == "basic": + _parse_basic_auth_scheme(headers, scheme) return scheme_fields: Tuple[Field, ...] = fields(scheme) for scheme_field in scheme_fields: - metadata = scheme_field.metadata.get('security') - if metadata is None or metadata.get('field_name') is None: + metadata = scheme_field.metadata.get("security") + if metadata is None or metadata.get("field_name") is None: continue value = getattr(scheme, scheme_field.name) _parse_security_scheme_value( - client, scheme_metadata, metadata, value) + headers, query_params, scheme_metadata, metadata, value + ) else: _parse_security_scheme_value( - client, scheme_metadata, scheme_metadata, scheme) + headers, query_params, scheme_metadata, scheme_metadata, scheme + ) -def _parse_security_scheme_value(client: SecurityClient, scheme_metadata: dict, security_metadata: dict, value: any): - scheme_type = scheme_metadata.get('type') - sub_type = scheme_metadata.get('sub_type') +def _parse_security_scheme_value( + headers: Dict[str, str], + query_params: Dict[str, str], + scheme_metadata: Dict, + security_metadata: Dict, + value: Any, +): + scheme_type = scheme_metadata.get("type") + sub_type = scheme_metadata.get("sub_type") - header_name = security_metadata.get('field_name') + header_name = str(security_metadata.get("field_name")) if scheme_type == "apiKey": - if sub_type == 'header': - client.client.headers[header_name] = value - elif sub_type == 'query': - client.query_params[header_name] = value - elif sub_type == 'cookie': - client.client.cookies[header_name] = value + if sub_type == "header": + headers[header_name] = value + elif sub_type == "query": + query_params[header_name] = value else: - raise Exception('not supported') + raise Exception("not supported") elif scheme_type == "openIdConnect": - client.client.headers[header_name] = value - elif scheme_type == 'oauth2': - client.client.headers[header_name] = value - elif scheme_type == 'http': - if sub_type == 'bearer': - client.client.headers[header_name] = value.lower().startswith('bearer ') and value or f'Bearer {value}' + headers[header_name] = _apply_bearer(value) + elif scheme_type == "oauth2": + if sub_type != "client_credentials": + headers[header_name] = _apply_bearer(value) + elif scheme_type == "http": + if sub_type == "bearer": + headers[header_name] = _apply_bearer(value) else: - raise Exception('not supported') + raise Exception("not supported") else: - raise Exception('not supported') + raise Exception("not supported") + + +def _apply_bearer(token: str) -> str: + return token.lower().startswith("bearer ") and token or f"Bearer {token}" -def _parse_basic_auth_scheme(client: SecurityClient, scheme: dataclass): +def _parse_basic_auth_scheme(headers: Dict[str, str], scheme: Any): username = "" password = "" scheme_fields: Tuple[Field, ...] = fields(scheme) for scheme_field in scheme_fields: - metadata = scheme_field.metadata.get('security') - if metadata is None or metadata.get('field_name') is None: + metadata = scheme_field.metadata.get("security") + if metadata is None or metadata.get("field_name") is None: continue - field_name = metadata.get('field_name') + field_name = metadata.get("field_name") value = getattr(scheme, scheme_field.name) - if field_name == 'username': + if field_name == "username": username = value - if field_name == 'password': + if field_name == "password": password = value - data = f'{username}:{password}'.encode() - client.client.headers['Authorization'] = f'Basic {base64.b64encode(data).decode()}' + data = f"{username}:{password}".encode() + headers["Authorization"] = f"Basic {base64.b64encode(data).decode()}" -def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass, - gbls: dict[str, dict[str, dict[str, Any]]] = None) -> str: - path_param_fields: Tuple[Field, ...] = fields(clazz) +def generate_url( + server_url: str, + path: str, + path_params: Any, + gbls: Optional[Any] = None, +) -> str: + path_param_values: Dict[str, str] = {} + + globals_already_populated = _populate_path_params( + path_params, gbls, path_param_values, [] + ) + if gbls is not None: + _populate_path_params(gbls, None, path_param_values, globals_already_populated) + + for key, value in path_param_values.items(): + path = path.replace("{" + key + "}", value, 1) + + return remove_suffix(server_url, "/") + path + + +def _populate_path_params( + path_params: Any, + gbls: Any, + path_param_values: Dict[str, str], + skip_fields: List[str], +) -> List[str]: + globals_already_populated: List[str] = [] + + path_param_fields: Tuple[Field, ...] = fields(path_params) for field in path_param_fields: - request_metadata = field.metadata.get('request') - if request_metadata is not None: + if field.name in skip_fields: continue - param_metadata = field.metadata.get('path_param') + param_metadata = field.metadata.get("path_param") if param_metadata is None: continue - param = getattr( - path_params, field.name) if path_params is not None else None - param = _populate_from_globals( - field.name, param, 'pathParam', gbls) + param = getattr(path_params, field.name) if path_params is not None else None + param, global_found = _populate_from_globals( + field.name, param, "path_param", gbls + ) + if global_found: + globals_already_populated.append(field.name) if param is None: continue f_name = param_metadata.get("field_name", field.name) - serialization = param_metadata.get('serialization', '') - if serialization != '': + serialization = param_metadata.get("serialization", "") + if serialization != "": serialized_params = _get_serialized_params( - param_metadata, f_name, param) + param_metadata, field.type, f_name, param + ) for key, value in serialized_params.items(): - path = path.replace( - '{' + key + '}', value, 1) + path_param_values[key] = value else: - if param_metadata.get('style', 'simple') == 'simple': - if isinstance(param, list): - pp_vals: list[str] = [] + if param_metadata.get("style", "simple") == "simple": + if isinstance(param, List): + pp_vals: List[str] = [] for pp_val in param: if pp_val is None: continue pp_vals.append(_val_to_string(pp_val)) - path = path.replace( - '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1) - elif isinstance(param, dict): - pp_vals: list[str] = [] + path_param_values[param_metadata.get("field_name", field.name)] = ( + ",".join(pp_vals) + ) + elif isinstance(param, Dict): + pp_vals: List[str] = [] for pp_key in param: if param[pp_key] is None: continue - if param_metadata.get('explode'): - pp_vals.append( - f"{pp_key}={_val_to_string(param[pp_key])}") + if param_metadata.get("explode"): + pp_vals.append(f"{pp_key}={_val_to_string(param[pp_key])}") else: - pp_vals.append( - f"{pp_key},{_val_to_string(param[pp_key])}") - path = path.replace( - '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1) - elif not isinstance(param, (str, int, float, complex, bool)): - pp_vals: list[str] = [] + pp_vals.append(f"{pp_key},{_val_to_string(param[pp_key])}") + path_param_values[param_metadata.get("field_name", field.name)] = ( + ",".join(pp_vals) + ) + elif not isinstance(param, (str, int, float, complex, bool, Decimal)): + pp_vals: List[str] = [] param_fields: Tuple[Field, ...] = fields(param) for param_field in param_fields: - param_value_metadata = param_field.metadata.get( - 'path_param') + param_value_metadata = param_field.metadata.get("path_param") if not param_value_metadata: continue - parm_name = param_value_metadata.get( - 'field_name', field.name) + param_name = param_value_metadata.get("field_name", field.name) param_field_val = getattr(param, param_field.name) if param_field_val is None: continue - if param_metadata.get('explode'): + if param_metadata.get("explode"): pp_vals.append( - f"{parm_name}={_val_to_string(param_field_val)}") + f"{param_name}={_val_to_string(param_field_val)}" + ) else: pp_vals.append( - f"{parm_name},{_val_to_string(param_field_val)}") - path = path.replace( - '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1) + f"{param_name},{_val_to_string(param_field_val)}" + ) + path_param_values[param_metadata.get("field_name", field.name)] = ( + ",".join(pp_vals) + ) else: - path = path.replace( - '{' + param_metadata.get('field_name', field.name) + '}', _val_to_string(param), 1) + path_param_values[param_metadata.get("field_name", field.name)] = ( + _val_to_string(param) + ) - return server_url.removesuffix("/") + path + return globals_already_populated def is_optional(field): return get_origin(field) is Union and type(None) in get_args(field) -def template_url(url_with_params: str, params: dict[str, str]) -> str: +def template_url(url_with_params: str, params: Dict[str, str]) -> str: for key, value in params.items(): - url_with_params = url_with_params.replace( - '{' + key + '}', value) + url_with_params = url_with_params.replace("{" + key + "}", value) return url_with_params -def get_query_params(clazz: type, query_params: dataclass, gbls: dict[str, dict[str, dict[str, Any]]] = None) -> dict[ - str, list[str]]: - params: dict[str, list[str]] = {} +def get_query_params( + query_params: Any, + gbls: Optional[Any] = None, +) -> Dict[str, List[str]]: + params: Dict[str, List[str]] = {} - param_fields: Tuple[Field, ...] = fields(clazz) + globals_already_populated = _populate_query_params(query_params, gbls, params, []) + if gbls is not None: + _populate_query_params(gbls, None, params, globals_already_populated) + + return params + + +def _populate_query_params( + query_params: Any, + gbls: Any, + query_param_values: Dict[str, List[str]], + skip_fields: List[str], +) -> List[str]: + globals_already_populated: List[str] = [] + + param_fields: Tuple[Field, ...] = fields(query_params) for field in param_fields: - request_metadata = field.metadata.get('request') - if request_metadata is not None: + if field.name in skip_fields: continue - metadata = field.metadata.get('query_param') + metadata = field.metadata.get("query_param") if not metadata: continue param_name = field.name - value = getattr( - query_params, param_name) if query_params is not None else None + value = getattr(query_params, param_name) if query_params is not None else None - value = _populate_from_globals(param_name, value, 'queryParam', gbls) + value, global_found = _populate_from_globals( + param_name, value, "query_param", gbls + ) + if global_found: + globals_already_populated.append(param_name) f_name = metadata.get("field_name") - serialization = metadata.get('serialization', '') - if serialization != '': - serialized_parms = _get_serialized_params(metadata, f_name, value) + serialization = metadata.get("serialization", "") + if serialization != "": + serialized_parms = _get_serialized_params( + metadata, field.type, f_name, value + ) for key, value in serialized_parms.items(): - if key in params: - params[key].extend(value) + if key in query_param_values: + query_param_values[key].extend(value) else: - params[key] = [value] + query_param_values[key] = [value] else: - style = metadata.get('style', 'form') - if style == 'deepObject': - params = params | _get_deep_object_query_params( - metadata, f_name, value) - elif style == 'form': - params = params | _get_delimited_query_params( - metadata, f_name, value, ",") - elif style == 'pipeDelimited': - params = params | _get_delimited_query_params( - metadata, f_name, value, "|") + style = metadata.get("style", "form") + if style == "deepObject": + _populate_deep_object_query_params( + metadata, f_name, value, query_param_values + ) + elif style == "form": + _populate_delimited_query_params( + metadata, f_name, value, ",", query_param_values + ) + elif style == "pipeDelimited": + _populate_delimited_query_params( + metadata, f_name, value, "|", query_param_values + ) else: - raise Exception('not yet implemented') - return params + raise Exception("not yet implemented") + return globals_already_populated -def get_headers(headers_params: dataclass) -> dict[str, str]: - if headers_params is None: - return {} - headers: dict[str, str] = {} +def get_headers(headers_params: Any, gbls: Optional[Any] = None) -> Dict[str, str]: + headers: Dict[str, str] = {} + + globals_already_populated = [] + if headers_params is not None: + globals_already_populated = _populate_headers(headers_params, gbls, headers, []) + if gbls is not None: + _populate_headers(gbls, None, headers, globals_already_populated) + + return headers + + +def _populate_headers( + headers_params: Any, + gbls: Any, + header_values: Dict[str, str], + skip_fields: List[str], +) -> List[str]: + globals_already_populated: List[str] = [] param_fields: Tuple[Field, ...] = fields(headers_params) for field in param_fields: - metadata = field.metadata.get('header') + if field.name in skip_fields: + continue + + metadata = field.metadata.get("header") if not metadata: continue - value = _serialize_header(metadata.get( - 'explode', False), getattr(headers_params, field.name)) + value, global_found = _populate_from_globals( + field.name, getattr(headers_params, field.name), "header", gbls + ) + if global_found: + globals_already_populated.append(field.name) + value = _serialize_header(metadata.get("explode", False), value) - if value != '': - headers[metadata.get('field_name', field.name)] = value + if value != "": + header_values[metadata.get("field_name", field.name)] = value - return headers + return globals_already_populated -def _get_serialized_params(metadata: dict, field_name: str, obj: any) -> dict[str, str]: - params: dict[str, str] = {} +def _get_serialized_params( + metadata: Dict, field_type: type, field_name: str, obj: Any +) -> Dict[str, str]: + params: Dict[str, str] = {} - serialization = metadata.get('serialization', '') - if serialization == 'json': - params[metadata.get("field_name", field_name)] = marshal_json(obj) + serialization = metadata.get("serialization", "") + if serialization == "json": + params[metadata.get("field_name", field_name)] = marshal_json(obj, field_type) return params -def _get_deep_object_query_params(metadata: dict, field_name: str, obj: any) -> dict[str, list[str]]: - params: dict[str, list[str]] = {} - +def _populate_deep_object_query_params( + metadata: Dict, field_name: str, obj: Any, params: Dict[str, List[str]] +): if obj is None: - return params + return if is_dataclass(obj): obj_fields: Tuple[Field, ...] = fields(obj) for obj_field in obj_fields: - obj_param_metadata = obj_field.metadata.get('query_param') + obj_param_metadata = obj_field.metadata.get("query_param") if not obj_param_metadata: continue @@ -327,48 +420,55 @@ def _get_deep_object_query_params(metadata: dict, field_name: str, obj: any) -> if obj_val is None: continue - if isinstance(obj_val, list): + if isinstance(obj_val, List): for val in obj_val: if val is None: continue - if params.get( - f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]') is None: + if ( + params.get( + f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]' + ) + is None + ): params[ - f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]'] = [ - ] + f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]' + ] = [] params[ - f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]'].append( - _val_to_string(val)) + f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]' + ].append(_val_to_string(val)) else: params[ - f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]'] = [ - _val_to_string(obj_val)] - elif isinstance(obj, dict): + f'{metadata.get("field_name", field_name)}[{obj_param_metadata.get("field_name", obj_field.name)}]' + ] = [_val_to_string(obj_val)] + elif isinstance(obj, Dict): for key, value in obj.items(): if value is None: continue - if isinstance(value, list): + if isinstance(value, List): for val in value: if val is None: continue - if params.get(f'{metadata.get("field_name", field_name)}[{key}]') is None: - params[f'{metadata.get("field_name", field_name)}[{key}]'] = [ - ] + if ( + params.get(f'{metadata.get("field_name", field_name)}[{key}]') + is None + ): + params[f'{metadata.get("field_name", field_name)}[{key}]'] = [] - params[ - f'{metadata.get("field_name", field_name)}[{key}]'].append(_val_to_string(val)) + params[f'{metadata.get("field_name", field_name)}[{key}]'].append( + _val_to_string(val) + ) else: params[f'{metadata.get("field_name", field_name)}[{key}]'] = [ - _val_to_string(value)] - return params + _val_to_string(value) + ] def _get_query_param_field_name(obj_field: Field) -> str: - obj_param_metadata = obj_field.metadata.get('query_param') + obj_param_metadata = obj_field.metadata.get("query_param") if not obj_param_metadata: return "" @@ -376,52 +476,87 @@ def _get_query_param_field_name(obj_field: Field) -> str: return obj_param_metadata.get("field_name", obj_field.name) -def _get_delimited_query_params(metadata: dict, field_name: str, obj: any, delimiter: str) -> dict[ - str, list[str]]: - return _populate_form(field_name, metadata.get("explode", True), obj, _get_query_param_field_name, delimiter) +def _populate_delimited_query_params( + metadata: Dict, + field_name: str, + obj: Any, + delimiter: str, + query_param_values: Dict[str, List[str]], +): + _populate_form( + field_name, + metadata.get("explode", True), + obj, + _get_query_param_field_name, + delimiter, + query_param_values, + ) SERIALIZATION_METHOD_TO_CONTENT_TYPE = { - 'json': 'application/json', - 'form': 'application/x-www-form-urlencoded', - 'multipart': 'multipart/form-data', - 'raw': 'application/octet-stream', - 'string': 'text/plain', + "json": "application/json", + "form": "application/x-www-form-urlencoded", + "multipart": "multipart/form-data", + "raw": "application/octet-stream", + "string": "text/plain", } -def serialize_request_body(request: dataclass, request_field_name: str, serialization_method: str) -> Tuple[ - str, any, any]: +def serialize_request_body( + request: Any, + request_type: type, + request_field_name: str, + nullable: bool, + optional: bool, + serialization_method: str, + encoder=None, +) -> Tuple[Optional[str], Optional[Any], Optional[Any]]: if request is None: - return None, None, None, None + if not nullable and optional: + return None, None, None if not is_dataclass(request) or not hasattr(request, request_field_name): - return serialize_content_type(request_field_name, SERIALIZATION_METHOD_TO_CONTENT_TYPE[serialization_method], - request) + return serialize_content_type( + request_field_name, + request_type, + SERIALIZATION_METHOD_TO_CONTENT_TYPE[serialization_method], + request, + encoder, + ) request_val = getattr(request, request_field_name) + if request_val is None: + if not nullable and optional: + return None, None, None + request_fields: Tuple[Field, ...] = fields(request) request_metadata = None for field in request_fields: if field.name == request_field_name: - request_metadata = field.metadata.get('request') + request_metadata = field.metadata.get("request") break if request_metadata is None: - raise Exception('invalid request type') - - return serialize_content_type(request_field_name, request_metadata.get('media_type', 'application/octet-stream'), - request_val) - - -def serialize_content_type(field_name: str, media_type: str, request: dataclass) -> Tuple[str, any, list[list[any]]]: - if re.match(r'(application|text)\/.*?\+*json.*', media_type) is not None: - return media_type, marshal_json(request), None - if re.match(r'multipart\/.*', media_type) is not None: + raise Exception("invalid request type") + + return serialize_content_type( + request_field_name, + request_type, + request_metadata.get("media_type", "application/octet-stream"), + request_val, + ) + + +def serialize_content_type( + field_name: str, request_type: Any, media_type: str, request: Any, encoder=None +) -> Tuple[Optional[str], Optional[Any], Optional[List[List[Any]]]]: + if re.match(r"(application|text)\/.*?\+*json.*", media_type) is not None: + return media_type, marshal_json(request, request_type, encoder), None + if re.match(r"multipart\/.*", media_type) is not None: return serialize_multipart_form(media_type, request) - if re.match(r'application\/x-www-form-urlencoded.*', media_type) is not None: + if re.match(r"application\/x-www-form-urlencoded.*", media_type) is not None: return media_type, serialize_form_data(field_name, request), None if isinstance(request, (bytes, bytearray)): return media_type, request, None @@ -429,11 +564,14 @@ def serialize_content_type(field_name: str, media_type: str, request: dataclass) return media_type, request, None raise Exception( - f"invalid request body type {type(request)} for mediaType {media_type}") + f"invalid request body type {type(request)} for mediaType {media_type}" + ) -def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str, any, list[list[any]]]: - form: list[list[any]] = [] +def serialize_multipart_form( + media_type: str, request: Any +) -> Tuple[str, Any, List[List[Any]]]: + form: List[List[Any]] = [] request_fields = fields(request) for field in request_fields: @@ -441,7 +579,7 @@ def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str, if val is None: continue - field_metadata = field.metadata.get('multipart_form') + field_metadata = field.metadata.get("multipart_form") if not field_metadata: continue @@ -453,42 +591,42 @@ def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str, content = bytes() for file_field in file_fields: - file_metadata = file_field.metadata.get('multipart_form') + file_metadata = file_field.metadata.get("multipart_form") if file_metadata is None: continue if file_metadata.get("content") is True: content = getattr(val, file_field.name) else: - field_name = file_metadata.get( - "field_name", file_field.name) + field_name = file_metadata.get("field_name", file_field.name) file_name = getattr(val, file_field.name) if field_name == "" or file_name == "" or content == bytes(): - raise Exception('invalid multipart/form-data file') + raise Exception("invalid multipart/form-data file") form.append([field_name, [file_name, content]]) elif field_metadata.get("json") is True: - to_append = [field_metadata.get("field_name", field.name), [ - None, marshal_json(val), "application/json"]] + to_append = [ + field_metadata.get("field_name", field.name), + [None, marshal_json(val, field.type), "application/json"], + ] form.append(to_append) else: - field_name = field_metadata.get( - "field_name", field.name) - if isinstance(val, list): + field_name = field_metadata.get("field_name", field.name) + if isinstance(val, List): for value in val: if value is None: continue - form.append( - [field_name + "[]", [None, _val_to_string(value)]]) + form.append([field_name + "[]", [None, _val_to_string(value)]]) else: form.append([field_name, [None, _val_to_string(val)]]) return media_type, None, form -def serialize_dict(original: dict, explode: bool, field_name, existing: Optional[dict[str, list[str]]]) -> dict[ - str, list[str]]: +def serialize_dict( + original: Dict, explode: bool, field_name, existing: Optional[Dict[str, List[str]]] +) -> Dict[str, List[str]]: if existing is None: - existing = [] + existing = {} if explode is True: for key, val in original.items(): @@ -506,8 +644,8 @@ def serialize_dict(original: dict, explode: bool, field_name, existing: Optional return existing -def serialize_form_data(field_name: str, data: dataclass) -> dict[str, any]: - form: dict[str, list[str]] = {} +def serialize_form_data(field_name: str, data: Any) -> Dict[str, Any]: + form: Dict[str, List[str]] = {} if is_dataclass(data): for field in fields(data): @@ -515,32 +653,37 @@ def serialize_form_data(field_name: str, data: dataclass) -> dict[str, any]: if val is None: continue - metadata = field.metadata.get('form') + metadata = field.metadata.get("form") if metadata is None: continue - field_name = metadata.get('field_name', field.name) + field_name = metadata.get("field_name", field.name) - if metadata.get('json'): - form[field_name] = [marshal_json(val)] + if metadata.get("json"): + form[field_name] = [marshal_json(val, field.type)] else: - if metadata.get('style', 'form') == 'form': - form = form | _populate_form( - field_name, metadata.get('explode', True), val, _get_form_field_name, ",") + if metadata.get("style", "form") == "form": + _populate_form( + field_name, + metadata.get("explode", True), + val, + _get_form_field_name, + ",", + form, + ) else: - raise Exception( - f'Invalid form style for field {field.name}') - elif isinstance(data, dict): + raise Exception(f"Invalid form style for field {field.name}") + elif isinstance(data, Dict): for key, value in data.items(): form[key] = [_val_to_string(value)] else: - raise Exception(f'Invalid request body type for field {field_name}') + raise Exception(f"Invalid request body type for field {field_name}") return form def _get_form_field_name(obj_field: Field) -> str: - obj_param_metadata = obj_field.metadata.get('form') + obj_param_metadata = obj_field.metadata.get("form") if not obj_param_metadata: return "" @@ -548,12 +691,16 @@ def _get_form_field_name(obj_field: Field) -> str: return obj_param_metadata.get("field_name", obj_field.name) -def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_func: Callable, delimiter: str) -> \ - dict[str, list[str]]: - params: dict[str, list[str]] = {} - +def _populate_form( + field_name: str, + explode: boolean, + obj: Any, + get_field_name_func: Callable, + delimiter: str, + form: Dict[str, List[str]], +): if obj is None: - return params + return form if is_dataclass(obj): items = [] @@ -561,7 +708,7 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f obj_fields: Tuple[Field, ...] = fields(obj) for obj_field in obj_fields: obj_field_name = get_field_name_func(obj_field) - if obj_field_name == '': + if obj_field_name == "": continue val = getattr(obj, obj_field.name) @@ -569,27 +716,26 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f continue if explode: - params[obj_field_name] = [_val_to_string(val)] + form[obj_field_name] = [_val_to_string(val)] else: - items.append( - f'{obj_field_name}{delimiter}{_val_to_string(val)}') + items.append(f"{obj_field_name}{delimiter}{_val_to_string(val)}") if len(items) > 0: - params[field_name] = [delimiter.join(items)] - elif isinstance(obj, dict): + form[field_name] = [delimiter.join(items)] + elif isinstance(obj, Dict): items = [] for key, value in obj.items(): if value is None: continue if explode: - params[key] = _val_to_string(value) + form[key] = [_val_to_string(value)] else: - items.append(f'{key}{delimiter}{_val_to_string(value)}') + items.append(f"{key}{delimiter}{_val_to_string(value)}") if len(items) > 0: - params[field_name] = [delimiter.join(items)] - elif isinstance(obj, list): + form[field_name] = [delimiter.join(items)] + elif isinstance(obj, List): items = [] for value in obj: @@ -597,36 +743,35 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f continue if explode: - if not field_name in params: - params[field_name] = [] - params[field_name].append(_val_to_string(value)) + if not field_name in form: + form[field_name] = [] + form[field_name].append(_val_to_string(value)) else: items.append(_val_to_string(value)) if len(items) > 0: - params[field_name] = [delimiter.join([str(item) for item in items])] + form[field_name] = [delimiter.join([str(item) for item in items])] else: - params[field_name] = [_val_to_string(obj)] + form[field_name] = [_val_to_string(obj)] - return params + return form -def _serialize_header(explode: bool, obj: any) -> str: +def _serialize_header(explode: bool, obj: Any) -> str: if obj is None: - return '' + return "" if is_dataclass(obj): items = [] obj_fields: Tuple[Field, ...] = fields(obj) for obj_field in obj_fields: - obj_param_metadata = obj_field.metadata.get('header') + obj_param_metadata = obj_field.metadata.get("header") if not obj_param_metadata: continue - obj_field_name = obj_param_metadata.get( - 'field_name', obj_field.name) - if obj_field_name == '': + obj_field_name = obj_param_metadata.get("field_name", obj_field.name) + if obj_field_name == "": continue val = getattr(obj, obj_field.name) @@ -634,15 +779,14 @@ def _serialize_header(explode: bool, obj: any) -> str: continue if explode: - items.append( - f'{obj_field_name}={_val_to_string(val)}') + items.append(f"{obj_field_name}={_val_to_string(val)}") else: items.append(obj_field_name) items.append(_val_to_string(val)) if len(items) > 0: - return ','.join(items) - elif isinstance(obj, dict): + return ",".join(items) + elif isinstance(obj, Dict): items = [] for key, value in obj.items(): @@ -650,14 +794,14 @@ def _serialize_header(explode: bool, obj: any) -> str: continue if explode: - items.append(f'{key}={_val_to_string(value)}') + items.append(f"{key}={_val_to_string(value)}") else: items.append(key) items.append(_val_to_string(value)) if len(items) > 0: - return ','.join([str(item) for item in items]) - elif isinstance(obj, list): + return ",".join([str(item) for item in items]) + elif isinstance(obj, List): items = [] for value in obj: @@ -667,27 +811,36 @@ def _serialize_header(explode: bool, obj: any) -> str: items.append(_val_to_string(value)) if len(items) > 0: - return ','.join(items) + return ",".join(items) else: - return f'{_val_to_string(obj)}' + return f"{_val_to_string(obj)}" - return '' + return "" -def unmarshal_json(data, typ): - unmarhsal = make_dataclass('Unmarhsal', [('res', typ)], - bases=(DataClassJsonMixin,)) +def unmarshal_json(data, typ, decoder=None, infer_missing=False): + unmarshal = make_dataclass("Unmarshal", [("res", typ)], bases=(DataClassJsonMixin,)) json_dict = json.loads(data) - out = unmarhsal.from_dict({"res": json_dict}) - return out.res + try: + out = unmarshal.from_dict({"res": json_dict}, infer_missing=infer_missing) + except AttributeError as attr_err: + raise AttributeError( + f"unable to unmarshal {data} as {typ} - {attr_err}" + ) from attr_err + + return out.res if decoder is None else decoder(out.res) + +def marshal_json(val, typ, encoder=None): + if not is_optional_type(typ) and val is None: + raise ValueError(f"Could not marshal None into non-optional type: {typ}") -def marshal_json(val): - marshal = make_dataclass('Marshal', [('res', type(val))], - bases=(DataClassJsonMixin,)) + marshal = make_dataclass("Marshal", [("res", typ)], bases=(DataClassJsonMixin,)) marshaller = marshal(res=val) json_dict = marshaller.to_dict() - return json.dumps(json_dict["res"]) + val = json_dict["res"] if encoder is None else encoder(json_dict["res"]) + + return json.dumps(val, separators=(",", ":"), sort_keys=True) def match_content_type(content_type: str, pattern: str) -> boolean: @@ -695,7 +848,7 @@ def match_content_type(content_type: str, pattern: str) -> boolean: return True msg = Message() - msg['content-type'] = content_type + msg["content-type"] = content_type media_type = msg.get_content_type() if media_type == pattern: @@ -703,9 +856,19 @@ def match_content_type(content_type: str, pattern: str) -> boolean: parts = media_type.split("/") if len(parts) == 2: - if pattern in (f'{parts[0]}/*', f'*/{parts[1]}'): + if pattern in (f"{parts[0]}/*", f"*/{parts[1]}"): + return True + + return False + + +def match_status_codes(status_codes: List[str], status_code: int) -> bool: + for code in status_codes: + if code == str(status_code): return True + if code.endswith("XX") and code.startswith(str(status_code)[:1]): + return True return False @@ -731,6 +894,138 @@ def datefromisoformat(date_str: str): return dateutil.parser.parse(date_str).date() +def bigintencoder(optional: bool): + def bigintencode(val: int): + if optional and val is None: + return None + return str(val) + + return bigintencode + + +def bigintdecoder(val): + if isinstance(val, float): + raise ValueError(f"{val} is a float") + return int(val) + +def integerstrencoder(optional: bool): + def integerstrencode(val: int): + if optional and val is None: + return None + return str(val) + + return integerstrencode + + +def integerstrdecoder(val): + if isinstance(val, float): + raise ValueError(f"{val} is a float") + return int(val) + + +def numberstrencoder(optional: bool): + def numberstrencode(val: float): + if optional and val is None: + return None + return str(val) + + return numberstrencode + + +def numberstrdecoder(val): + return float(val) + + +def decimalencoder(optional: bool, as_str: bool): + def decimalencode(val: Decimal): + if optional and val is None: + return None + + if as_str: + return str(val) + + return float(val) + + return decimalencode + + +def decimaldecoder(val): + return Decimal(str(val)) + + +def map_encoder(optional: bool, value_encoder: Callable): + def map_encode(val: Dict): + if optional and val is None: + return None + + encoded = {} + for key, value in val.items(): + encoded[key] = value_encoder(value) + + return encoded + + return map_encode + + +def map_decoder(value_decoder: Callable): + def map_decode(val: Dict): + decoded = {} + for key, value in val.items(): + decoded[key] = value_decoder(value) + + return decoded + + return map_decode + + +def list_encoder(optional: bool, value_encoder: Callable): + def list_encode(val: List): + if optional and val is None: + return None + + encoded = [] + for value in val: + encoded.append(value_encoder(value)) + + return encoded + + return list_encode + + +def list_decoder(value_decoder: Callable): + def list_decode(val: List): + decoded = [] + for value in val: + decoded.append(value_decoder(value)) + + return decoded + + return list_decode + + +def union_encoder(all_encoders: Dict[str, Callable]): + def selective_encoder(val: Any): + if type(val) in all_encoders: + return all_encoders[type(val)](val) + return val + + return selective_encoder + + +def union_decoder(all_decoders: List[Callable]): + def selective_decoder(val: Any): + decoded = val + for decoder in all_decoders: + try: + decoded = decoder(val) + break + except (TypeError, ValueError): + continue + return decoded + + return selective_decoder + + def get_field_name(name): def override(_, _field_name=name): return _field_name @@ -738,24 +1033,55 @@ def override(_, _field_name=name): return override -def _val_to_string(val): +def _val_to_string(val) -> str: if isinstance(val, bool): return str(val).lower() if isinstance(val, datetime): - return val.isoformat().replace('+00:00', 'Z') + return str(val.isoformat().replace("+00:00", "Z")) if isinstance(val, Enum): return str(val.value) return str(val) -def _populate_from_globals(param_name: str, value: any, param_type: str, gbls: dict[str, dict[str, dict[str, Any]]]): - if value is None and gbls is not None: - if 'parameters' in gbls: - if param_type in gbls['parameters']: - if param_name in gbls['parameters'][param_type]: - global_value = gbls['parameters'][param_type][param_name] - if global_value is not None: - value = global_value +def _populate_from_globals( + param_name: str, value: Any, param_type: str, gbls: Any +) -> Tuple[Any, bool]: + if gbls is None: + return value, False + + global_fields = fields(gbls) + + found = False + for field in global_fields: + if field.name is not param_name: + continue + + found = True + + if value is not None: + return value, True + + global_value = getattr(gbls, field.name) + + param_metadata = field.metadata.get(param_type) + if param_metadata is None: + return value, True + + return global_value, True + + return value, found + + +def decoder_with_discriminator(field_name): + def decode_fx(obj): + kls = getattr(sys.modules["sdk.models.components"], obj[field_name]) + return unmarshal_json(json.dumps(obj), kls) + + return decode_fx + - return value +def remove_suffix(input_string, suffix): + if suffix and input_string.endswith(suffix): + return input_string[: -len(suffix)] + return input_string