Closed elzik closed 2 years ago
I don’t see any reasons. Let me take a quick look at the new api endpoint.
I did ask about this on the PLex forums and got a response from a Plex employee:
https://plex.tv/api/home/users will return users, that is in your [home](https://support.plex.tv/articles/203815766-what-is-plex-home/) only
https://plex.tv/api/users will return all your friends, incl. those in your home
So it sounds like there is a distinction between these two endpoints. One is related to all your "friends" and the other one to just users in your home. Do you think that this would map better to two different methods in plex-api
, making it clearer what will be returned?
@jensenkd would you be open to a pull request that leaves the existing method as-is and adds a new method: GetHomeUsers()
?
@elzik I already built the new method GetHomeUsers() and will be releasing soon. Thanks for confirming my approach with the plex team. I'll have a nuget build shortly.
That's great news and much appreciated, thanks.
@jensenkd I noticed that in the friend vs home user responses, the shape of the user was significantly different. The only things they have in common are id
, protected
, title
& thumb
. Are you planning to have two separate models, one for User
and one for HomeUser
?
The reason I mention this is that my use case requires the admin
attribute of the User
element that is only returned in the home users response.
@jensenkd I see the recent commit for this, thank you. Is the intention to lose the original GetUsers()
method? The two endpoints return different things even though there is an overlap and the information returned for each user is also different. It would be useful to have a GetHomeUsers() and the original GetUsers().
To keep my project going whilst I was waiting for the new package, I forked and created a branch with both methods in, each with their own models for a User and a HomeUser as they represented different things.
@elzik It looks like the terminology that Plex uses is HomeUsers() and Friends() as the two different types of users. I think it probably makes sense to mimic that in GetHomeUsers() and GetFriends(). Thoughts?
HomeUser and Friend would be different classes
@jensenkd Yes, I think you're right - it's good to use the same terminology that Plex themselves use.
The PlexAccountClient
already has a GetFriendsAsync()
method but that doesn't seem to return anything on my server. Whereas the original GetUsers()
method returned the users who have been invited and have access to my server but who have not necessarily accepted the invitation to be a home user.
Are you suggesting changing the GetFriendsAsync()
method so that it hits the https://plex.tv/api/users
endpoint?
No, I'm suggesting using https://plex.tv/api/v2/friends.json
That does not return anything for you?
My mistake, I think it was the other home users endpoint that was returning nothing but I have now taken your latest changes and everything seems to work well. I can get exactly what I need now by calling GetHomeUsersAsync()
and GetFriendsAsync()
.
Thank you for the updates; I'll close this and look forward to the NuGet package.
Describe the bug
PlexAccountClient.GetUsers()
does not return all users; it returns all users other than the Home Admin user.To Reproduce Steps to reproduce the behavior:
PlexAccountClient.GetUsers()
.Expected behavior A call to
PlexAccountClient.GetUsers()
should include all users including the Home Admin.Additional context Looking at the implementation of
PlexAccountClient.GetUsers()
I see that it uses a base URI ofhttps://plex.tv/api/users
. I have confirmed that is this base URI is changed tohttps://plex.tv/api/home/users
then all users, including the Home Admin users, are returned as expected.Is there some reason why we shouldn't hit the
/home/users
endpoint? Is there any desire to either fix the existing method so that it does hit this endpoint or create an additional one?