mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 21:33:15 -07:00
Some styling
This commit is contained in:
parent
725678779a
commit
37aa6b938d
9 changed files with 102 additions and 37 deletions
|
@ -39,7 +39,7 @@ namespace PlexRequests.Api
|
|||
{
|
||||
public class ApiRequest : IApiRequest
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// An API request handler
|
||||
/// </summary>
|
||||
|
@ -54,7 +54,7 @@ namespace PlexRequests.Api
|
|||
var response = client.Execute<T>(request);
|
||||
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
{
|
||||
var message = "Error retrieving response. Check inner details for more info.";
|
||||
throw new ApplicationException(message, response.ErrorException);
|
||||
}
|
||||
|
@ -75,7 +75,8 @@ namespace PlexRequests.Api
|
|||
throw new ApplicationException(message, response.ErrorException);
|
||||
}
|
||||
|
||||
return Deserialize<T>(response.Content);
|
||||
var result = Deserialize<T>(response.Content);
|
||||
return result;
|
||||
}
|
||||
|
||||
public T Deserialize<T>(string input)
|
||||
|
@ -83,8 +84,15 @@ namespace PlexRequests.Api
|
|||
{
|
||||
var ser = new XmlSerializer(typeof(T));
|
||||
|
||||
using (var sr = new StringReader(input))
|
||||
return (T)ser.Deserialize(sr);
|
||||
try
|
||||
{
|
||||
using (var sr = new StringReader(input))
|
||||
return (T)ser.Deserialize(sr);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
38
PlexRequests.Api/Models/PlexError.cs
Normal file
38
PlexRequests.Api/Models/PlexError.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: PlexError.cs
|
||||
// Created By: Jamie Rees
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace PlexRequests.Api.Models
|
||||
{
|
||||
[XmlRoot(ElementName = "errors")]
|
||||
public class PlexError
|
||||
{
|
||||
[XmlElement(ElementName = "error")]
|
||||
public string Error { get; set; }
|
||||
|
||||
}
|
||||
}
|
|
@ -62,6 +62,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="ApiRequest.cs" />
|
||||
<Compile Include="Models\PlexAuthentication.cs" />
|
||||
<Compile Include="Models\PlexError.cs" />
|
||||
<Compile Include="Models\PlexFriends.cs" />
|
||||
<Compile Include="Models\PlexUserRequest.cs" />
|
||||
<Compile Include="Models\Tv\Authentication.cs" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue