diff --git a/.gitattributes b/.gitattributes new file mode 100755 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/README.md b/README.md index 7139a98..930acfa 100755 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ pip install fabra ```python import fabra -from fabra.models import operations +from fabra.models import operations, shared s = fabra.Fabra( security=shared.Security( @@ -27,13 +27,14 @@ s = fabra.Fabra( ) req = operations.GetNamespacesRequest( - connection_id=548814, + connection_id=995455, ) res = s.connection.get_namespaces(req) if res.namespaces is not None: # handle response + pass ``` @@ -76,4 +77,125 @@ if res.namespaces is not None: * [get_syncs](docs/sdks/sync/README.md#get_syncs) - Get all syncs + + + + + + + + + +# Pagination + +Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the +returned response object will have a `Next` method that can be called to pull down the next group of results. If the +return value of `Next` is `None`, then there are no more pages to be fetched. + +Here's an example of one such pagination call: + + + + + +# Error Handling + +Handling errors in your 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. + + + + + + + +# 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 | + +For example: + + +```python +import fabra +from fabra.models import operations, shared + +s = fabra.Fabra( + security=shared.Security( + api_key_auth="", + ), + server_idx=0 +) + +req = operations.GetNamespacesRequest( + connection_id=995455, +) + +res = s.connection.get_namespaces(req) + +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, shared + +s = fabra.Fabra( + security=shared.Security( + api_key_auth="", + ), + server_url="https://api.fabra.io" +) + +req = operations.GetNamespacesRequest( + connection_id=995455, +) + +res = s.connection.get_namespaces(req) + +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 your 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) +``` + + + + + + + + ### SDK Generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks) diff --git a/RELEASES.md b/RELEASES.md index 090f2b6..3ed3e26 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -354,4 +354,410 @@ 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 - . + +## 2023-06-21 00:05:41 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.49.1 (2.41.5) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.21.1] https://pypi.org/project/fabra/0.21.1 - . + +## 2023-06-23 00:06:28 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.50.1 (2.43.2) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.22.0] https://pypi.org/project/fabra/0.22.0 - . + +## 2023-06-27 00:06:06 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.51.1 (2.50.2) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.23.0] https://pypi.org/project/fabra/0.23.0 - . + +## 2023-06-30 00:05:51 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.51.3 (2.52.2) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.24.0] https://pypi.org/project/fabra/0.24.0 - . + +## 2023-07-01 00:07:05 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.52.0 (2.55.0) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.25.0] https://pypi.org/project/fabra/0.25.0 - . + +## 2023-07-06 00:07:03 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.52.2 (2.57.2) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.26.0] https://pypi.org/project/fabra/0.26.0 - . + +## 2023-07-07 00:05:54 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.53.0 (2.58.0) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.27.0] https://pypi.org/project/fabra/0.27.0 - . + +## 2023-07-08 00:06:15 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.53.1 (2.58.2) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.27.1] https://pypi.org/project/fabra/0.27.1 - . + +## 2023-07-11 00:06:17 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.56.0 (2.61.0) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.28.0] https://pypi.org/project/fabra/0.28.0 - . + +## 2023-07-12 00:05:49 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.56.3 (2.61.4) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.28.1] https://pypi.org/project/fabra/0.28.1 - . + +## 2023-07-13 00:06:10 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.57.0 (2.62.1) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.29.0] https://pypi.org/project/fabra/0.29.0 - . + +## 2023-07-14 00:06:15 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.59.0 (2.65.0) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.30.0] https://pypi.org/project/fabra/0.30.0 - . + +## 2023-07-18 00:07:02 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.61.0 (2.70.0) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.31.0] https://pypi.org/project/fabra/0.31.0 - . + +## 2023-07-19 00:06:31 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.62.1 (2.70.2) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.31.1] https://pypi.org/project/fabra/0.31.1 - . + +## 2023-07-22 00:05:37 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.64.0 (2.71.0) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.32.0] https://pypi.org/project/fabra/0.32.0 - . + +## 2023-07-26 00:05:28 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.65.0 (2.73.0) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.33.0] https://pypi.org/project/fabra/0.33.0 - . + +## 2023-07-27 00:05:34 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.65.1 (2.73.1) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.33.1] https://pypi.org/project/fabra/0.33.1 - . + +## 2023-07-28 00:05:26 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.65.2 (2.75.1) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.34.0] https://pypi.org/project/fabra/0.34.0 - . + +## 2023-08-01 00:06:39 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.66.1 (2.75.2) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.34.1] https://pypi.org/project/fabra/0.34.1 - . + +## 2023-08-03 00:05:29 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.68.1 (2.77.1) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.35.0] https://pypi.org/project/fabra/0.35.0 - . + +## 2023-08-04 00:05:28 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.68.3 (2.81.1) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.36.0] https://pypi.org/project/fabra/0.36.0 - . + +## 2023-08-08 00:06:00 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.69.1 (2.82.0) https://github.com/speakeasy-api/speakeasy +### Releases +- [PyPI v0.37.0] https://pypi.org/project/fabra/0.37.0 - . + +## 2023-08-16 00:05:25 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.73.1 (2.84.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.38.0] . +### Releases +- [PyPI v0.38.0] https://pypi.org/project/fabra/0.38.0 - . + +## 2023-08-19 00:05:12 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.74.3 (2.86.6) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.38.1] . +### Releases +- [PyPI v0.38.1] https://pypi.org/project/fabra/0.38.1 - . + +## 2023-08-25 00:05:29 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.74.11 (2.87.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.38.2] . +### Releases +- [PyPI v0.38.2] https://pypi.org/project/fabra/0.38.2 - . + +## 2023-08-26 00:06:15 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.74.15 (2.88.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.39.0] . +### Releases +- [PyPI v0.39.0] https://pypi.org/project/fabra/0.39.0 - . + +## 2023-08-29 00:05:47 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.74.17 (2.88.5) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.39.1] . +### Releases +- [PyPI v0.39.1] https://pypi.org/project/fabra/0.39.1 - . + +## 2023-08-31 00:05:33 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.75.0 (2.89.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.40.0] . +### Releases +- [PyPI v0.40.0] https://pypi.org/project/fabra/0.40.0 - . + +## 2023-09-01 00:05:43 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.77.0 (2.91.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.41.0] . +### Releases +- [PyPI v0.41.0] https://pypi.org/project/fabra/0.41.0 - . + +## 2023-09-02 00:05:20 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.77.2 (2.93.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.41.1] . +### Releases +- [PyPI v0.41.1] https://pypi.org/project/fabra/0.41.1 - . + +## 2023-09-05 00:05:23 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.78.3 (2.96.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.41.2] . +### Releases +- [PyPI v0.41.2] https://pypi.org/project/fabra/0.41.2 - . + +## 2023-09-12 00:05:33 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.82.5 (2.108.3) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.41.3] . +### Releases +- [PyPI v0.41.3] https://pypi.org/project/fabra/0.41.3 - . + +## 2023-09-16 00:05:12 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.86.0 (2.115.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.41.4] . +### Releases +- [PyPI v0.41.4] https://pypi.org/project/fabra/0.41.4 - . + +## 2023-09-20 00:05:31 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.88.0 (2.118.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.41.5] . +### Releases +- [PyPI v0.41.5] https://pypi.org/project/fabra/0.41.5 - . + +## 2023-09-26 00:05:27 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.91.0 (2.129.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.42.0] . +### Releases +- [PyPI v0.42.0] https://pypi.org/project/fabra/0.42.0 - . + +## 2023-09-27 00:05:44 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.91.2 (2.131.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.42.1] . +### Releases +- [PyPI v0.42.1] https://pypi.org/project/fabra/0.42.1 - . + +## 2023-09-29 00:05:36 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.91.3 (2.139.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.43.0] . +### Releases +- [PyPI v0.43.0] https://pypi.org/project/fabra/0.43.0 - . + +## 2023-10-01 00:06:25 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.92.2 (2.142.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.44.0] . +### Releases +- [PyPI v0.44.0] https://pypi.org/project/fabra/0.44.0 - . + +## 2023-10-02 00:05:50 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.92.3 (2.143.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.44.1] . +### Releases +- [PyPI v0.44.1] https://pypi.org/project/fabra/0.44.1 - . + +## 2023-10-05 00:05:32 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.94.0 (2.147.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.44.2] . +### Releases +- [PyPI v0.44.2] https://pypi.org/project/fabra/0.44.2 - . + +## 2023-10-07 00:05:28 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.96.1 (2.150.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.45.0] . +### Releases +- [PyPI v0.45.0] https://pypi.org/project/fabra/0.45.0 - . + +## 2023-10-13 00:05:39 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.99.0 (2.154.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.45.1] . +### Releases +- [PyPI v0.45.1] https://pypi.org/project/fabra/0.45.1 - . + +## 2023-10-18 00:05:42 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.101.0 (2.161.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.46.0] . +### Releases +- [PyPI v0.46.0] https://pypi.org/project/fabra/0.46.0 - . + +## 2023-10-21 00:05:44 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.104.0 (2.169.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.47.0] . +### Releases +- [PyPI v0.47.0] https://pypi.org/project/fabra/0.47.0 - . + +## 2023-10-28 00:05:15 +### Changes +Based on: +- OpenAPI Doc 0.1.0 https://fabra-io.github.io/docs/openapi.yaml +- Speakeasy CLI 1.109.0 (2.173.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.47.1] . +### Releases +- [PyPI v0.47.1] https://pypi.org/project/fabra/0.47.1 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 2387a7d..9d4c6bc 100755 --- a/USAGE.md +++ b/USAGE.md @@ -1,7 +1,9 @@ + + ```python import fabra -from fabra.models import operations +from fabra.models import operations, shared s = fabra.Fabra( security=shared.Security( @@ -10,12 +12,13 @@ s = fabra.Fabra( ) req = operations.GetNamespacesRequest( - connection_id=548814, + connection_id=995455, ) res = s.connection.get_namespaces(req) if res.namespaces is not None: # handle response + pass ``` \ No newline at end of file diff --git a/docs/models/operations/createdestinationresponse.md b/docs/models/operations/createdestinationresponse.md index f6c8184..84f2f08 100755 --- a/docs/models/operations/createdestinationresponse.md +++ b/docs/models/operations/createdestinationresponse.md @@ -5,7 +5,7 @@ | 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 | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `create_destination_200_application_json_object` | [Optional[CreateDestination200ApplicationJSON]](../../models/operations/createdestination200applicationjson.md) | :heavy_minus_sign: | Successfully created destination | \ No newline at end of file diff --git a/docs/models/operations/createlinktokenresponse.md b/docs/models/operations/createlinktokenresponse.md index bfd6830..8e4b76a 100755 --- a/docs/models/operations/createlinktokenresponse.md +++ b/docs/models/operations/createlinktokenresponse.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `content_type` | *str* | :heavy_check_mark: | N/A | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | | `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 +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/operations/createobjectresponse.md b/docs/models/operations/createobjectresponse.md index 7b5c28b..99861fa 100755 --- a/docs/models/operations/createobjectresponse.md +++ b/docs/models/operations/createobjectresponse.md @@ -5,7 +5,7 @@ | 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 | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `create_object_200_application_json_object` | [Optional[CreateObject200ApplicationJSON]](../../models/operations/createobject200applicationjson.md) | :heavy_minus_sign: | Successfully created object | \ No newline at end of file diff --git a/docs/models/operations/createsourceresponse.md b/docs/models/operations/createsourceresponse.md index 7472968..03ee581 100755 --- a/docs/models/operations/createsourceresponse.md +++ b/docs/models/operations/createsourceresponse.md @@ -5,7 +5,7 @@ | 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 | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `create_source_200_application_json_object` | [Optional[CreateSource200ApplicationJSON]](../../models/operations/createsource200applicationjson.md) | :heavy_minus_sign: | Successfully created source | \ No newline at end of file diff --git a/docs/models/operations/createsyncresponse.md b/docs/models/operations/createsyncresponse.md index 3fde2b3..b3c7946 100755 --- a/docs/models/operations/createsyncresponse.md +++ b/docs/models/operations/createsyncresponse.md @@ -5,7 +5,7 @@ | 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 | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `create_sync_200_application_json_object` | [Optional[CreateSync200ApplicationJSON]](../../models/operations/createsync200applicationjson.md) | :heavy_minus_sign: | Successfully created sync | \ No newline at end of file diff --git a/docs/models/operations/getdestinations200applicationjson.md b/docs/models/operations/getdestinations200applicationjson.md index 3fc651a..75f61be 100755 --- a/docs/models/operations/getdestinations200applicationjson.md +++ b/docs/models/operations/getdestinations200applicationjson.md @@ -7,4 +7,4 @@ Successfully fetched destinations | Field | Type | Required | Description | | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `destinations` | list[[shared.Destination](../../models/shared/destination.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| `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 index 09187b7..6dff356 100755 --- a/docs/models/operations/getdestinationsresponse.md +++ b/docs/models/operations/getdestinationsresponse.md @@ -5,7 +5,7 @@ | 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 | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `get_destinations_200_application_json_object` | [Optional[GetDestinations200ApplicationJSON]](../../models/operations/getdestinations200applicationjson.md) | :heavy_minus_sign: | Successfully fetched destinations | \ No newline at end of file diff --git a/docs/models/operations/getnamespacesresponse.md b/docs/models/operations/getnamespacesresponse.md index 4969242..99ab01e 100755 --- a/docs/models/operations/getnamespacesresponse.md +++ b/docs/models/operations/getnamespacesresponse.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -| `content_type` | *str* | :heavy_check_mark: | N/A | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | | `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 +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/operations/getobjects200applicationjson.md b/docs/models/operations/getobjects200applicationjson.md index 3288543..ab55136 100755 --- a/docs/models/operations/getobjects200applicationjson.md +++ b/docs/models/operations/getobjects200applicationjson.md @@ -7,4 +7,4 @@ Successfully fetched objects | Field | Type | Required | Description | | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `objects` | list[[shared.Object](../../models/shared/object.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| `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 index 01e381d..41e7300 100755 --- a/docs/models/operations/getobjectsresponse.md +++ b/docs/models/operations/getobjectsresponse.md @@ -5,7 +5,7 @@ | 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 | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `get_objects_200_application_json_object` | [Optional[GetObjects200ApplicationJSON]](../../models/operations/getobjects200applicationjson.md) | :heavy_minus_sign: | Successfully fetched objects | \ No newline at end of file diff --git a/docs/models/operations/getschema200applicationjson.md b/docs/models/operations/getschema200applicationjson.md index 7bbb97c..7d53d63 100755 --- a/docs/models/operations/getschema200applicationjson.md +++ b/docs/models/operations/getschema200applicationjson.md @@ -5,6 +5,6 @@ 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 +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `schema` | List[[shared.Field](../../models/shared/field.md)] | :heavy_minus_sign: | N/A | [object Object],[object Object],[object Object],[object Object] | \ No newline at end of file diff --git a/docs/models/operations/getschemaresponse.md b/docs/models/operations/getschemaresponse.md index 2328b47..b034d6f 100755 --- a/docs/models/operations/getschemaresponse.md +++ b/docs/models/operations/getschemaresponse.md @@ -5,7 +5,7 @@ | 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 | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `get_schema_200_application_json_object` | [Optional[GetSchema200ApplicationJSON]](../../models/operations/getschema200applicationjson.md) | :heavy_minus_sign: | Successfully fetched schema | \ No newline at end of file diff --git a/docs/models/operations/getsources200applicationjson.md b/docs/models/operations/getsources200applicationjson.md index 2141823..bd96ef1 100755 --- a/docs/models/operations/getsources200applicationjson.md +++ b/docs/models/operations/getsources200applicationjson.md @@ -7,4 +7,4 @@ Successfully fetched sources | Field | Type | Required | Description | | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `sources` | list[[shared.Source](../../models/shared/source.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| `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 index 928903a..79cee5d 100755 --- a/docs/models/operations/getsourcesresponse.md +++ b/docs/models/operations/getsourcesresponse.md @@ -5,7 +5,7 @@ | 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 | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `get_sources_200_application_json_object` | [Optional[GetSources200ApplicationJSON]](../../models/operations/getsources200applicationjson.md) | :heavy_minus_sign: | Successfully fetched sources | \ No newline at end of file diff --git a/docs/models/operations/getsyncs200applicationjson.md b/docs/models/operations/getsyncs200applicationjson.md index ec0eebc..5009ee4 100755 --- a/docs/models/operations/getsyncs200applicationjson.md +++ b/docs/models/operations/getsyncs200applicationjson.md @@ -7,4 +7,4 @@ Successfully fetched syncs | Field | Type | Required | Description | | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `syncs` | list[[shared.Sync](../../models/shared/sync.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| `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 index 0a930ba..bd2e189 100755 --- a/docs/models/operations/getsyncsresponse.md +++ b/docs/models/operations/getsyncsresponse.md @@ -5,7 +5,7 @@ | 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 | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `get_syncs_200_application_json_object` | [Optional[GetSyncs200ApplicationJSON]](../../models/operations/getsyncs200applicationjson.md) | :heavy_minus_sign: | Successfully fetched syncs | \ No newline at end of file diff --git a/docs/models/operations/gettables200applicationjson.md b/docs/models/operations/gettables200applicationjson.md index d2bb32a..9081f83 100755 --- a/docs/models/operations/gettables200applicationjson.md +++ b/docs/models/operations/gettables200applicationjson.md @@ -5,6 +5,6 @@ Successfully fetched tables ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `tables` | list[*str*] | :heavy_minus_sign: | N/A | \ No newline at end of file +| 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/gettablesresponse.md b/docs/models/operations/gettablesresponse.md index 63aff55..cc5787e 100755 --- a/docs/models/operations/gettablesresponse.md +++ b/docs/models/operations/gettablesresponse.md @@ -5,7 +5,7 @@ | 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 | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `get_tables_200_application_json_object` | [Optional[GetTables200ApplicationJSON]](../../models/operations/gettables200applicationjson.md) | :heavy_minus_sign: | Successfully fetched tables | \ No newline at end of file diff --git a/docs/models/operations/queryobjectrequestbody.md b/docs/models/operations/queryobjectrequestbody.md index 4f48514..ba40c3c 100755 --- a/docs/models/operations/queryobjectrequestbody.md +++ b/docs/models/operations/queryobjectrequestbody.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `filters` | list[[shared.QueryFilter](../../models/shared/queryfilter.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| `filters` | List[[shared.QueryFilter](../../models/shared/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 index bd5f4b8..3ee1f5a 100755 --- a/docs/models/operations/queryobjectresponse.md +++ b/docs/models/operations/queryobjectresponse.md @@ -5,7 +5,7 @@ | 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 | +| `content_type` | *str* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | `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 diff --git a/docs/models/shared/createlinktokenresponse.md b/docs/models/shared/createlinktokenresponse.md index 21bb022..8e63ad9 100755 --- a/docs/models/shared/createlinktokenresponse.md +++ b/docs/models/shared/createlinktokenresponse.md @@ -1,7 +1,5 @@ # CreateLinkTokenResponse -Successfully created link token - ## Fields diff --git a/docs/models/shared/namespaces.md b/docs/models/shared/namespaces.md index a84026c..a317189 100755 --- a/docs/models/shared/namespaces.md +++ b/docs/models/shared/namespaces.md @@ -1,10 +1,8 @@ # Namespaces -Successfully fetched namespaces - ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `namespaces` | list[*str*] | :heavy_minus_sign: | N/A | \ No newline at end of file +| 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/shared/object.md index be413fa..57d5695 100755 --- a/docs/models/shared/object.md +++ b/docs/models/shared/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[[ObjectField](../../models/shared/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/shared/objectinput.md b/docs/models/shared/objectinput.md index 4c67a62..0ec25d0 100755 --- a/docs/models/shared/objectinput.md +++ b/docs/models/shared/objectinput.md @@ -12,6 +12,6 @@ | `frequency` | *int* | :heavy_check_mark: | N/A | 30 | | `frequency_units` | [FrequencyUnits](../../models/shared/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 | | +| `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 diff --git a/docs/models/shared/sync.md b/docs/models/shared/sync.md index 97ab678..6c5469c 100755 --- a/docs/models/shared/sync.md +++ b/docs/models/shared/sync.md @@ -10,7 +10,7 @@ | `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[[FieldMapping](../../models/shared/fieldmapping.md)] | :heavy_minus_sign: | N/A | [object Object] | | `frequency` | *Optional[int]* | :heavy_minus_sign: | N/A | | | `frequency_units` | [Optional[FrequencyUnits]](../../models/shared/frequencyunits.md) | :heavy_minus_sign: | N/A | | | `id` | *Optional[int]* | :heavy_minus_sign: | N/A | 10 | diff --git a/docs/models/shared/syncinput.md b/docs/models/shared/syncinput.md index 4119cbe..cfc533b 100755 --- a/docs/models/shared/syncinput.md +++ b/docs/models/shared/syncinput.md @@ -10,7 +10,7 @@ | `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[[FieldMapping](../../models/shared/fieldmapping.md)] | :heavy_check_mark: | N/A | [object Object] | | `frequency` | *Optional[int]* | :heavy_minus_sign: | N/A | 30 | | `frequency_units` | [Optional[FrequencyUnits]](../../models/shared/frequencyunits.md) | :heavy_minus_sign: | N/A | | | `namespace` | *Optional[str]* | :heavy_minus_sign: | N/A | end_customer_bigquery_dataset | diff --git a/docs/sdks/connection/README.md b/docs/sdks/connection/README.md index 40cfa39..252c90d 100755 --- a/docs/sdks/connection/README.md +++ b/docs/sdks/connection/README.md @@ -1,4 +1,5 @@ -# connection +# Connection +(*connection*) ## Overview @@ -18,7 +19,7 @@ Get all namespaces ```python import fabra -from fabra.models import operations +from fabra.models import operations, shared s = fabra.Fabra( security=shared.Security( @@ -27,13 +28,14 @@ s = fabra.Fabra( ) req = operations.GetNamespacesRequest( - connection_id=592845, + connection_id=995455, ) res = s.connection.get_namespaces(req) if res.namespaces is not None: # handle response + pass ``` ### Parameters @@ -56,7 +58,7 @@ Get schema for table ```python import fabra -from fabra.models import operations +from fabra.models import operations, shared s = fabra.Fabra( security=shared.Security( @@ -65,15 +67,16 @@ s = fabra.Fabra( ) req = operations.GetSchemaRequest( - connection_id=715190, - namespace='quibusdam', - table_name='unde', + connection_id=367941, + namespace='string', + table_name='string', ) res = s.connection.get_schema(req) if res.get_schema_200_application_json_object is not None: # handle response + pass ``` ### Parameters @@ -96,7 +99,7 @@ Get all tables ```python import fabra -from fabra.models import operations +from fabra.models import operations, shared s = fabra.Fabra( security=shared.Security( @@ -105,14 +108,15 @@ s = fabra.Fabra( ) req = operations.GetTablesRequest( - connection_id=857946, - namespace='corrupti', + connection_id=820803, + namespace='string', ) res = s.connection.get_tables(req) if res.get_tables_200_application_json_object is not None: # handle response + pass ``` ### Parameters diff --git a/docs/sdks/customerdata/README.md b/docs/sdks/customerdata/README.md index f48e827..dc11a9a 100755 --- a/docs/sdks/customerdata/README.md +++ b/docs/sdks/customerdata/README.md @@ -1,4 +1,5 @@ -# customer_data +# CustomerData +(*customer_data*) ### Available Operations @@ -27,28 +28,17 @@ req = operations.QueryObjectRequest( 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( - field_name='user_id', - field_value='2', - ), ], ), - end_customer_id='vel', - object_id=623564, + end_customer_id='string', + object_id=906396, ) res = s.customer_data.query_object(req) if res.query_object_200_application_json_object is not None: # handle response + pass ``` ### Parameters diff --git a/docs/sdks/destination/README.md b/docs/sdks/destination/README.md index 3a989f4..fa3edbb 100755 --- a/docs/sdks/destination/README.md +++ b/docs/sdks/destination/README.md @@ -1,4 +1,5 @@ -# destination +# Destination +(*destination*) ## Overview @@ -30,7 +31,7 @@ req = shared.DestinationInput( credentials='Paste JSON from GCP', location='us-west1', ), - connection_type=shared.ConnectionType.MONGODB, + connection_type=shared.ConnectionType.SNOWFLAKE, display_name='BigQuery', mongodb_config=shared.MongoDbConfig( connection_options='retryWrites=true&w=majority', @@ -59,6 +60,7 @@ res = s.destination.create_destination(req) if res.create_destination_200_application_json_object is not None: # handle response + pass ``` ### Parameters @@ -81,7 +83,7 @@ Get all destinations ```python import fabra - +from fabra.models import shared s = fabra.Fabra( security=shared.Security( @@ -94,6 +96,7 @@ res = s.destination.get_destinations() if res.get_destinations_200_application_json_object is not None: # handle response + pass ``` diff --git a/docs/sdks/fabra/README.md b/docs/sdks/fabra/README.md index f9253da..08b370d 100755 --- 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 index 17a41cb..67f397e 100755 --- a/docs/sdks/linktoken/README.md +++ b/docs/sdks/linktoken/README.md @@ -1,4 +1,5 @@ -# link_token +# LinkToken +(*link_token*) ## Overview @@ -32,6 +33,7 @@ res = s.link_token.create_link_token(req) if res.create_link_token_response is not None: # handle response + pass ``` ### Parameters diff --git a/docs/sdks/object/README.md b/docs/sdks/object/README.md index 2c965bc..bb8d85c 100755 --- a/docs/sdks/object/README.md +++ b/docs/sdks/object/README.md @@ -1,4 +1,5 @@ -# object +# Object +(*object*) ## Overview @@ -31,16 +32,11 @@ req = shared.ObjectInput( display_name='BigQuery', end_customer_id_field='end_customer_id', frequency=30, - frequency_units=shared.FrequencyUnits.HOURS, + frequency_units=shared.FrequencyUnits.MINUTES, namespace='bigquery_dataset', object_fields=[ shared.ObjectField( name='event_name', - type=shared.FieldType.INTEGER, - ), - shared.ObjectField( - name='event_name', - type=shared.FieldType.BOOLEAN, ), ], primary_key='event_id', @@ -51,6 +47,7 @@ res = s.object.create_object(req) if res.create_object_200_application_json_object is not None: # handle response + pass ``` ### Parameters @@ -73,7 +70,7 @@ Get all objects ```python import fabra - +from fabra.models import shared s = fabra.Fabra( security=shared.Security( @@ -86,6 +83,7 @@ res = s.object.get_objects() if res.get_objects_200_application_json_object is not None: # handle response + pass ``` diff --git a/docs/sdks/source/README.md b/docs/sdks/source/README.md index 6509355..d910195 100755 --- a/docs/sdks/source/README.md +++ b/docs/sdks/source/README.md @@ -1,4 +1,5 @@ -# source +# Source +(*source*) ## Overview @@ -30,7 +31,7 @@ req = shared.SourceInput( credentials='Paste JSON from GCP', location='us-west1', ), - connection_type=shared.ConnectionType.SNOWFLAKE, + connection_type=shared.ConnectionType.WEBHOOK, display_name='Frontend Events', end_customer_id='abcd-1234-efgh-5678', mongodb_config=shared.MongoDbConfig( @@ -60,6 +61,7 @@ res = s.source.create_source(req) if res.create_source_200_application_json_object is not None: # handle response + pass ``` ### Parameters @@ -82,7 +84,7 @@ Get all sources ```python import fabra - +from fabra.models import shared s = fabra.Fabra( security=shared.Security( @@ -95,6 +97,7 @@ res = s.source.get_sources() if res.get_sources_200_application_json_object is not None: # handle response + pass ``` diff --git a/docs/sdks/sync/README.md b/docs/sdks/sync/README.md index 4e4145d..acbaa1d 100755 --- a/docs/sdks/sync/README.md +++ b/docs/sdks/sync/README.md @@ -1,4 +1,5 @@ -# sync +# Sync +(*sync*) ## Overview @@ -36,21 +37,8 @@ req = shared.SyncInput( 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( - destination_field_name='event', - source_field_name='event_name', - ), ], frequency=30, - frequency_units=shared.FrequencyUnits.HOURS, namespace='end_customer_bigquery_dataset', object_id=3, primary_key='event_id', @@ -62,6 +50,7 @@ res = s.sync.create_sync(req) if res.create_sync_200_application_json_object is not None: # handle response + pass ``` ### Parameters @@ -84,7 +73,7 @@ Get all syncs ```python import fabra - +from fabra.models import shared s = fabra.Fabra( security=shared.Security( @@ -97,6 +86,7 @@ res = s.sync.get_syncs() if res.get_syncs_200_application_json_object is not None: # handle response + pass ``` diff --git a/files.gen b/files.gen index 7b56972..2303c80 100755 --- a/files.gen +++ b/files.gen @@ -11,6 +11,7 @@ pylintrc setup.py src/fabra/__init__.py src/fabra/models/__init__.py +src/fabra/models/errors/sdkerror.py src/fabra/utils/__init__.py src/fabra/utils/retries.py src/fabra/utils/utils.py @@ -53,14 +54,7 @@ src/fabra/models/shared/fieldmapping.py src/fabra/models/shared/syncinput.py src/fabra/models/shared/security.py src/fabra/models/shared/__init__.py -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 +src/fabra/models/errors/__init__.py USAGE.md docs/models/operations/getnamespacesrequest.md docs/models/operations/getnamespacesresponse.md @@ -115,4 +109,13 @@ docs/models/shared/sourceinput.md docs/models/shared/sync.md docs/models/shared/fieldmapping.md docs/models/shared/syncinput.md -docs/models/shared/security.md \ No newline at end of file +docs/models/shared/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 +.gitattributes \ No newline at end of file diff --git a/gen.yaml b/gen.yaml index df6370a..52db388 100644 --- a/gen.yaml +++ b/gen.yaml @@ -2,16 +2,26 @@ configVersion: 1.0.0 management: docChecksum: a08d8b55b00bfb4ba4828a322fd16614 docVersion: 0.1.0 - speakeasyVersion: 1.49.0 - generationVersion: 2.41.4 + speakeasyVersion: 1.109.0 + generationVersion: 2.173.0 generation: + repoURL: https://github.com/fabra-io/python-sdk.git sdkClassName: Fabra sdkFlattening: false singleTagPerOp: false telemetryEnabled: false +features: + python: + core: 3.3.1 + globalSecurity: 2.82.0 + globalServerURLs: 2.82.0 python: - version: 0.21.0 + version: 0.47.1 author: fabra description: Python Client SDK Generated by Speakeasy + flattenGlobalSecurity: false + installationURL: https://github.com/fabra-io/python-sdk.git maxMethodParams: 0 packageName: fabra + published: true + repoSubDirectory: . diff --git a/pylintrc b/pylintrc index 1ce47d8..1ed3221 100755 --- 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= @@ -438,7 +438,9 @@ 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 # 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 +621,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 index ad4b387..41fa093 100755 --- a/setup.py +++ b/setup.py @@ -10,33 +10,31 @@ setuptools.setup( name="fabra", - version="0.21.0", + version="0.47.1", author="fabra", description="Python Client SDK Generated by Speakeasy", long_description=long_description, 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", + "certifi>=2023.7.22", + "charset-normalizer>=3.2.0", + "dataclasses-json>=0.6.1", + "idna>=3.4", "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", + "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>=2.0.4", ], extras_require={ "dev":["pylint==2.16.2"] }, package_dir={'': 'src'}, - python_requires='>=3.9' + python_requires='>=3.8' ) diff --git a/src/fabra/connection.py b/src/fabra/connection.py index 8bddbf5..ceb3ba6 100755 --- a/src/fabra/connection.py +++ b/src/fabra/connection.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra.models import errors, operations, shared from typing import Optional class Connection: @@ -21,7 +21,7 @@ def get_namespaces(self, request: operations.GetNamespacesRequest) -> operations 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -34,6 +34,8 @@ def get_namespaces(self, request: operations.GetNamespacesRequest) -> operations if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.Namespaces]) res.namespaces = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass @@ -48,7 +50,7 @@ def get_schema(self, request: operations.GetSchemaRequest) -> operations.GetSche 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -61,6 +63,8 @@ def get_schema(self, request: operations.GetSchemaRequest) -> operations.GetSche 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 + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass @@ -75,7 +79,7 @@ def get_tables(self, request: operations.GetTablesRequest) -> operations.GetTabl 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -88,6 +92,8 @@ def get_tables(self, request: operations.GetTablesRequest) -> operations.GetTabl 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 + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass diff --git a/src/fabra/customer_data.py b/src/fabra/customer_data.py index 1e820e5..3d0691b 100755 --- a/src/fabra/customer_data.py +++ b/src/fabra/customer_data.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations +from fabra.models import errors, operations from typing import Optional class CustomerData: @@ -20,11 +20,11 @@ def query_object(self, request: operations.QueryObjectRequest) -> operations.Que 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') + req_content_type, data, form = utils.serialize_request_body(request, "request_body", False, True, 'json') if 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -37,6 +37,8 @@ def query_object(self, request: operations.QueryObjectRequest) -> operations.Que 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 + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass diff --git a/src/fabra/destination.py b/src/fabra/destination.py index 40b368a..2ace525 100755 --- a/src/fabra/destination.py +++ b/src/fabra/destination.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra.models import errors, operations, shared from typing import Optional class Destination: @@ -19,13 +19,13 @@ def create_destination(self, request: shared.DestinationInput) -> operations.Cre url = base_url + '/destination' headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "request", 'json') + req_content_type, data, form = utils.serialize_request_body(request, "request", False, False, 'json') if 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -38,6 +38,8 @@ def create_destination(self, request: shared.DestinationInput) -> operations.Cre 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 + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass @@ -51,7 +53,7 @@ def get_destinations(self) -> operations.GetDestinationsResponse: 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -64,6 +66,8 @@ def get_destinations(self) -> operations.GetDestinationsResponse: 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 + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass diff --git a/src/fabra/link_token.py b/src/fabra/link_token.py index c0d60a3..2390664 100755 --- a/src/fabra/link_token.py +++ b/src/fabra/link_token.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra.models import errors, operations, shared from typing import Optional class LinkToken: @@ -19,13 +19,13 @@ def create_link_token(self, request: shared.CreateLinkTokenRequest) -> operation url = base_url + '/link_token' headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "request", 'json') + req_content_type, data, form = utils.serialize_request_body(request, "request", False, False, 'json') if 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -38,6 +38,8 @@ def create_link_token(self, request: shared.CreateLinkTokenRequest) -> operation if utils.match_content_type(content_type, 'application/json'): out = utils.unmarshal_json(http_res.text, Optional[shared.CreateLinkTokenResponse]) res.create_link_token_response = out + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass diff --git a/src/fabra/models/__init__.py b/src/fabra/models/__init__.py index 889f8ad..36628d6 100755 --- a/src/fabra/models/__init__.py +++ b/src/fabra/models/__init__.py @@ -1,2 +1,3 @@ """Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" +# __init__.py diff --git a/src/fabra/models/errors/__init__.py b/src/fabra/models/errors/__init__.py new file mode 100755 index 0000000..cfd8484 --- /dev/null +++ b/src/fabra/models/errors/__init__.py @@ -0,0 +1,4 @@ +"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" + +from .sdkerror import SDKError +__all__ = ["SDKError"] diff --git a/src/fabra/models/errors/sdkerror.py b/src/fabra/models/errors/sdkerror.py new file mode 100755 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/create_destination.py b/src/fabra/models/operations/create_destination.py index 5399c44..17f1f9e 100755 --- a/src/fabra/models/operations/create_destination.py +++ b/src/fabra/models/operations/create_destination.py @@ -10,7 +10,6 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class CreateDestination200ApplicationJSON: r"""Successfully created destination""" @@ -19,13 +18,15 @@ class CreateDestination200ApplicationJSON: - @dataclasses.dataclass class CreateDestinationResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" create_destination_200_application_json_object: Optional[CreateDestination200ApplicationJSON] = dataclasses.field(default=None) r"""Successfully created destination""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/create_link_token.py b/src/fabra/models/operations/create_link_token.py index 75b8ee2..5e26662 100755 --- a/src/fabra/models/operations/create_link_token.py +++ b/src/fabra/models/operations/create_link_token.py @@ -7,13 +7,15 @@ from typing import Optional - @dataclasses.dataclass class CreateLinkTokenResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" create_link_token_response: Optional[shared_createlinktokenresponse.CreateLinkTokenResponse] = dataclasses.field(default=None) r"""Successfully created link token""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/create_object.py b/src/fabra/models/operations/create_object.py index 6cf0dc0..72055e5 100755 --- a/src/fabra/models/operations/create_object.py +++ b/src/fabra/models/operations/create_object.py @@ -10,7 +10,6 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class CreateObject200ApplicationJSON: r"""Successfully created object""" @@ -19,13 +18,15 @@ class CreateObject200ApplicationJSON: - @dataclasses.dataclass class CreateObjectResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" create_object_200_application_json_object: Optional[CreateObject200ApplicationJSON] = dataclasses.field(default=None) r"""Successfully created object""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/create_source.py b/src/fabra/models/operations/create_source.py index 3013645..20960ea 100755 --- a/src/fabra/models/operations/create_source.py +++ b/src/fabra/models/operations/create_source.py @@ -10,7 +10,6 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class CreateSource200ApplicationJSON: r"""Successfully created source""" @@ -19,13 +18,15 @@ class CreateSource200ApplicationJSON: - @dataclasses.dataclass class CreateSourceResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" create_source_200_application_json_object: Optional[CreateSource200ApplicationJSON] = dataclasses.field(default=None) r"""Successfully created source""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/create_sync.py b/src/fabra/models/operations/create_sync.py index f71d5a1..3b74aca 100755 --- a/src/fabra/models/operations/create_sync.py +++ b/src/fabra/models/operations/create_sync.py @@ -10,7 +10,6 @@ @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class CreateSync200ApplicationJSON: r"""Successfully created sync""" @@ -19,13 +18,15 @@ class CreateSync200ApplicationJSON: - @dataclasses.dataclass class CreateSyncResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" create_sync_200_application_json_object: Optional[CreateSync200ApplicationJSON] = dataclasses.field(default=None) r"""Successfully created sync""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/get_destinations.py b/src/fabra/models/operations/get_destinations.py index 0036b50..83ae6be 100755 --- a/src/fabra/models/operations/get_destinations.py +++ b/src/fabra/models/operations/get_destinations.py @@ -6,26 +6,27 @@ from ..shared import destination as shared_destination 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: 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[shared_destination.Destination]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('destinations'), 'exclude': lambda f: f is None }}) - @dataclasses.dataclass class GetDestinationsResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" get_destinations_200_application_json_object: Optional[GetDestinations200ApplicationJSON] = dataclasses.field(default=None) r"""Successfully fetched destinations""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/get_namespaces.py b/src/fabra/models/operations/get_namespaces.py index 128addc..b530ac6 100755 --- a/src/fabra/models/operations/get_namespaces.py +++ b/src/fabra/models/operations/get_namespaces.py @@ -7,7 +7,6 @@ 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 +14,15 @@ class GetNamespacesRequest: - @dataclasses.dataclass class GetNamespacesResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" namespaces: Optional[shared_namespaces.Namespaces] = dataclasses.field(default=None) r"""Successfully fetched namespaces""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/get_objects.py b/src/fabra/models/operations/get_objects.py index 14668f2..385d6d3 100755 --- a/src/fabra/models/operations/get_objects.py +++ b/src/fabra/models/operations/get_objects.py @@ -6,26 +6,27 @@ from ..shared import object as shared_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: 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[shared_object.Object]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('objects'), 'exclude': lambda f: f is None }}) - @dataclasses.dataclass class GetObjectsResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" get_objects_200_application_json_object: Optional[GetObjects200ApplicationJSON] = dataclasses.field(default=None) r"""Successfully fetched objects""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/get_schema.py b/src/fabra/models/operations/get_schema.py index a1e3b43..8b4eba8 100755 --- a/src/fabra/models/operations/get_schema.py +++ b/src/fabra/models/operations/get_schema.py @@ -6,8 +6,7 @@ from ..shared import field as shared_field 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,23 @@ class GetSchemaRequest: @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class GetSchema200ApplicationJSON: 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[shared_field.Field]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('schema'), 'exclude': lambda f: f is None }}) - @dataclasses.dataclass class GetSchemaResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" get_schema_200_application_json_object: Optional[GetSchema200ApplicationJSON] = dataclasses.field(default=None) r"""Successfully fetched schema""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/get_sources.py b/src/fabra/models/operations/get_sources.py index 5672f1b..9203ca0 100755 --- a/src/fabra/models/operations/get_sources.py +++ b/src/fabra/models/operations/get_sources.py @@ -6,26 +6,27 @@ from ..shared import source as shared_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: 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[shared_source.Source]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('sources'), 'exclude': lambda f: f is None }}) - @dataclasses.dataclass class GetSourcesResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" get_sources_200_application_json_object: Optional[GetSources200ApplicationJSON] = dataclasses.field(default=None) r"""Successfully fetched sources""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/get_syncs.py b/src/fabra/models/operations/get_syncs.py index 6b85c64..c20ed06 100755 --- a/src/fabra/models/operations/get_syncs.py +++ b/src/fabra/models/operations/get_syncs.py @@ -6,26 +6,27 @@ from ..shared import sync as shared_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: 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[shared_sync.Sync]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('syncs'), 'exclude': lambda f: f is None }}) - @dataclasses.dataclass class GetSyncsResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" get_syncs_200_application_json_object: Optional[GetSyncs200ApplicationJSON] = dataclasses.field(default=None) r"""Successfully fetched syncs""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/get_tables.py b/src/fabra/models/operations/get_tables.py index e0e396f..e972da4 100755 --- a/src/fabra/models/operations/get_tables.py +++ b/src/fabra/models/operations/get_tables.py @@ -5,8 +5,7 @@ import requests as requests_http 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,23 @@ class GetTablesRequest: @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class GetTables200ApplicationJSON: 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 }}) - @dataclasses.dataclass class GetTablesResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" get_tables_200_application_json_object: Optional[GetTables200ApplicationJSON] = dataclasses.field(default=None) r"""Successfully fetched tables""" raw_response: Optional[requests_http.Response] = dataclasses.field(default=None) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/operations/query_object.py b/src/fabra/models/operations/query_object.py index c47c19a..332aa76 100755 --- a/src/fabra/models/operations/query_object.py +++ b/src/fabra/models/operations/query_object.py @@ -6,19 +6,17 @@ from ..shared import queryfilter as shared_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[shared_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,7 +27,6 @@ class QueryObjectRequest: @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class QueryObject200ApplicationJSONExampleField3: 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 }}) @@ -39,7 +36,6 @@ class QueryObject200ApplicationJSONExampleField3: @dataclass_json(undefined=Undefined.EXCLUDE) - @dataclasses.dataclass class QueryObject200ApplicationJSON: r"""The response payload will match the schema you defined when creating the object""" @@ -50,13 +46,15 @@ class QueryObject200ApplicationJSON: - @dataclasses.dataclass class QueryObjectResponse: content_type: str = dataclasses.field() + r"""HTTP response content type for this operation""" status_code: int = dataclasses.field() + r"""HTTP response status code for this operation""" query_object_200_application_json_object: Optional[QueryObject200ApplicationJSON] = 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) + r"""Raw HTTP response; suitable for custom response parsing""" diff --git a/src/fabra/models/shared/bigqueryconfig.py b/src/fabra/models/shared/bigqueryconfig.py index 76bfcb6..371e295 100755 --- a/src/fabra/models/shared/bigqueryconfig.py +++ b/src/fabra/models/shared/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/shared/connection.py index 22fec5a..9390d5f 100755 --- a/src/fabra/models/shared/connection.py +++ b/src/fabra/models/shared/connection.py @@ -9,7 +9,6 @@ @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 }}) diff --git a/src/fabra/models/shared/createlinktokenrequest.py b/src/fabra/models/shared/createlinktokenrequest.py index 5ca5630..e565f56 100755 --- a/src/fabra/models/shared/createlinktokenrequest.py +++ b/src/fabra/models/shared/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/shared/createlinktokenresponse.py index 0dfeedf..6a5590a 100755 --- a/src/fabra/models/shared/createlinktokenresponse.py +++ b/src/fabra/models/shared/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/shared/destination.py index cc87433..deff667 100755 --- a/src/fabra/models/shared/destination.py +++ b/src/fabra/models/shared/destination.py @@ -9,7 +9,6 @@ @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 }}) diff --git a/src/fabra/models/shared/destinationinput.py b/src/fabra/models/shared/destinationinput.py index e986e18..fa07114 100755 --- a/src/fabra/models/shared/destinationinput.py +++ b/src/fabra/models/shared/destinationinput.py @@ -13,7 +13,6 @@ @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') }}) diff --git a/src/fabra/models/shared/field.py b/src/fabra/models/shared/field.py index 7dbd231..b8af4af 100755 --- a/src/fabra/models/shared/field.py +++ b/src/fabra/models/shared/field.py @@ -9,7 +9,6 @@ @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 }}) diff --git a/src/fabra/models/shared/fieldmapping.py b/src/fabra/models/shared/fieldmapping.py index 2756ef3..0c8d777 100755 --- a/src/fabra/models/shared/fieldmapping.py +++ b/src/fabra/models/shared/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/mongodbconfig.py b/src/fabra/models/shared/mongodbconfig.py index 2500a9e..749acc0 100755 --- a/src/fabra/models/shared/mongodbconfig.py +++ b/src/fabra/models/shared/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/shared/namespaces.py index 020c341..d03d5ad 100755 --- a/src/fabra/models/shared/namespaces.py +++ b/src/fabra/models/shared/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/shared/object.py index cd30b07..6c27e49 100755 --- a/src/fabra/models/shared/object.py +++ b/src/fabra/models/shared/object.py @@ -5,11 +5,10 @@ from ..shared import objectfield as shared_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[shared_objectfield.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/shared/objectfield.py index fedc4fc..48f6c04 100755 --- a/src/fabra/models/shared/objectfield.py +++ b/src/fabra/models/shared/objectfield.py @@ -9,7 +9,6 @@ @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 }}) diff --git a/src/fabra/models/shared/objectinput.py b/src/fabra/models/shared/objectinput.py index f42c59a..0594096 100755 --- a/src/fabra/models/shared/objectinput.py +++ b/src/fabra/models/shared/objectinput.py @@ -6,11 +6,10 @@ from ..shared import objectfield as shared_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') }}) @@ -22,7 +21,7 @@ class ObjectInput: 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[shared_objectfield.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/shared/queryfilter.py index a224db1..1bd89d3 100755 --- a/src/fabra/models/shared/queryfilter.py +++ b/src/fabra/models/shared/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/shared/redshiftconfig.py index b5bafe7..6f8a6f1 100755 --- a/src/fabra/models/shared/redshiftconfig.py +++ b/src/fabra/models/shared/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/shared/security.py index 4d93a03..c1a10e8 100755 --- a/src/fabra/models/shared/security.py +++ b/src/fabra/models/shared/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/shared/snowflakeconfig.py index f6698d1..e31a529 100755 --- a/src/fabra/models/shared/snowflakeconfig.py +++ b/src/fabra/models/shared/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/shared/source.py index 49859c0..d30a33e 100755 --- a/src/fabra/models/shared/source.py +++ b/src/fabra/models/shared/source.py @@ -9,7 +9,6 @@ @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 }}) diff --git a/src/fabra/models/shared/sourceinput.py b/src/fabra/models/shared/sourceinput.py index 1a2b804..ccb25e7 100755 --- a/src/fabra/models/shared/sourceinput.py +++ b/src/fabra/models/shared/sourceinput.py @@ -13,7 +13,6 @@ @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') }}) diff --git a/src/fabra/models/shared/sync.py b/src/fabra/models/shared/sync.py index 8c43f39..0696635 100755 --- a/src/fabra/models/shared/sync.py +++ b/src/fabra/models/shared/sync.py @@ -6,11 +6,10 @@ from ..shared import frequencyunits as shared_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,7 +17,7 @@ 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[shared_fieldmapping.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 }}) 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/syncinput.py b/src/fabra/models/shared/syncinput.py index 7136816..212bc96 100755 --- a/src/fabra/models/shared/syncinput.py +++ b/src/fabra/models/shared/syncinput.py @@ -6,17 +6,16 @@ from ..shared import frequencyunits as shared_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[shared_fieldmapping.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 }}) diff --git a/src/fabra/object.py b/src/fabra/object.py index 4ec71f3..8d81dc3 100755 --- a/src/fabra/object.py +++ b/src/fabra/object.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra.models import errors, operations, shared from typing import Optional class Object: @@ -19,13 +19,13 @@ def create_object(self, request: shared.ObjectInput) -> operations.CreateObjectR url = base_url + '/object' headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "request", 'json') + req_content_type, data, form = utils.serialize_request_body(request, "request", False, False, 'json') if 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -38,6 +38,8 @@ def create_object(self, request: shared.ObjectInput) -> operations.CreateObjectR 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 + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass @@ -51,7 +53,7 @@ def get_objects(self) -> operations.GetObjectsResponse: 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -64,6 +66,8 @@ def get_objects(self) -> operations.GetObjectsResponse: 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 + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass diff --git a/src/fabra/sdk.py b/src/fabra/sdk.py index 24343a7..bb36755 100755 --- a/src/fabra/sdk.py +++ b/src/fabra/sdk.py @@ -11,6 +11,7 @@ from .sync import Sync from fabra import utils from fabra.models import shared +from typing import Dict class Fabra: connection: Connection @@ -33,8 +34,9 @@ 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 + url_params: Dict[str, str] = None, + client: requests_http.Session = None, + retry_config: utils.RetryConfig = None ) -> None: """Instantiates the SDK configuring it with the provided parameters. @@ -45,20 +47,24 @@ def __init__(self, :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: utils.RetryConfig """ if client is None: client = requests_http.Session() + security_client = utils.configure_security_client(client, security) + 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_client, server_url, server_idx) + self.sdk_configuration = SDKConfiguration(client, security_client, server_url, server_idx, retry_config=retry_config) self._init_sdks() diff --git a/src/fabra/sdkconfiguration.py b/src/fabra/sdkconfiguration.py index d92dfa5..6e4c38b 100755 --- a/src/fabra/sdkconfiguration.py +++ b/src/fabra/sdkconfiguration.py @@ -2,6 +2,9 @@ import requests from dataclasses import dataclass +from typing import Dict, Tuple +from .utils.retries import RetryConfig +from .utils import utils SERVERS = [ @@ -17,12 +20,14 @@ class SDKConfiguration: server_idx: 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.47.1' + gen_version: str = '2.173.0' + user_agent: str = 'speakeasy-sdk/python 0.47.1 2.173.0 0.1.0 fabra' + retry_config: RetryConfig = None - def get_server_details(self) -> tuple[str, dict[str, str]]: + def get_server_details(self) -> Tuple[str, Dict[str, str]]: if self.server_url: - return self.server_url.removesuffix('/'), {} + return utils.remove_suffix(self.server_url, '/'), {} if self.server_idx is None: self.server_idx = 0 diff --git a/src/fabra/source.py b/src/fabra/source.py index 9920414..ba18d2c 100755 --- a/src/fabra/source.py +++ b/src/fabra/source.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra.models import errors, operations, shared from typing import Optional class Source: @@ -19,13 +19,13 @@ def create_source(self, request: shared.SourceInput) -> operations.CreateSourceR url = base_url + '/source' headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "request", 'json') + req_content_type, data, form = utils.serialize_request_body(request, "request", False, False, 'json') if 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -38,6 +38,8 @@ def create_source(self, request: shared.SourceInput) -> operations.CreateSourceR 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 + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass @@ -51,7 +53,7 @@ def get_sources(self) -> operations.GetSourcesResponse: 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -64,6 +66,8 @@ def get_sources(self) -> operations.GetSourcesResponse: 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 + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass diff --git a/src/fabra/sync.py b/src/fabra/sync.py index fd9d6e7..f634121 100755 --- a/src/fabra/sync.py +++ b/src/fabra/sync.py @@ -2,7 +2,7 @@ from .sdkconfiguration import SDKConfiguration from fabra import utils -from fabra.models import operations, shared +from fabra.models import errors, operations, shared from typing import Optional class Sync: @@ -19,13 +19,13 @@ def create_sync(self, request: shared.SyncInput) -> operations.CreateSyncRespons url = base_url + '/sync' headers = {} - req_content_type, data, form = utils.serialize_request_body(request, "request", 'json') + req_content_type, data, form = utils.serialize_request_body(request, "request", False, False, 'json') if 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -38,6 +38,8 @@ def create_sync(self, request: shared.SyncInput) -> operations.CreateSyncRespons 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 + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass @@ -51,7 +53,7 @@ def get_syncs(self) -> operations.GetSyncsResponse: 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}' + headers['user-agent'] = self.sdk_configuration.user_agent client = self.sdk_configuration.security_client @@ -64,6 +66,8 @@ def get_syncs(self) -> operations.GetSyncsResponse: 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 + else: + raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res) elif http_res.status_code in [401, 500]: pass diff --git a/src/fabra/utils/retries.py b/src/fabra/utils/retries.py index 2138c1b..25f49a1 100755 --- 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 diff --git a/src/fabra/utils/utils.py b/src/fabra/utils/utils.py index 6b39ecf..3ab1261 100755 --- a/src/fabra/utils/utils.py +++ b/src/fabra/utils/utils.py @@ -3,11 +3,14 @@ import base64 import json import re +import sys from dataclasses import Field, dataclass, 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 import dateutil.parser @@ -17,14 +20,14 @@ class SecurityClient: client: requests.Session - query_params: dict[str, str] = {} + 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 + kwargs["params"] = {**self.query_params, **params} return self.client.request(method, url, **kwargs) @@ -67,7 +70,7 @@ def _parse_security_option(client: SecurityClient, option: dataclass): client, metadata, getattr(option, opt_field.name)) -def _parse_security_scheme(client: SecurityClient, scheme_metadata: dict, scheme: any): +def _parse_security_scheme(client: SecurityClient, scheme_metadata: Dict, scheme: any): scheme_type = scheme_metadata.get('type') sub_type = scheme_metadata.get('sub_type') @@ -91,7 +94,7 @@ def _parse_security_scheme(client: SecurityClient, scheme_metadata: dict, scheme client, scheme_metadata, scheme_metadata, scheme) -def _parse_security_scheme_value(client: SecurityClient, scheme_metadata: dict, security_metadata: dict, value: any): +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') @@ -112,7 +115,8 @@ def _parse_security_scheme_value(client: SecurityClient, scheme_metadata: dict, 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}' + client.client.headers[header_name] = value.lower().startswith( + 'bearer ') and value or f'Bearer {value}' else: raise Exception('not supported') else: @@ -142,7 +146,7 @@ def _parse_basic_auth_scheme(client: SecurityClient, scheme: dataclass): def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass, - gbls: dict[str, dict[str, dict[str, Any]]] = None) -> str: + gbls: Dict[str, Dict[str, Dict[str, Any]]] = None) -> str: path_param_fields: Tuple[Field, ...] = fields(clazz) for field in path_param_fields: request_metadata = field.metadata.get('request') @@ -171,16 +175,16 @@ def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass '{' + key + '}', value, 1) else: if param_metadata.get('style', 'simple') == 'simple': - if isinstance(param, list): - pp_vals: list[str] = [] + 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] = [] + elif isinstance(param, Dict): + pp_vals: List[str] = [] for pp_key in param: if param[pp_key] is None: continue @@ -192,8 +196,8 @@ def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass 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] = [] + 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( @@ -219,14 +223,14 @@ def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass path = path.replace( '{' + param_metadata.get('field_name', field.name) + '}', _val_to_string(param), 1) - return server_url.removesuffix("/") + path + return remove_suffix(server_url, '/') + path 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) @@ -234,9 +238,9 @@ def template_url(url_with_params: str, params: dict[str, str]) -> str: 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(clazz: type, query_params: dataclass, gbls: Dict[str, Dict[str, Dict[str, Any]]] = None) -> Dict[ + str, List[str]]: + params: Dict[str, List[str]] = {} param_fields: Tuple[Field, ...] = fields(clazz) for field in param_fields: @@ -266,24 +270,24 @@ def get_query_params(clazz: type, query_params: dataclass, gbls: dict[str, dict[ else: style = metadata.get('style', 'form') if style == 'deepObject': - params = params | _get_deep_object_query_params( - metadata, f_name, value) + params = {**params, **_get_deep_object_query_params( + metadata, f_name, value)} elif style == 'form': - params = params | _get_delimited_query_params( - metadata, f_name, value, ",") + params = {**params, **_get_delimited_query_params( + metadata, f_name, value, ",")} elif style == 'pipeDelimited': - params = params | _get_delimited_query_params( - metadata, f_name, value, "|") + params = {**params, **_get_delimited_query_params( + metadata, f_name, value, "|")} else: raise Exception('not yet implemented') return params -def get_headers(headers_params: dataclass) -> dict[str, str]: +def get_headers(headers_params: dataclass) -> Dict[str, str]: if headers_params is None: return {} - headers: dict[str, str] = {} + headers: Dict[str, str] = {} param_fields: Tuple[Field, ...] = fields(headers_params) for field in param_fields: @@ -300,8 +304,8 @@ def get_headers(headers_params: dataclass) -> dict[str, str]: return headers -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_name: str, obj: any) -> Dict[str, str]: + params: Dict[str, str] = {} serialization = metadata.get('serialization', '') if serialization == 'json': @@ -310,8 +314,8 @@ def _get_serialized_params(metadata: dict, field_name: str, obj: any) -> dict[st 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 _get_deep_object_query_params(metadata: Dict, field_name: str, obj: any) -> Dict[str, List[str]]: + params: Dict[str, List[str]] = {} if obj is None: return params @@ -327,7 +331,7 @@ 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 @@ -345,12 +349,12 @@ def _get_deep_object_query_params(metadata: dict, field_name: str, obj: any) -> 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): + 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 @@ -376,8 +380,8 @@ 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]]: +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) @@ -390,17 +394,22 @@ def _get_delimited_query_params(metadata: dict, field_name: str, obj: any, delim } -def serialize_request_body(request: dataclass, request_field_name: str, serialization_method: str) -> Tuple[ - str, any, any]: +def serialize_request_body(request: dataclass, request_field_name: str, nullable: bool, optional: bool, serialization_method: str, encoder=None) -> Tuple[ + str, any, 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) + 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 @@ -416,9 +425,9 @@ def serialize_request_body(request: dataclass, request_field_name: str, serializ request_val) -def serialize_content_type(field_name: str, media_type: str, request: dataclass) -> Tuple[str, any, list[list[any]]]: +def serialize_content_type(field_name: str, media_type: str, request: dataclass, encoder=None) -> 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 + return media_type, marshal_json(request, 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: @@ -432,8 +441,8 @@ def serialize_content_type(field_name: str, media_type: str, request: dataclass) 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: dataclass) -> Tuple[str, any, List[List[any]]]: + form: List[List[any]] = [] request_fields = fields(request) for field in request_fields: @@ -474,7 +483,7 @@ def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str, else: field_name = field_metadata.get( "field_name", field.name) - if isinstance(val, list): + if isinstance(val, List): for value in val: if value is None: continue @@ -485,8 +494,8 @@ def serialize_multipart_form(media_type: str, request: dataclass) -> Tuple[str, 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 = [] @@ -506,8 +515,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: dataclass) -> Dict[str, any]: + form: Dict[str, List[str]] = {} if is_dataclass(data): for field in fields(data): @@ -525,12 +534,12 @@ def serialize_form_data(field_name: str, data: dataclass) -> dict[str, any]: form[field_name] = [marshal_json(val)] else: if metadata.get('style', 'form') == 'form': - form = form | _populate_form( - field_name, metadata.get('explode', True), val, _get_form_field_name, ",") + form = {**form, **_populate_form( + field_name, metadata.get('explode', True), val, _get_form_field_name, ",")} else: raise Exception( f'Invalid form style for field {field.name}') - elif isinstance(data, dict): + elif isinstance(data, Dict): for key, value in data.items(): form[key] = [_val_to_string(value)] else: @@ -549,8 +558,8 @@ def _get_form_field_name(obj_field: Field) -> str: 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]] = {} + Dict[str, List[str]]: + params: Dict[str, List[str]] = {} if obj is None: return params @@ -576,7 +585,7 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f if len(items) > 0: params[field_name] = [delimiter.join(items)] - elif isinstance(obj, dict): + elif isinstance(obj, Dict): items = [] for key, value in obj.items(): if value is None: @@ -589,7 +598,7 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f if len(items) > 0: params[field_name] = [delimiter.join(items)] - elif isinstance(obj, list): + elif isinstance(obj, List): items = [] for value in obj: @@ -604,7 +613,8 @@ def _populate_form(field_name: str, explode: boolean, obj: any, get_field_name_f items.append(_val_to_string(value)) if len(items) > 0: - params[field_name] = [delimiter.join([str(item) for item in items])] + params[field_name] = [delimiter.join( + [str(item) for item in items])] else: params[field_name] = [_val_to_string(obj)] @@ -642,7 +652,7 @@ def _serialize_header(explode: bool, obj: any) -> str: if len(items) > 0: return ','.join(items) - elif isinstance(obj, dict): + elif isinstance(obj, Dict): items = [] for key, value in obj.items(): @@ -657,7 +667,7 @@ def _serialize_header(explode: bool, obj: any) -> str: if len(items) > 0: return ','.join([str(item) for item in items]) - elif isinstance(obj, list): + elif isinstance(obj, List): items = [] for value in obj: @@ -674,20 +684,28 @@ def _serialize_header(explode: bool, obj: any) -> str: return '' -def unmarshal_json(data, typ): - unmarhsal = make_dataclass('Unmarhsal', [('res', typ)], +def unmarshal_json(data, typ, decoder=None): + 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}) + except AttributeError as attr_err: + raise AttributeError( + f'unable to unmarshal {data} as {typ}') from attr_err + + return out.res if decoder is None else decoder(out.res) -def marshal_json(val): +def marshal_json(val, encoder=None): marshal = make_dataclass('Marshal', [('res', type(val))], 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) def match_content_type(content_type: str, pattern: str) -> boolean: @@ -731,6 +749,106 @@ 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 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 @@ -749,7 +867,7 @@ def _val_to_string(val): return str(val) -def _populate_from_globals(param_name: str, value: any, param_type: str, gbls: dict[str, dict[str, dict[str, Any]]]): +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']: @@ -759,3 +877,16 @@ def _populate_from_globals(param_name: str, value: any, param_type: str, gbls: d value = global_value return value + + +def decoder_with_discriminator(field_name): + def decode_fx(obj): + kls = getattr(sys.modules['sdk.models.shared'], obj[field_name]) + return unmarshal_json(json.dumps(obj), kls) + return decode_fx + + +def remove_suffix(input_string, suffix): + if suffix and input_string.endswith(suffix): + return input_string[:-len(suffix)] + return input_string