Skip to content

Commit b7eee79

Browse files
committed
chore: Updated samples based on csharp changes
1 parent 78b3384 commit b7eee79

157 files changed

Lines changed: 6425 additions & 1248 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Api/DefaultApi.cs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,21 @@ public sealed partial class DefaultApi : IDefaultApi
112112
{
113113
private JsonSerializerOptions _jsonSerializerOptions;
114114

115+
private readonly string[] _contentHeaders =
116+
[
117+
"allow",
118+
"content-encoding",
119+
"content-language",
120+
"content-length",
121+
"content-location",
122+
"content-md5",
123+
"content-range",
124+
"content-type",
125+
"expires",
126+
"last-modified",
127+
"extension-header"
128+
];
129+
115130
/// <summary>
116131
/// The logger factory
117132
/// </summary>
@@ -249,9 +264,16 @@ public async Task<IHelloWorldPostApiResponse> HelloWorldPostAsync(Option<HelloWo
249264
: string.Concat(HttpClient.BaseAddress.AbsolutePath.TrimEnd('/'), "/helloWorld");
250265

251266
if (helloWorldPostRequest.IsSet)
252-
httpRequestMessageLocalVar.Content = (helloWorldPostRequest.Value as object) is System.IO.Stream stream
253-
? httpRequestMessageLocalVar.Content = new StreamContent(stream)
254-
: httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(helloWorldPostRequest.Value, _jsonSerializerOptions));
267+
{
268+
if ((helloWorldPostRequest.Value as object) is System.IO.Stream stream)
269+
{
270+
httpRequestMessageLocalVar.Content = new StreamContent(stream);
271+
}
272+
else
273+
{
274+
httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(helloWorldPostRequest.Value, _jsonSerializerOptions));
275+
}
276+
}
255277

256278
httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
257279

samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,21 @@ public sealed partial class DefaultApi : IDefaultApi
106106
{
107107
private JsonSerializerOptions _jsonSerializerOptions;
108108

109+
private readonly string[] _contentHeaders =
110+
[
111+
"allow",
112+
"content-encoding",
113+
"content-language",
114+
"content-length",
115+
"content-location",
116+
"content-md5",
117+
"content-range",
118+
"content-type",
119+
"expires",
120+
"last-modified",
121+
"extension-header"
122+
];
123+
109124
/// <summary>
110125
/// The logger factory
111126
/// </summary>

samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Api/DefaultApi.cs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,21 @@ public sealed partial class DefaultApi : IDefaultApi
106106
{
107107
private JsonSerializerOptions _jsonSerializerOptions;
108108

109+
private readonly string[] _contentHeaders =
110+
[
111+
"allow",
112+
"content-encoding",
113+
"content-language",
114+
"content-length",
115+
"content-location",
116+
"content-md5",
117+
"content-range",
118+
"content-type",
119+
"expires",
120+
"last-modified",
121+
"extension-header"
122+
];
123+
109124
/// <summary>
110125
/// The logger factory
111126
/// </summary>
@@ -230,9 +245,16 @@ public async Task<IOneOfArrayApiResponse> OneOfArrayAsync(Option<OneOfArrayReque
230245
: string.Concat(HttpClient.BaseAddress.AbsolutePath.TrimEnd('/'), "/one-of-array");
231246

232247
if (oneOfArrayRequest.IsSet)
233-
httpRequestMessageLocalVar.Content = (oneOfArrayRequest.Value as object) is System.IO.Stream stream
234-
? httpRequestMessageLocalVar.Content = new StreamContent(stream)
235-
: httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(oneOfArrayRequest.Value, _jsonSerializerOptions));
248+
{
249+
if ((oneOfArrayRequest.Value as object) is System.IO.Stream stream)
250+
{
251+
httpRequestMessageLocalVar.Content = new StreamContent(stream);
252+
}
253+
else
254+
{
255+
httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(oneOfArrayRequest.Value, _jsonSerializerOptions));
256+
}
257+
}
236258

237259
httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
238260

samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,21 @@ public sealed partial class APIKEYSApi : IAPIKEYSApi
106106
{
107107
private JsonSerializerOptions _jsonSerializerOptions;
108108

109+
private readonly string[] _contentHeaders =
110+
[
111+
"allow",
112+
"content-encoding",
113+
"content-language",
114+
"content-length",
115+
"content-location",
116+
"content-md5",
117+
"content-range",
118+
"content-type",
119+
"expires",
120+
"last-modified",
121+
"extension-header"
122+
];
123+
109124
/// <summary>
110125
/// The logger factory
111126
/// </summary>

samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ public sealed partial class APIKeysApi : IAPIKeysApi
9494
{
9595
private JsonSerializerOptions _jsonSerializerOptions;
9696

97+
private readonly string[] _contentHeaders =
98+
[
99+
"allow",
100+
"content-encoding",
101+
"content-language",
102+
"content-length",
103+
"content-location",
104+
"content-md5",
105+
"content-range",
106+
"content-type",
107+
"expires",
108+
"last-modified",
109+
"extension-header"
110+
];
111+
97112
/// <summary>
98113
/// The logger factory
99114
/// </summary>

samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ public sealed partial class ApiKeysApi : IApiKeysApi
9494
{
9595
private JsonSerializerOptions _jsonSerializerOptions;
9696

97+
private readonly string[] _contentHeaders =
98+
[
99+
"allow",
100+
"content-encoding",
101+
"content-language",
102+
"content-length",
103+
"content-location",
104+
"content-md5",
105+
"content-range",
106+
"content-type",
107+
"expires",
108+
"last-modified",
109+
"extension-header"
110+
];
111+
97112
/// <summary>
98113
/// The logger factory
99114
/// </summary>

samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Api/AnotherFakeApi.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,21 @@ public sealed partial class AnotherFakeApi : IAnotherFakeApi
106106
{
107107
private JsonSerializerOptions _jsonSerializerOptions;
108108

109+
private readonly string[] _contentHeaders =
110+
[
111+
"allow",
112+
"content-encoding",
113+
"content-language",
114+
"content-length",
115+
"content-location",
116+
"content-md5",
117+
"content-range",
118+
"content-type",
119+
"expires",
120+
"last-modified",
121+
"extension-header"
122+
];
123+
109124
/// <summary>
110125
/// The logger factory
111126
/// </summary>
@@ -277,9 +292,14 @@ public async Task<ICall123TestSpecialTagsApiResponse> Call123TestSpecialTagsAsyn
277292
? "/another-fake/dummy"
278293
: string.Concat(HttpClient.BaseAddress.AbsolutePath.TrimEnd('/'), "/another-fake/dummy");
279294

280-
httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream
281-
? httpRequestMessageLocalVar.Content = new StreamContent(stream)
282-
: httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions));
295+
if ((modelClient as object) is System.IO.Stream stream)
296+
{
297+
httpRequestMessageLocalVar.Content = new StreamContent(stream);
298+
}
299+
else
300+
{
301+
httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions));
302+
}
283303

284304
httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
285305

samples/client/petstore/csharp/generichost/latest/UseDateTimeOffset/src/Org.OpenAPITools/Api/DefaultApi.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,21 @@ public sealed partial class DefaultApi : IDefaultApi
377377
{
378378
private JsonSerializerOptions _jsonSerializerOptions;
379379

380+
private readonly string[] _contentHeaders =
381+
[
382+
"allow",
383+
"content-encoding",
384+
"content-language",
385+
"content-length",
386+
"content-location",
387+
"content-md5",
388+
"content-range",
389+
"content-type",
390+
"expires",
391+
"last-modified",
392+
"extension-header"
393+
];
394+
380395
/// <summary>
381396
/// The logger factory
382397
/// </summary>

0 commit comments

Comments
 (0)