Skip to content

Commit

Permalink
add hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
chuongmep committed May 8, 2024
1 parent d2b0f53 commit 2927bac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions APSToolkitPython/src/aps_toolkit/Webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_all_app_hooks(self) -> dict:
response = requests.get(url, headers=headers)
return response.json()

def get_hook_by_id(self, hook_id: str, event="dm.version.added", system="data") -> dict:
def get_hook_by_id(self, hook_id: str, event: str = "dm.version.added", system: str = "data") -> dict:
"""
Get details of a webhook based on its webhook ID
https://aps.autodesk.com/en/docs/webhooks/v1/reference/http/webhooks/systems-system-events-event-hooks-hook_id-GET/
Expand All @@ -57,7 +57,7 @@ def get_hook_by_id(self, hook_id: str, event="dm.version.added", system="data")
response = requests.get(url, headers=headers)
return response.json()

def delete_hook_by_id(self, hook_id: str, event="dm.version.added", system="data"):
def delete_hook_by_id(self, hook_id: str, event: str = "dm.version.added", system: str = "data"):
"""
Delete a webhook based on its webhook ID
https://aps.autodesk.com/en/docs/webhooks/v1/reference/http/webhooks/systems-system-events-event-hooks-hook_id-DELETE/
Expand All @@ -73,8 +73,8 @@ def delete_hook_by_id(self, hook_id: str, event="dm.version.added", system="data
}
return requests.delete(url, headers=headers)

def create_system_event_hook(self, scope, callback_url="http://localhost:8080/api/webhooks/callback",
event="dm.version.added", system="data", hookAttribute=None):
def create_system_event_hook(self, scope: str, callback_url: str = "http://localhost:8080/api/webhooks/callback",
event: str = "dm.version.added", system: str = "data", hookAttribute: str = None):
"""
Add new webhooks to receive the notification on all the events.
https://aps.autodesk.com/en/docs/webhooks/v1/reference/http/webhooks/systems-system-hooks-POST/
Expand Down
1 change: 1 addition & 0 deletions APSToolkitPython/src/test/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from aps_toolkit import SVFMetadata
from aps_toolkit import Bucket
from aps_toolkit.units import DisplayUnits
from aps_toolkit import Webhooks

APS_CLIENT_ID = os.environ["APS_CLIENT_ID"]
APS_CLIENT_SECRET = os.environ["APS_CLIENT_SECRET"]

0 comments on commit 2927bac

Please sign in to comment.