python-intercom
python-intercom copied to clipboard
Delete User by user_id
Matching the syntax of the official intercom integration, I would expect something like users.delete(user_id=xxx)
to work (same for other delete functions).
Work around for now is monkey patching:
from intercom.api_operations.delete import Delete
...
# monkey patch so we can use delete
def patched_users_delete(
self_, obj=None, user_id=None
): # pragma: no cover
if user_id is not None:
user = self.intercom.users.find(user_id=user_id)
return original_users_delete(self_, user)
return original_users_delete(self_, obj)
original_users_delete = Delete.delete
Delete.delete = patched_users_delete
@lukas-gitl If you can put together a PR with tests, I'll take a look at it. Sorry for the delay in responding.
Done. It's untested, but should be very easy to write a test for.
Please can we get the above merged in?