Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook create and delete API #108

Merged
merged 7 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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:
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent is off

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)
Loading