Skip to content

Commit

Permalink
webhook api added
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh619-sudo committed Dec 20, 2023
1 parent 6979dc2 commit 68b5038
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bamboosdk/api/webhook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from .api_base import ApiBase


class Webhook(ApiBase):
""" Class for webhook APIs for bamboohr """

POST_WEBHOOK = '/v1/webhooks/'
DELETE_WEBHOOK = '/v1/webhooks/{}'

def post(self, payload):
"""
Post webhook url to bamboohr for employee update or create
Returns:
"""
return self._post_request(self.POST_WEBHOOK, payload)

def delete(self, id):
"""
Delete Webhook
Returns:
"""
return self._delete_request(self.DELETE_WEBHOOK.format(id))
17 changes: 17 additions & 0 deletions bamboosdk/bamboohrsdk.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .api.employee import Employee
from .api.webhook import Webhook

class BambooHrSDK:
"""
Expand All @@ -14,5 +15,21 @@ def __init__(self, api_token: str, sub_domain: str):
self.__sub_domain = sub_domain

self.employees = Employee()
self.webhook = Webhook()

self.set_api_token()
self.set_sub_domain()

def set_api_token(self):
"""
Set the api token for all the APIs
"""
self.employees.set_api_token(self.__api_token)
self.webhook.set_api_token(self.__api_token)

def set_sub_domain(self):
"""
Set sub domain for all the APIs
"""
self.employees.set_sub_domain(self.__sub_domain)
self.webhook.set_sub_domain(self.__sub_domain)

0 comments on commit 68b5038

Please sign in to comment.