mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 05:13:18 -07:00
parent
e34db987d7
commit
36d93d5a9d
21 changed files with 3685 additions and 376 deletions
|
@ -1,5 +1,6 @@
|
|||
using System.Threading.Tasks;
|
||||
using Ombi.Api.Plex.Models;
|
||||
using Ombi.Api.Plex.Models.Friends;
|
||||
using Ombi.Api.Plex.Models.Server;
|
||||
using Ombi.Api.Plex.Models.Status;
|
||||
|
||||
|
@ -16,5 +17,6 @@ namespace Ombi.Api.Plex
|
|||
Task<PlexMetadata> GetMetadata(string authToken, string plexFullHost, int itemId);
|
||||
Task<PlexMetadata> GetSeasons(string authToken, string plexFullHost, int ratingKey);
|
||||
Task<PlexContainer> GetAllEpisodes(string authToken, string host, string section, int start, int retCount);
|
||||
Task<PlexFriends> GetUsers(string authToken);
|
||||
}
|
||||
}
|
59
src/Ombi.Api.Plex/Models/Friends/PlexFriends.cs
Normal file
59
src/Ombi.Api.Plex/Models/Friends/PlexFriends.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ombi.Api.Plex.Models.Friends
|
||||
{
|
||||
[XmlRoot(ElementName = "Server")]
|
||||
public class Server
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string Id { get; set; }
|
||||
[XmlAttribute(AttributeName = "serverId")]
|
||||
public string ServerId { get; set; }
|
||||
[XmlAttribute(AttributeName = "machineIdentifier")]
|
||||
public string MachineIdentifier { get; set; }
|
||||
[XmlAttribute(AttributeName = "name")]
|
||||
public string Name { get; set; }
|
||||
[XmlAttribute(AttributeName = "lastSeenAt")]
|
||||
public string LastSeenAt { get; set; }
|
||||
[XmlAttribute(AttributeName = "numLibraries")]
|
||||
public string NumLibraries { get; set; }
|
||||
[XmlAttribute(AttributeName = "owned")]
|
||||
public string Owned { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "User")]
|
||||
public class UserFriends
|
||||
{
|
||||
[XmlElement(ElementName = "Server")]
|
||||
public Server Server { get; set; }
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public string Id { get; set; }
|
||||
[XmlAttribute(AttributeName = "title")]
|
||||
public string Title { get; set; }
|
||||
[XmlAttribute(AttributeName = "username")]
|
||||
public string Username { get; set; }
|
||||
[XmlAttribute(AttributeName = "email")]
|
||||
public string Email { get; set; }
|
||||
[XmlAttribute(AttributeName = "recommendationsPlaylistId")]
|
||||
public string RecommendationsPlaylistId { get; set; }
|
||||
[XmlAttribute(AttributeName = "thumb")]
|
||||
public string Thumb { get; set; }
|
||||
}
|
||||
|
||||
[XmlRoot(ElementName = "MediaContainer")]
|
||||
public class PlexFriends
|
||||
{
|
||||
[XmlElement(ElementName = "User")]
|
||||
public UserFriends[] User { get; set; }
|
||||
[XmlAttribute(AttributeName = "friendlyName")]
|
||||
public string FriendlyName { get; set; }
|
||||
[XmlAttribute(AttributeName = "identifier")]
|
||||
public string Identifier { get; set; }
|
||||
[XmlAttribute(AttributeName = "machineIdentifier")]
|
||||
public string MachineIdentifier { get; set; }
|
||||
[XmlAttribute(AttributeName = "totalSize")]
|
||||
public string TotalSize { get; set; }
|
||||
[XmlAttribute(AttributeName = "size")]
|
||||
public string Size { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Ombi.Api.Plex.Models;
|
||||
using Ombi.Api.Plex.Models.Friends;
|
||||
using Ombi.Api.Plex.Models.Server;
|
||||
using Ombi.Api.Plex.Models.Status;
|
||||
|
||||
|
@ -126,6 +127,20 @@ namespace Ombi.Api.Plex
|
|||
return await Api.Request<PlexContainer>(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retuns all the Plex users for this account
|
||||
/// NOTE: For HOME USERS. There is no username or email, the user's home name is under the title property
|
||||
/// </summary>
|
||||
/// <param name="authToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PlexFriends> GetUsers(string authToken)
|
||||
{
|
||||
var request = new Request(string.Empty,FriendsUri, HttpMethod.Get, ContentType.Xml);
|
||||
AddHeaders(request, authToken);
|
||||
|
||||
return await Api.Request<PlexFriends>(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the required headers and also the authorization header
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue