intercom / intercom-dotnet

Intercom API client library for .NET
https://developers.intercom.io/reference
Apache License 2.0
63 stars 54 forks source link

Fixing UsersClient.View when searching with parameters #153

Open SonnyCampbell opened 5 years ago

SonnyCampbell commented 5 years ago

Why?

/user?param=parameters enpoint returns a list of users, not a single user.

Because of this UsersClient.View is broken and always returns an object with all null values unless you search by id because /users/{id} is the endpoint that returns a single user.

How?

When querying by params (ie by user_id={user_id} or email={email}) return {resultObject}.users.FirstOrDefault() instead of {resultObject}

Investigate

I could only test this for the /users/email={email} endpoint, as our user_ids are empty, but I am assuming they work the same way. Is /users/email={email} supposed to only return a single user? Is THAT the issue here? Or was that updated and the docs/packages werent? https://developers.intercom.com/intercom-api-reference/reference#view-a-user