Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
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.
1 change: 1 addition & 0 deletions devcycle_python_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions devcycle_python_sdk/api/dvc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = {}

Expand Down
3 changes: 3 additions & 0 deletions devcycle_python_sdk/dvc_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class DVCOptions:
def __init__(self, enableEdgeDB=False):
self.enableEdgeDB = enableEdgeDB
4 changes: 3 additions & 1 deletion docs/Feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions example/example.py
Original file line number Diff line number Diff line change
@@ -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',
Expand Down