Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates RestSharp package to 110.2.0 #496

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Xero.NetStandard.OAuth2.Test/Xero.NetStandard.OAuth2.Test.csproj
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="RestSharp" Version="108.0.1" />
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="*" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="3.1.0" />
Expand Down
18 changes: 9 additions & 9 deletions Xero.NetStandard.OAuth2/Client/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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."); }
Expand All @@ -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;
}
Expand Down Expand Up @@ -503,21 +503,21 @@ private async Task<ApiResponse<T>> Exec<T>(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<XmlRestSerializer>();
.UseSerializer<XmlRestSerializer>()
);

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));
}
}

Expand Down
6 changes: 3 additions & 3 deletions Xero.NetStandard.OAuth2/Client/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class Configuration : IReadableConfiguration
/// Version of the package.
/// </summary>
/// <value>Version of the package.</value>
public const string Version = "3.34.1";
public const string Version = "3.34.2";

/// <summary>
/// Identifier for ISO 8601 DateTime Format
Expand Down Expand Up @@ -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<string, string>();
ApiKey = new ConcurrentDictionary<string, string>();
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions Xero.NetStandard.OAuth2/Xero.NetStandard.OAuth2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<RootNamespace>Xero.NetStandard.OAuth2</RootNamespace>
<Version>3.34.1</Version>
<Version>3.34.2</Version>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Xero.NetStandard.OAuth2.xml</DocumentationFile>
<PackageLicenseUrl>https://github.com/XeroAPI/Xero-NetStandard/</PackageLicenseUrl>
<PackageIconUrl>https://en.gravatar.com/userimage/180557955/74b3a957d886bc921b0d1455beed9dab.png</PackageIconUrl>
Expand All @@ -30,7 +30,7 @@
<PackageReference Include="CompareNETObjects" Version="4.57.0" />
<PackageReference Include="JsonSubTypes" Version="1.5.2" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="RestSharp" Version="108.0.1" />
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
</ItemGroup>

Expand Down