Skip to content

Commit 032817f

Browse files
committed
Update samples and documentation
1 parent 5cc695a commit 032817f

193 files changed

Lines changed: 2603 additions & 1077 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/ComposedEnum/src/Org.OpenAPITools/Client/ApiResponse`1.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public partial interface IApiResponse
5252
/// </summary>
5353
System.Net.Http.Headers.HttpResponseHeaders Headers { get; }
5454

55+
/// <summary>
56+
/// The headers contained in the api response related to the content
57+
/// </summary>
58+
System.Net.Http.Headers.HttpContentHeaders ContentHeaders { get; }
59+
5560
/// <summary>
5661
/// The path used when making the request.
5762
/// </summary>
@@ -109,6 +114,11 @@ public partial class ApiResponse : IApiResponse
109114
/// </summary>
110115
public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }
111116

117+
/// <summary>
118+
/// The headers contained in the api response related to the content
119+
/// </summary>
120+
public System.Net.Http.Headers.HttpContentHeaders ContentHeaders { get; }
121+
112122
/// <summary>
113123
/// The DateTime when the request was retrieved.
114124
/// </summary>
@@ -147,6 +157,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
147157
{
148158
StatusCode = httpResponseMessage.StatusCode;
149159
Headers = httpResponseMessage.Headers;
160+
ContentHeaders = httpResponseMessage.Content.Headers;
150161
IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode;
151162
ReasonPhrase = httpResponseMessage.ReasonPhrase;
152163
RawContent = rawContent;
@@ -170,6 +181,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
170181
{
171182
StatusCode = httpResponseMessage.StatusCode;
172183
Headers = httpResponseMessage.Headers;
184+
ContentHeaders = httpResponseMessage.Content.Headers;
173185
IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode;
174186
ReasonPhrase = httpResponseMessage.ReasonPhrase;
175187
ContentStream = contentStream;
@@ -181,6 +193,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
181193
OnCreated(httpRequestMessage, httpResponseMessage);
182194
}
183195

196+
184197
partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
185198
}
186199
}

samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System.Text.RegularExpressions;
2020
using Org.OpenAPITools.Model;
2121
using System.Runtime.CompilerServices;
22+
using System.Net.Http.Headers;
2223

2324
[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")]
2425

@@ -226,6 +227,26 @@ public static byte[] ReadAsBytes(Stream inputStream)
226227
return string.Join(",", accepts);
227228
}
228229

230+
231+
232+
/// <summary>
233+
/// Select the Accept header's value from the given accepts array:
234+
/// if JSON exists in the given array, use it;
235+
/// otherwise use all of them.
236+
/// </summary>
237+
/// <param name="accepts">The accepts array to select from.</param>
238+
/// <returns>The Accept header values to use.</returns>
239+
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
240+
{
241+
if (accepts.Length == 0)
242+
return null;
243+
244+
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
245+
return [MediaTypeWithQualityHeaderValue.Parse("application/json")];
246+
247+
return accepts.Select(MediaTypeWithQualityHeaderValue.Parse);
248+
}
249+
229250
/// <summary>
230251
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
231252
/// </summary>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
using System;
1414
using System.Collections.Generic;
15+
using System.Collections.ObjectModel;
1516
using System.Net;
17+
using System.IO;
1618
using System.Threading.Tasks;
1719
using Microsoft.Extensions.Logging;
1820
using System.Net.Http;

samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ApiResponse`1.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public partial interface IApiResponse
5252
/// </summary>
5353
System.Net.Http.Headers.HttpResponseHeaders Headers { get; }
5454

55+
/// <summary>
56+
/// The headers contained in the api response related to the content
57+
/// </summary>
58+
System.Net.Http.Headers.HttpContentHeaders ContentHeaders { get; }
59+
5560
/// <summary>
5661
/// The path used when making the request.
5762
/// </summary>
@@ -109,6 +114,11 @@ public partial class ApiResponse : IApiResponse
109114
/// </summary>
110115
public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }
111116

117+
/// <summary>
118+
/// The headers contained in the api response related to the content
119+
/// </summary>
120+
public System.Net.Http.Headers.HttpContentHeaders ContentHeaders { get; }
121+
112122
/// <summary>
113123
/// The DateTime when the request was retrieved.
114124
/// </summary>
@@ -147,6 +157,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
147157
{
148158
StatusCode = httpResponseMessage.StatusCode;
149159
Headers = httpResponseMessage.Headers;
160+
ContentHeaders = httpResponseMessage.Content.Headers;
150161
IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode;
151162
ReasonPhrase = httpResponseMessage.ReasonPhrase;
152163
RawContent = rawContent;
@@ -170,6 +181,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
170181
{
171182
StatusCode = httpResponseMessage.StatusCode;
172183
Headers = httpResponseMessage.Headers;
184+
ContentHeaders = httpResponseMessage.Content.Headers;
173185
IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode;
174186
ReasonPhrase = httpResponseMessage.ReasonPhrase;
175187
ContentStream = contentStream;
@@ -181,6 +193,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
181193
OnCreated(httpRequestMessage, httpResponseMessage);
182194
}
183195

196+
184197
partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
185198
}
186199
}

samples/client/petstore/csharp/generichost/latest/HelloWorld/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System.Text.RegularExpressions;
2020
using Org.OpenAPITools.Model;
2121
using System.Runtime.CompilerServices;
22+
using System.Net.Http.Headers;
2223

2324
[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")]
2425

@@ -220,6 +221,26 @@ public static byte[] ReadAsBytes(Stream inputStream)
220221
return string.Join(",", accepts);
221222
}
222223

224+
225+
226+
/// <summary>
227+
/// Select the Accept header's value from the given accepts array:
228+
/// if JSON exists in the given array, use it;
229+
/// otherwise use all of them.
230+
/// </summary>
231+
/// <param name="accepts">The accepts array to select from.</param>
232+
/// <returns>The Accept header values to use.</returns>
233+
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
234+
{
235+
if (accepts.Length == 0)
236+
return null;
237+
238+
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
239+
return [MediaTypeWithQualityHeaderValue.Parse("application/json")];
240+
241+
return accepts.Select(MediaTypeWithQualityHeaderValue.Parse);
242+
}
243+
223244
/// <summary>
224245
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
225246
/// </summary>

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
using System;
1414
using System.Collections.Generic;
15+
using System.Collections.ObjectModel;
1516
using System.Net;
17+
using System.IO;
1618
using System.Threading.Tasks;
1719
using Microsoft.Extensions.Logging;
1820
using System.Net.Http;
@@ -253,10 +255,10 @@ public async Task<IIconsApiResponse> IconsAsync(Option<IconsSizeParameter> size
253255
"application/json"
254256
};
255257

256-
string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
258+
IEnumerable<MediaTypeWithQualityHeaderValue> acceptHeaderValuesLocalVar = ClientUtils.SelectHeaderAcceptArray(acceptLocalVars);
257259

258-
if (acceptLocalVar != null)
259-
httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
260+
foreach (var acceptLocalVar in acceptHeaderValuesLocalVar)
261+
httpRequestMessageLocalVar.Headers.Accept.Add(acceptLocalVar);
260262

261263
httpRequestMessageLocalVar.Method = HttpMethod.Get;
262264

samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public partial interface IApiResponse
5252
/// </summary>
5353
System.Net.Http.Headers.HttpResponseHeaders Headers { get; }
5454

55+
/// <summary>
56+
/// The headers contained in the api response related to the content
57+
/// </summary>
58+
System.Net.Http.Headers.HttpContentHeaders ContentHeaders { get; }
59+
5560
/// <summary>
5661
/// The path used when making the request.
5762
/// </summary>
@@ -109,6 +114,11 @@ public partial class ApiResponse : IApiResponse
109114
/// </summary>
110115
public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }
111116

117+
/// <summary>
118+
/// The headers contained in the api response related to the content
119+
/// </summary>
120+
public System.Net.Http.Headers.HttpContentHeaders ContentHeaders { get; }
121+
112122
/// <summary>
113123
/// The DateTime when the request was retrieved.
114124
/// </summary>
@@ -147,6 +157,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
147157
{
148158
StatusCode = httpResponseMessage.StatusCode;
149159
Headers = httpResponseMessage.Headers;
160+
ContentHeaders = httpResponseMessage.Content.Headers;
150161
IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode;
151162
ReasonPhrase = httpResponseMessage.ReasonPhrase;
152163
RawContent = rawContent;
@@ -170,6 +181,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
170181
{
171182
StatusCode = httpResponseMessage.StatusCode;
172183
Headers = httpResponseMessage.Headers;
184+
ContentHeaders = httpResponseMessage.Content.Headers;
173185
IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode;
174186
ReasonPhrase = httpResponseMessage.ReasonPhrase;
175187
ContentStream = contentStream;
@@ -181,6 +193,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
181193
OnCreated(httpRequestMessage, httpResponseMessage);
182194
}
183195

196+
184197
partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
185198
}
186199

samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System.Text.RegularExpressions;
2020
using Org.OpenAPITools.Model;
2121
using System.Runtime.CompilerServices;
22+
using System.Net.Http.Headers;
2223

2324
[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")]
2425

@@ -222,6 +223,26 @@ public static byte[] ReadAsBytes(Stream inputStream)
222223
return string.Join(",", accepts);
223224
}
224225

226+
227+
228+
/// <summary>
229+
/// Select the Accept header's value from the given accepts array:
230+
/// if JSON exists in the given array, use it;
231+
/// otherwise use all of them.
232+
/// </summary>
233+
/// <param name="accepts">The accepts array to select from.</param>
234+
/// <returns>The Accept header values to use.</returns>
235+
public static IEnumerable<MediaTypeWithQualityHeaderValue> SelectHeaderAcceptArray(string[] accepts)
236+
{
237+
if (accepts.Length == 0)
238+
return null;
239+
240+
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
241+
return [MediaTypeWithQualityHeaderValue.Parse("application/json")];
242+
243+
return accepts.Select(MediaTypeWithQualityHeaderValue.Parse);
244+
}
245+
225246
/// <summary>
226247
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
227248
/// </summary>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
using System;
1414
using System.Collections.Generic;
15+
using System.Collections.ObjectModel;
1516
using System.Net;
17+
using System.IO;
1618
using System.Threading.Tasks;
1719
using Microsoft.Extensions.Logging;
1820
using System.Net.Http;

samples/client/petstore/csharp/generichost/latest/OneOfList/src/Org.OpenAPITools/Client/ApiResponse`1.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public partial interface IApiResponse
5252
/// </summary>
5353
System.Net.Http.Headers.HttpResponseHeaders Headers { get; }
5454

55+
/// <summary>
56+
/// The headers contained in the api response related to the content
57+
/// </summary>
58+
System.Net.Http.Headers.HttpContentHeaders ContentHeaders { get; }
59+
5560
/// <summary>
5661
/// The path used when making the request.
5762
/// </summary>
@@ -109,6 +114,11 @@ public partial class ApiResponse : IApiResponse
109114
/// </summary>
110115
public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }
111116

117+
/// <summary>
118+
/// The headers contained in the api response related to the content
119+
/// </summary>
120+
public System.Net.Http.Headers.HttpContentHeaders ContentHeaders { get; }
121+
112122
/// <summary>
113123
/// The DateTime when the request was retrieved.
114124
/// </summary>
@@ -147,6 +157,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
147157
{
148158
StatusCode = httpResponseMessage.StatusCode;
149159
Headers = httpResponseMessage.Headers;
160+
ContentHeaders = httpResponseMessage.Content.Headers;
150161
IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode;
151162
ReasonPhrase = httpResponseMessage.ReasonPhrase;
152163
RawContent = rawContent;
@@ -170,6 +181,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
170181
{
171182
StatusCode = httpResponseMessage.StatusCode;
172183
Headers = httpResponseMessage.Headers;
184+
ContentHeaders = httpResponseMessage.Content.Headers;
173185
IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode;
174186
ReasonPhrase = httpResponseMessage.ReasonPhrase;
175187
ContentStream = contentStream;
@@ -181,6 +193,7 @@ public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage
181193
OnCreated(httpRequestMessage, httpResponseMessage);
182194
}
183195

196+
184197
partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
185198
}
186199
}

0 commit comments

Comments
 (0)