python-intercom icon indicating copy to clipboard operation
python-intercom copied to clipboard

Delete User by user_id

Open lukas-gitl opened this issue 7 years ago • 4 comments

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

lukas-gitl avatar Mar 14 '17 23:03 lukas-gitl

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 avatar Mar 15 '17 00:03 lukas-gitl

@lukas-gitl If you can put together a PR with tests, I'll take a look at it. Sorry for the delay in responding.

jkeyes avatar Oct 24 '17 22:10 jkeyes

Done. It's untested, but should be very easy to write a test for.

lukas-gitl avatar Oct 25 '17 23:10 lukas-gitl

Please can we get the above merged in?

cpressland avatar Jun 17 '19 15:06 cpressland