diff --git a/Xero.NetStandard.OAuth2.Test/Xero.NetStandard.OAuth2.Test.csproj b/Xero.NetStandard.OAuth2.Test/Xero.NetStandard.OAuth2.Test.csproj old mode 100755 new mode 100644 index c31ab842..b00746bb --- a/Xero.NetStandard.OAuth2.Test/Xero.NetStandard.OAuth2.Test.csproj +++ b/Xero.NetStandard.OAuth2.Test/Xero.NetStandard.OAuth2.Test.csproj @@ -16,7 +16,7 @@ - + diff --git a/Xero.NetStandard.OAuth2/Client/ApiClient.cs b/Xero.NetStandard.OAuth2/Client/ApiClient.cs index 15d8f5f0..f78cf929 100644 --- a/Xero.NetStandard.OAuth2/Client/ApiClient.cs +++ b/Xero.NetStandard.OAuth2/Client/ApiClient.cs @@ -34,7 +34,7 @@ namespace Xero.NetStandard.OAuth2.Client internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer { private readonly IReadableConfiguration _configuration; - private string _contentType = "application/json"; + private ContentType _contentType = "application/json"; private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings { // OpenAPI generated types generally hide default constructors. @@ -173,7 +173,7 @@ internal object Deserialize(RestResponse response, Type type) public string Namespace { get; set; } public string DateFormat { get; set; } - public string ContentType + public ContentType ContentType { get { return _contentType; } set { throw new InvalidOperationException("Not allowed to set content type."); } @@ -198,7 +198,7 @@ public string Serialize(Parameter parameter) "*" }; - public SupportsContentType SupportsContentType => type => AcceptedContentTypes.Contains(type); + public SupportsContentType SupportsContentType => type => AcceptedContentTypes.Contains(type.Value); public DataFormat DataFormat => DataFormat.Json; } @@ -503,21 +503,21 @@ private async Task> Exec(RestRequest req, IReadableConfigurati clientOptions.UserAgent = configuration.UserAgent; } - RestClient client = new RestClient(clientOptions); - - client - .UseSerializer(() => + RestClient client = new RestClient( + clientOptions, + configureSerialization: cs => cs.UseSerializer(() => { var serializer = new CustomJsonCodec(configuration); return serializer; }) - .UseSerializer(); + .UseSerializer() + ); if (configuration.Cookies != null && configuration.Cookies.Count > 0) { foreach (var cookie in configuration.Cookies) { - client.CookieContainer.Add(new Cookie(cookie.Name, cookie.Value)); + req.CookieContainer.Add(new Cookie(cookie.Name, cookie.Value)); } } diff --git a/Xero.NetStandard.OAuth2/Client/Configuration.cs b/Xero.NetStandard.OAuth2/Client/Configuration.cs index 01a74c2d..f9c949b1 100644 --- a/Xero.NetStandard.OAuth2/Client/Configuration.cs +++ b/Xero.NetStandard.OAuth2/Client/Configuration.cs @@ -31,7 +31,7 @@ public class Configuration : IReadableConfiguration /// Version of the package. /// /// Version of the package. - public const string Version = "3.34.1"; + public const string Version = "3.34.2"; /// /// Identifier for ISO 8601 DateTime Format @@ -103,7 +103,7 @@ public class Configuration : IReadableConfiguration [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] public Configuration() { - UserAgent = "xero-netstandard-3.34.1"; + UserAgent = "xero-netstandard-3.34.2"; BasePath = "https://api.xero.com/api.xro/2.0"; DefaultHeader = new ConcurrentDictionary(); ApiKey = new ConcurrentDictionary(); @@ -342,7 +342,7 @@ public static String ToDebugReport() String report = "C# SDK (Xero.NetStandard.OAuth2) Debug Report:\n"; report += " OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription + "\n"; report += " Version of the API: 2.40.1\n"; - report += " SDK Package Version: 3.34.1\n"; + report += " SDK Package Version: 3.34.2\n"; return report; } diff --git a/Xero.NetStandard.OAuth2/Xero.NetStandard.OAuth2.csproj b/Xero.NetStandard.OAuth2/Xero.NetStandard.OAuth2.csproj index 519b8e9d..b107da4f 100644 --- a/Xero.NetStandard.OAuth2/Xero.NetStandard.OAuth2.csproj +++ b/Xero.NetStandard.OAuth2/Xero.NetStandard.OAuth2.csproj @@ -16,7 +16,7 @@ true true Xero.NetStandard.OAuth2 - 3.34.1 + 3.34.2 bin\$(Configuration)\$(TargetFramework)\Xero.NetStandard.OAuth2.xml https://github.com/XeroAPI/Xero-NetStandard/ https://en.gravatar.com/userimage/180557955/74b3a957d886bc921b0d1455beed9dab.png @@ -30,7 +30,7 @@ - +