Skip to content

Commit c8a40e3

Browse files
added restsharp upgrade in mustache file
1 parent 8351144 commit c8a40e3

File tree

7 files changed

+44
-42
lines changed

7 files changed

+44
-42
lines changed

Client/ApiClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ private RestRequest PrepareRestRequest(
280280
clientOptions.Proxy = Configuration.Proxy;
281281
}
282282
clientOptions.UserAgent = Configuration.UserAgent;
283-
284283
RestClient = new RestClient(clientOptions);
285284

286285
// Add Header Parameter, if any
@@ -451,6 +450,7 @@ public object CallApi(
451450
{
452451
Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout),
453452
};
453+
454454
// RestClient.ClearHandlers();
455455

456456
if (Configuration.Proxy != null)
@@ -476,7 +476,6 @@ public object CallApi(
476476
clientOptions.ClientCertificates = new X509CertificateCollection { certificate };
477477
}
478478
clientOptions.UserAgent = Configuration.UserAgent;
479-
480479
RestClient = new RestClient(clientOptions);
481480

482481
// Logging Request Headers
@@ -590,6 +589,7 @@ public async System.Threading.Tasks.Task<object> CallApiAsync(
590589
{
591590
logger.Debug($"HTTP Request Headers :\n{headerPrintOutput.ToString()}");
592591
}
592+
593593
clientOptions.UserAgent = Configuration.UserAgent;
594594
RestClient = new RestClient(clientOptions);
595595

cybersource-rest-client-dotnet.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ OpenAPI spec version: 0.0.1
1212

1313
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
1414
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
15-
<ProjectGuid>{5DF48666-0ABC-4928-ACC5-C7502B7D871B}</ProjectGuid>
15+
<ProjectGuid>{9FBF2564-5592-40E2-A669-87A3C66BC8C7}</ProjectGuid>
1616
<OutputType>Library</OutputType>
1717
<AppDesignerFolder>Properties</AppDesignerFolder>
1818
<RootNamespace>CyberSource</RootNamespace>
@@ -44,7 +44,7 @@ OpenAPI spec version: 0.0.1
4444
<Reference Include="Newtonsoft.Json">
4545
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
4646
</Reference>
47-
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
47+
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
4848
<SpecificVersion>False</SpecificVersion>
4949
<HintPath>packages\NLog.5.0.0\lib\net46\NLog.dll</HintPath>
5050
</Reference>
@@ -102,4 +102,4 @@ OpenAPI spec version: 0.0.1
102102
<Content Include="license.txt" />
103103
</ItemGroup>
104104
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
105-
</Project>
105+
</Project>

cybersource-rest-client-dotnet.sln

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 14
33
VisualStudioVersion = 14.0.25420.1
44
MinimumVisualStudioVersion = 10.0.40219.1
5-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cybersource-rest-client-dotnet", "cybersource-rest-client-dotnet.csproj", "{5DF48666-0ABC-4928-ACC5-C7502B7D871B}"
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cybersource-rest-client-dotnet", "cybersource-rest-client-dotnet.csproj", "{9FBF2564-5592-40E2-A669-87A3C66BC8C7}"
66
EndProject
77
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cybersource-rest-client-dotnet.Test", "test\cybersource-rest-client-dotnet.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
88
EndProject
@@ -12,10 +12,10 @@ Global
1212
Release|Any CPU = Release|Any CPU
1313
EndGlobalSection
1414
GlobalSection(ProjectConfigurationPlatforms) = postSolution
15-
{5DF48666-0ABC-4928-ACC5-C7502B7D871B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16-
{5DF48666-0ABC-4928-ACC5-C7502B7D871B}.Debug|Any CPU.Build.0 = Debug|Any CPU
17-
{5DF48666-0ABC-4928-ACC5-C7502B7D871B}.Release|Any CPU.ActiveCfg = Release|Any CPU
18-
{5DF48666-0ABC-4928-ACC5-C7502B7D871B}.Release|Any CPU.Build.0 = Release|Any CPU
15+
{9FBF2564-5592-40E2-A669-87A3C66BC8C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16+
{9FBF2564-5592-40E2-A669-87A3C66BC8C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
17+
{9FBF2564-5592-40E2-A669-87A3C66BC8C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{9FBF2564-5592-40E2-A669-87A3C66BC8C7}.Release|Any CPU.Build.0 = Release|Any CPU
1919
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2020
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
2121
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU

generator/cybersource-csharp-template/ApiClient.mustache

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,17 @@ namespace {{packageName}}.Client
312312
}
313313

314314
RestRequest requestT = new RestRequest(path);
315-
RestClientOptions clientOptions = RestClient.Options;
315+
RestClientOptions clientOptions = new RestClientOptions(RestClient.Options.BaseUrl)
316+
{
317+
Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout),
318+
};
316319

317320
if (Configuration.Proxy != null)
318321
{
319322
clientOptions.Proxy = Configuration.Proxy;
320323
}
321-
324+
clientOptions.UserAgent = Configuration.UserAgent;
322325
RestClient = new RestClient(clientOptions);
323-
RestClient.Options.UserAgent = Configuration.UserAgent;
324326

325327
// Add Header Parameter, if any
326328
// Passed to this function
@@ -486,8 +488,10 @@ namespace {{packageName}}.Client
486488
pathParams, contentType);
487489

488490
// set timeout
489-
request.Timeout = Configuration.Timeout;
490-
RestClientOptions clientOptions = RestClient.Options;
491+
RestClientOptions clientOptions = new RestClientOptions(RestClient.Options.BaseUrl)
492+
{
493+
Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout),
494+
};
491495

492496
// RestClient.ClearHandlers();
493497

@@ -513,9 +517,8 @@ namespace {{packageName}}.Client
513517
clientCertPassword.Dispose();
514518
clientOptions.ClientCertificates = new X509CertificateCollection { certificate };
515519
}
516-
520+
clientOptions.UserAgent = Configuration.UserAgent;
517521
RestClient = new RestClient(clientOptions);
518-
RestClient.Options.UserAgent = Configuration.UserAgent;
519522

520523
// Logging Request Headers
521524
var headerPrintOutput = new StringBuilder();
@@ -626,10 +629,11 @@ namespace {{packageName}}.Client
626629
}
627630
}
628631

629-
// set timeout
630-
request.Timeout = Configuration.Timeout;
631632
// set user agent
632-
RestClientOptions clientOptions = RestClient.Options;
633+
RestClientOptions clientOptions = new RestClientOptions(RestClient.Options.BaseUrl)
634+
{
635+
Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout)
636+
};
633637

634638
if (logUtility.IsMaskingEnabled(logger))
635639
{
@@ -640,8 +644,8 @@ namespace {{packageName}}.Client
640644
logger.Debug($"HTTP Request Headers :\n{headerPrintOutput.ToString()}");
641645
}
642646

647+
clientOptions.UserAgent = Configuration.UserAgent;
643648
RestClient = new RestClient(clientOptions);
644-
RestClient.Options.UserAgent = Configuration.UserAgent;
645649

646650
InterceptRequest(request);
647651
var response = await RestClient.Execute{{^netStandard}}Async{{/netStandard}}(request);
@@ -1070,7 +1074,11 @@ namespace {{packageName}}.Client
10701074
RestClient = new RestClient("https://" + merchantConfig.HostName);
10711075
}
10721076

1073-
RestClientOptions clientOptions = RestClient.Options;
1077+
RestClientOptions clientOptions = new RestClientOptions(RestClient.Options.BaseUrl)
1078+
{
1079+
Proxy = RestClient.Options.Proxy,
1080+
UserAgent = RestClient.Options.UserAgent,
1081+
};
10741082
if (Configuration.Proxy != null)
10751083
{
10761084
clientOptions.Proxy = Configuration.Proxy;

generator/cybersource-csharp-template/Configuration.mustache

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,7 @@ namespace {{packageName}}.Client
141141
/// <value>Timeout.</value>
142142
public {{^netStandard}}int{{/netStandard}}{{#netStandard}}TimeSpan?{{/netStandard}} Timeout
143143
{
144-
get { return ApiClient.RestClient.Options.MaxTimeout; }
145-
146-
set
147-
{
148-
if (ApiClient != null)
149-
ApiClient.RestClient.Options.MaxTimeout = value;
150-
}
144+
get; set;
151145
}
152146

153147
/// <summary>

generator/cybersource-csharp-template/Project.mustache

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
</PropertyGroup>
5858
<ItemGroup>
5959
{{^netStandard}}
60-
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
61-
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
60+
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
61+
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\netstandard2.0\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
6262
</Reference>
6363
<Reference Include="Newtonsoft.Json">
6464
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll</HintPath>
@@ -67,29 +67,29 @@
6767
<SpecificVersion>False</SpecificVersion>
6868
<HintPath>packages\NLog.5.0.0\lib\net46\NLog.dll</HintPath>
6969
</Reference>
70-
<Reference Include="RestSharp, Version=108.0.3.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
71-
<HintPath>packages\RestSharp.108.0.3\lib\netstandard2.0\RestSharp.dll</HintPath>
70+
<Reference Include="RestSharp, Version=112.1.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
71+
<HintPath>packages\RestSharp.112.1.0\lib\netstandard2.0\RestSharp.dll</HintPath>
7272
</Reference>
7373
<Reference Include="System" />
7474
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
7575
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
7676
</Reference>
7777
<Reference Include="System.Core" />
78-
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
79-
<HintPath>packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
78+
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
79+
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
8080
</Reference>
8181
<Reference Include="System.Numerics" />
8282
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
8383
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
8484
</Reference>
85-
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
86-
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
85+
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
86+
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
8787
</Reference>
88-
<Reference Include="System.Text.Encodings.Web, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
89-
<HintPath>packages\System.Text.Encodings.Web.5.0.1\lib\net461\System.Text.Encodings.Web.dll</HintPath>
88+
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
89+
<HintPath>packages\System.Text.Encodings.Web.8.0.0\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
9090
</Reference>
91-
<Reference Include="System.Text.Json, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
92-
<HintPath>packages\System.Text.Json.5.0.1\lib\net461\System.Text.Json.dll</HintPath>
91+
<Reference Include="System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
92+
<HintPath>packages\System.Text.Json.8.0.4\lib\netstandard2.0\System.Text.Json.dll</HintPath>
9393
</Reference>
9494
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
9595
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>

test/cybersource-rest-client-dotnet.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ OpenAPI spec version: 0.0.1
9494
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
9595
<ItemGroup>
9696
<ProjectReference Include="..\cybersource-rest-client-dotnet.csproj">
97-
<Project>{5DF48666-0ABC-4928-ACC5-C7502B7D871B}</Project>
97+
<Project>{9FBF2564-5592-40E2-A669-87A3C66BC8C7}</Project>
9898
<Name>cybersource-rest-client-dotnet</Name>
9999
</ProjectReference>
100100
</ItemGroup>

0 commit comments

Comments
 (0)