From aa02fa03132c38cada49f2b0708994b118485323 Mon Sep 17 00:00:00 2001 From: Emma Willis Date: Wed, 15 Jun 2022 11:28:49 -0400 Subject: [PATCH] Add enableEdgeDB option --- README.md | 10 +++++++++- devcycle_python_sdk/__init__.py | 1 + devcycle_python_sdk/api/dvc_client.py | 15 +++++++++++++-- devcycle_python_sdk/dvc_options.py | 3 +++ docs/Feature.md | 4 +++- example/example.py | 8 ++++---- 6 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 devcycle_python_sdk/dvc_options.py diff --git a/README.md b/README.md index ada6329..94235f0 100644 --- a/README.md +++ b/README.md @@ -39,4 +39,12 @@ import devcycle_python_sdk ## Usage -To find usage documentation, visit our [docs](https://docs.devcycle.com/docs/sdk/server-side-sdks/python#usage). \ No newline at end of file +To find usage documentation, visit our [docs](https://docs.devcycle.com/docs/sdk/server-side-sdks/python#usage). + +## Development + +To run the example app against the local version of the API for testing and development, run: +```sh +pip install . +``` +from the top level of the repo (same level as setup.py). Then run the example app as normal. Reinstall every time a change is made. diff --git a/devcycle_python_sdk/__init__.py b/devcycle_python_sdk/__init__.py index dbe21c5..7990649 100644 --- a/devcycle_python_sdk/__init__.py +++ b/devcycle_python_sdk/__init__.py @@ -16,6 +16,7 @@ # import apis into sdk package from devcycle_python_sdk.api.dvc_client import DVCClient +from devcycle_python_sdk.dvc_options import DVCOptions # import ApiClient from devcycle_python_sdk.api_client import ApiClient from devcycle_python_sdk.configuration import Configuration diff --git a/devcycle_python_sdk/api/dvc_client.py b/devcycle_python_sdk/api/dvc_client.py index 4760caa..4d8b38c 100644 --- a/devcycle_python_sdk/api/dvc_client.py +++ b/devcycle_python_sdk/api/dvc_client.py @@ -19,7 +19,7 @@ from devcycle_python_sdk.api_client import ApiClient from devcycle_python_sdk.models import UserData, Event, Variable - +from devcycle_python_sdk.dvc_options import DVCOptions class DVCClient(object): """NOTE: This class is auto generated by the swagger code generator program. @@ -28,7 +28,10 @@ class DVCClient(object): Ref: https://github.com/swagger-api/swagger-codegen """ - def __init__(self, configuration=None): + def __init__(self, configuration=None, options=None): + if(options is None): + options = DVCOptions() + self.options = options api_client = ApiClient(configuration) self.api_client = api_client @@ -96,6 +99,9 @@ def all_features_with_http_info(self, body, **kwargs): # noqa: E501 query_params = [] + if (self.options.enableEdgeDB): + query_params.append(('enableEdgeDB', 'true')) + header_params = {} form_params = [] @@ -208,6 +214,9 @@ def variable_with_http_info(self, body, key, default_value, **kwargs): # noqa: query_params = [] + if (self.options.enableEdgeDB): + query_params.append(('enableEdgeDB', 'true')) + header_params = {} form_params = [] @@ -311,6 +320,8 @@ def all_variables_with_http_info(self, body, **kwargs): # noqa: E501 path_params = {} query_params = [] + if (self.options.enableEdgeDB): + query_params.append(('enableEdgeDB', 'true')) header_params = {} diff --git a/devcycle_python_sdk/dvc_options.py b/devcycle_python_sdk/dvc_options.py new file mode 100644 index 0000000..785d860 --- /dev/null +++ b/devcycle_python_sdk/dvc_options.py @@ -0,0 +1,3 @@ +class DVCOptions: + def __init__(self, enableEdgeDB=False): + self.enableEdgeDB = enableEdgeDB diff --git a/docs/Feature.md b/docs/Feature.md index bc85d07..69d0b86 100644 --- a/docs/Feature.md +++ b/docs/Feature.md @@ -6,7 +6,9 @@ Name | Type | Description | Notes **id** | **str** | unique database id | **key** | **str** | Unique key by Project, can be used in the SDK / API to reference by 'key' rather than _id. | **type** | **str** | Feature type | -**variation** | **str** | Bucketed feature variation | +**variation** | **str** | Bucketed feature variation ID | +**variationKey** | **str** | Bucketed feature variation key | +**variationName** | **str** | Bucketed feature variation name | **eval_reason** | **str** | Evaluation reasoning | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/example/example.py b/example/example.py index 611a7d7..c16dcd2 100644 --- a/example/example.py +++ b/example/example.py @@ -1,14 +1,14 @@ from __future__ import print_function -from devcycle_python_sdk import Configuration, DVCClient, UserData, Event, Variable +from devcycle_python_sdk import Configuration, DVCClient, DVCOptions, UserData, Event, Variable from devcycle_python_sdk.rest import ApiException def main(): configuration = Configuration() - configuration.api_key['Authorization'] = 'server-1bf0c139-6861-41e1-8d2d-ea0416045f99' - + configuration.api_key['Authorization'] = 'YOUR SERVER KEY HERE' + options = DVCOptions(enableEdgeDB=True) # create an instance of the API class - dvc = DVCClient(configuration) + dvc = DVCClient(configuration, options) user = UserData( user_id='test',