diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 869d404..7425762 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.1.0 +current_version = 1.0.0 commit = False tag = False diff --git a/README.md b/README.md index eb959a9..3bd9225 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ For information about the API itself, head on over to our Just use everyone's favourite python package installer: `pip` ```bash -pip install python-dialpad +pip install python-dialpad-httpx-open ``` ## Usage diff --git a/dev_requirements.txt b/dev_requirements.txt index 97a8551..f48704b 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -9,4 +9,4 @@ bump2version swagger-spec-validator == 2.7.3 swagger-stub == 0.2.1 jsonschema<4.0 -git+https://github.com/jakedialpad/swagger-parser@v1.0.1b#egg=swagger-parser +git+https://github.com/gaureshdialpad/swagger-parser@v1.0.1b#egg=swagger-parser diff --git a/dialpad/client.py b/dialpad/client.py index 985a778..7c1e726 100644 --- a/dialpad/client.py +++ b/dialpad/client.py @@ -10,6 +10,7 @@ UserResource, CallResource, NumberResource, + OAuthAppsResource, OfficeResource, WebhookResource, CompanyResource, @@ -149,6 +150,10 @@ def event_subscription(self): def number(self): return NumberResource(self) + @cached_property + def oauth_apps(self): + return OAuthAppsResource(self) + @cached_property def office(self): return OfficeResource(self) diff --git a/dialpad/resources/__init__.py b/dialpad/resources/__init__.py index 3d0693e..affbc7a 100644 --- a/dialpad/resources/__init__.py +++ b/dialpad/resources/__init__.py @@ -9,6 +9,7 @@ from .department import DepartmentResource from .event_subscription import EventSubscriptionResource from .number import NumberResource +from .oauth_apps import OAuthAppsResource from .office import OfficeResource from .room import RoomResource from .sms import SMSResource diff --git a/dialpad/resources/oauth_apps.py b/dialpad/resources/oauth_apps.py new file mode 100644 index 0000000..211494e --- /dev/null +++ b/dialpad/resources/oauth_apps.py @@ -0,0 +1,29 @@ +from .resource import DialpadResource + +class OAuthAppsResource(DialpadResource): + """OAuthAppsResource implements python bindings for the Dialpad API's oauth-apps + endpoints. + + See https://developers.dialpad.com/reference/oauthappapi_toggleoauthapp for additional + documentation. + """ + _resource_path = ['oauth_apps'] + + def toggle(self, oauth_app_id, enable, target_id=None, target_type=None): + """Enables or disables an OAuth App for a given target or the API key's target. + + Args: + oauth_app_id (str, required): The OAuth App's ID (client_id). + enable (bool, required): Whether or not the OAuth app should be enabled. + target_id (int, optional): The id of the target that the OAuth app should be toggled for. + target_type (str, optional): The type of the target that the OAuth app should be toggled for. + + See Also: + https://developers.dialpad.com/reference/oauthappapi_toggleoauthapp + """ + data = dict(enable=enable) + if target_id is not None: + data['target_id'] = target_id + if target_type is not None: + data['target_type'] = target_type + return self.request([oauth_app_id, 'toggle'], method='PATCH', data=data) diff --git a/setup.py b/setup.py index f106e82..b121eb6 100644 --- a/setup.py +++ b/setup.py @@ -9,15 +9,15 @@ def readme(): setup( - name='python-dialpad-httpx', - version='1.1.0', - description='A python wrapper for the Dialpad REST API', + name='python-dialpad-httpx-open', + version='1.0.0', + description='A clone of the python wrapper for the Dialpad REST API', long_description=readme(), long_description_content_type="text/markdown", - author='Jake Nielsen', - author_email='jnielsen@dialpad.com', + author='Gauresh Shirodkar', + author_email='gshirodkar@dialpad.com', license='MIT', - url='https://github.com/dialpad/dialpad-python-sdk', + url='https://github.com/gaureshdialpad/dialpad-python-sdk-async', install_requires=[ 'cached-property', 'certifi', diff --git a/test/test_resource_sanity.py b/test/test_resource_sanity.py index 48fa79b..52b9304 100644 --- a/test/test_resource_sanity.py +++ b/test/test_resource_sanity.py @@ -2,7 +2,7 @@ """Tests to automatically detect common issues with resource definitions. -In particular these tests will look through the files in dialpad-python-sdk/dialpad/resources/ and +In particular these tests will look through the files in dialpad-python-sdk-async/dialpad/resources/ and ensure: - All subclasses of DialpadResource are exposed directly in resources/__init__.py diff --git a/tools/create_release.sh b/tools/create_release.sh index d81ae6c..4b4a956 100755 --- a/tools/create_release.sh +++ b/tools/create_release.sh @@ -1,6 +1,6 @@ #!/bin/bash -DOC="Build and release a new version of the python-dialpad package. +DOC="Build and release a new version of the python-dialpad-httpx-open package. Usage: create_version.sh [-h] [--patch|--minor|--major] [--bump-only|--no-upload]