Skip to content

Commit 87aedfe

Browse files
author
github-actions[bot]
committed
feat: Updated OpenAPI spec
1 parent 331793a commit 87aedfe

115 files changed

Lines changed: 2114 additions & 2592 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.

src/libs/Voicebox/Generated/Voicebox.Exceptions.g.cs

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@ public partial class ApiException : global::System.Exception
1212
/// The HTTP status code of the response.
1313
/// </summary>
1414
public global::System.Net.HttpStatusCode StatusCode { get; }
15+
1516
/// <summary>
1617
/// The response body as a string, or <c>null</c> if the body could not be read.
1718
/// This is always populated for error responses regardless of the <c>ReadResponseAsString</c> setting.
1819
/// For success-path failures (e.g. deserialization errors), the client attempts a best-effort read.
1920
/// </summary>
2021
public string? ResponseBody { get; set; }
22+
2123
/// <summary>
2224
/// The response headers.
2325
/// </summary>
2426
public global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>>? ResponseHeaders { get; set; }
27+
2528
/// <summary>
2629
/// Initializes a new instance of the <see cref="ApiException"/> class.
2730
/// </summary>
@@ -49,6 +52,103 @@ public ApiException(string message, global::System.Exception? innerException, gl
4952
{
5053
StatusCode = statusCode;
5154
}
55+
56+
/// <summary>
57+
/// Constructs an <see cref="ApiException"/> instance whose runtime type matches the response status code when the typed exception hierarchy is enabled. Always returns a plain <see cref="ApiException"/> when the hierarchy is disabled.
58+
/// </summary>
59+
/// <param name="statusCode">The HTTP status code of the response.</param>
60+
/// <param name="message">The error message.</param>
61+
/// <param name="innerException">An inner exception, when one is available.</param>
62+
/// <param name="responseHeaders">The response headers; consulted for 429 <c>Retry-After</c> parsing when present.</param>
63+
public static global::Voicebox.ApiException Create(
64+
global::System.Net.HttpStatusCode statusCode,
65+
string message,
66+
global::System.Exception? innerException = null,
67+
global::System.Collections.Generic.IDictionary<string, global::System.Collections.Generic.IEnumerable<string>>? responseHeaders = null)
68+
{
69+
return new global::Voicebox.ApiException(message, innerException, statusCode);
70+
}
71+
72+
/// <summary>
73+
/// Convenience overload that constructs an <see cref="ApiException"/> with response body and headers populated.
74+
/// </summary>
75+
public static global::Voicebox.ApiException Create(
76+
global::System.Net.HttpStatusCode statusCode,
77+
string message,
78+
global::System.Exception? innerException,
79+
string? responseBody,
80+
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>>? responseHeaders)
81+
{
82+
var exception = global::Voicebox.ApiException.Create(statusCode, message, innerException, responseHeaders);
83+
exception.ResponseBody = responseBody;
84+
exception.ResponseHeaders = responseHeaders;
85+
return exception;
86+
}
87+
88+
/// <summary>
89+
/// Parses a <c>Retry-After</c> response header (delta-seconds or HTTP-date) into a <see cref="global::System.TimeSpan"/>.
90+
/// Returns <c>null</c> when the header is missing or unparseable. Public so consumer code that observes
91+
/// <see cref="ApiException"/> directly can recover the value without re-implementing the parser.
92+
/// </summary>
93+
public static global::System.TimeSpan? TryParseRetryAfter(
94+
global::System.Collections.Generic.IDictionary<string, global::System.Collections.Generic.IEnumerable<string>>? headers)
95+
{
96+
if (headers == null)
97+
{
98+
return null;
99+
}
100+
101+
global::System.Collections.Generic.IEnumerable<string>? values = null;
102+
foreach (var entry in headers)
103+
{
104+
if (string.Equals(entry.Key, "Retry-After", global::System.StringComparison.OrdinalIgnoreCase))
105+
{
106+
values = entry.Value;
107+
break;
108+
}
109+
}
110+
111+
if (values == null)
112+
{
113+
return null;
114+
}
115+
116+
string? raw = null;
117+
foreach (var value in values)
118+
{
119+
if (!string.IsNullOrWhiteSpace(value))
120+
{
121+
raw = value.Trim();
122+
break;
123+
}
124+
}
125+
126+
if (string.IsNullOrEmpty(raw))
127+
{
128+
return null;
129+
}
130+
131+
if (int.TryParse(
132+
raw,
133+
global::System.Globalization.NumberStyles.Integer,
134+
global::System.Globalization.CultureInfo.InvariantCulture,
135+
out var seconds) && seconds >= 0)
136+
{
137+
return global::System.TimeSpan.FromSeconds(seconds);
138+
}
139+
140+
if (global::System.DateTimeOffset.TryParse(
141+
raw,
142+
global::System.Globalization.CultureInfo.InvariantCulture,
143+
global::System.Globalization.DateTimeStyles.AssumeUniversal | global::System.Globalization.DateTimeStyles.AdjustToUniversal,
144+
out var when))
145+
{
146+
var delta = when - global::System.DateTimeOffset.UtcNow;
147+
return delta > global::System.TimeSpan.Zero ? delta : global::System.TimeSpan.Zero;
148+
}
149+
150+
return null;
151+
}
52152
}
53153

54154
/// <summary>
@@ -88,5 +188,39 @@ public ApiException(string message, global::System.Net.HttpStatusCode statusCode
88188
public ApiException(string message, global::System.Exception? innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException, statusCode)
89189
{
90190
}
191+
192+
/// <summary>
193+
/// Constructs an <see cref="ApiException{T}"/> whose runtime type matches the response status code when the typed exception hierarchy is enabled.
194+
/// </summary>
195+
/// <param name="statusCode">The HTTP status code of the response.</param>
196+
/// <param name="message">The error message.</param>
197+
/// <param name="innerException">An inner exception, when one is available.</param>
198+
/// <param name="responseHeaders">The response headers; consulted for 429 <c>Retry-After</c> parsing when present.</param>
199+
public static new global::Voicebox.ApiException<T> Create(
200+
global::System.Net.HttpStatusCode statusCode,
201+
string message,
202+
global::System.Exception? innerException = null,
203+
global::System.Collections.Generic.IDictionary<string, global::System.Collections.Generic.IEnumerable<string>>? responseHeaders = null)
204+
{
205+
return new global::Voicebox.ApiException<T>(message, innerException, statusCode);
206+
}
207+
208+
/// <summary>
209+
/// Convenience overload that constructs an <see cref="ApiException{T}"/> with response body, object, and headers populated.
210+
/// </summary>
211+
public static global::Voicebox.ApiException<T> Create(
212+
global::System.Net.HttpStatusCode statusCode,
213+
string message,
214+
global::System.Exception? innerException,
215+
string? responseBody,
216+
T? responseObject,
217+
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>>? responseHeaders)
218+
{
219+
var exception = global::Voicebox.ApiException<T>.Create(statusCode, message, innerException, responseHeaders);
220+
exception.ResponseBody = responseBody;
221+
exception.ResponseObject = responseObject;
222+
exception.ResponseHeaders = responseHeaders;
223+
return exception;
224+
}
91225
}
92226
}

0 commit comments

Comments
 (0)