mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 03:28:28 -07:00
!wip started on the Plex add user UI
This commit is contained in:
parent
51f5bbc6a8
commit
79fe8bb331
15 changed files with 379 additions and 14 deletions
|
@ -243,6 +243,34 @@ namespace Ombi.Api.Plex
|
|||
return request.FullUri;
|
||||
}
|
||||
|
||||
public async Task<PlexAddWrapper> AddUser(string emailAddress, string serverId, string authToken, int[] libs)
|
||||
{
|
||||
var request = new Request(string.Empty, $"https://plex.tv/api/servers/{serverId}/shared_servers", HttpMethod.Post, ContentType.Xml);
|
||||
await AddHeaders(request, authToken);
|
||||
request.AddJsonBody(new
|
||||
{
|
||||
server_id = serverId,
|
||||
shared_server = new
|
||||
{
|
||||
library_section_ids = libs.Length > 0 ? libs : new int[]{},
|
||||
invited_email = emailAddress
|
||||
},
|
||||
sharing_settings = new { }
|
||||
});
|
||||
var result = await Api.RequestContent(request);
|
||||
try
|
||||
{
|
||||
var add = Api.DeserializeXml<PlexAdd>(result);
|
||||
return new PlexAddWrapper{Add = add};
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
var error = Api.DeserializeXml<AddUserError>(result);
|
||||
return new PlexAddWrapper{Error = error};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds the required headers and also the authorization header
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue