Skip to content

Commit 721c823

Browse files
committed
fix: Fixed deepinfra.json issues
1 parent 185dd5e commit 721c823

File tree

590 files changed

+77012
-2
lines changed

Some content is hidden

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

590 files changed

+77012
-2
lines changed

specs/deepinfra.json

Lines changed: 10526 additions & 0 deletions
Large diffs are not rendered by default.

src/libs/AutoSDK/Models/SchemaContext.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ public static IReadOnlyList<SchemaContext> FromSchema(
310310
}
311311

312312
var i = 0;
313-
foreach (var property in schema.Properties)
313+
foreach (var property in schema.Properties
314+
.Where(x => x.Value != null))
314315
{
315316
children.AddRange(FromSchema(
316317
schema: property.Value,

src/libs/AutoSDK/Models/TypeData.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace AutoSDK.Models;
66

7+
#pragma warning disable CA1308
8+
79
public record struct TypeData(
810
string CSharpTypeRaw,
911
bool CSharpTypeNullability,
@@ -228,7 +230,7 @@ public static string GetCSharpType(SchemaContext context)
228230
{
229231
context = context ?? throw new ArgumentNullException(nameof(context));
230232

231-
var type = (context.Schema.Type, context.Schema.Format) switch
233+
var type = (context.Schema.Type?.ToLowerInvariant(), context.Schema.Format) switch
232234
{
233235
(_, _) when context.Schema.IsUnixTimestamp() => "global::System.DateTimeOffset",
234236

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
//HintName: G.Exceptions.g.cs
2+
#nullable enable
3+
4+
namespace G
5+
{
6+
/// <summary>
7+
/// Represents an exception thrown by the API.
8+
/// </summary>
9+
[global::System.Serializable]
10+
public partial class ApiException : global::System.Exception
11+
{
12+
/// <summary>
13+
/// The HTTP status code of the response.
14+
/// </summary>
15+
public global::System.Net.HttpStatusCode StatusCode { get; }
16+
/// <summary>
17+
/// The response body.
18+
/// </summary>
19+
public string? ResponseBody { get; set; }
20+
/// <summary>
21+
/// The response headers.
22+
/// </summary>
23+
public global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>>? ResponseHeaders { get; set; }
24+
/// <summary>
25+
/// Initializes a new instance of the <see cref="ApiException"/> class.
26+
/// </summary>
27+
public ApiException()
28+
{
29+
}
30+
31+
/// <summary>
32+
/// Initializes a new instance of the <see cref="ApiException"/> class with a specified error message.
33+
/// </summary>
34+
/// <param name="message">The message that describes the error.</param>
35+
/// <param name="statusCode">The HTTP status code of the response.</param>
36+
public ApiException(string message, global::System.Net.HttpStatusCode statusCode) : base(message)
37+
{
38+
StatusCode = statusCode;
39+
}
40+
41+
/// <summary>
42+
/// Initializes a new instance of the <see cref="ApiException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception.
43+
/// </summary>
44+
/// <param name="message">The error message that explains the reason for the exception.</param>
45+
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
46+
/// <param name="statusCode">The HTTP status code of the response.</param>
47+
public ApiException(string message, global::System.Exception innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException)
48+
{
49+
StatusCode = statusCode;
50+
}
51+
}
52+
53+
/// <summary>
54+
/// Represents an exception thrown by the API.
55+
/// </summary>
56+
/// <typeparam name="T"></typeparam>
57+
[global::System.Serializable]
58+
public partial class ApiException<T> : ApiException
59+
{
60+
/// <summary>
61+
/// The response object.
62+
/// </summary>
63+
public T? ResponseObject { get; set; }
64+
65+
/// <summary>
66+
/// Initializes a new instance of the <see cref="ApiException"/> class.
67+
/// </summary>
68+
public ApiException()
69+
{
70+
}
71+
72+
/// <summary>
73+
/// Initializes a new instance of the <see cref="ApiException"/> class with a specified error message.
74+
/// </summary>
75+
/// <param name="message">The message that describes the error.</param>
76+
/// <param name="statusCode">The HTTP status code of the response.</param>
77+
public ApiException(string message, global::System.Net.HttpStatusCode statusCode) : base(message, statusCode)
78+
{
79+
}
80+
81+
/// <summary>
82+
/// Initializes a new instance of the <see cref="ApiException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception.
83+
/// </summary>
84+
/// <param name="message">The error message that explains the reason for the exception.</param>
85+
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
86+
/// <param name="statusCode">The HTTP status code of the response.</param>
87+
public ApiException(string message, global::System.Exception innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException, statusCode)
88+
{
89+
}
90+
}
91+
}
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
//HintName: G.PathBuilder.g.cs
2+
#nullable enable
3+
4+
namespace G
5+
{
6+
/// <summary>
7+
/// A helper class to build URL paths with optional and required parameters.
8+
/// </summary>
9+
public class PathBuilder
10+
{
11+
private readonly global::System.Text.StringBuilder _stringBuilder =
12+
new global::System.Text.StringBuilder(capacity: 256);
13+
private bool _firstParameter = true;
14+
15+
/// <summary>
16+
/// Initializes a new instance of the <see cref="PathBuilder"/> class.
17+
/// </summary>
18+
/// <param name="path">The base path for the URL.</param>
19+
/// <param name="baseUri">The base URI to prepend to the path, if any.</param>
20+
public PathBuilder(
21+
string path,
22+
global::System.Uri? baseUri = null)
23+
{
24+
if (baseUri is not null)
25+
{
26+
_stringBuilder.Append(baseUri.AbsoluteUri.TrimEnd('/'));
27+
}
28+
29+
_stringBuilder.Append(path);
30+
}
31+
32+
/// <summary>
33+
/// Adds a required parameter to the URL.
34+
/// </summary>
35+
/// <param name="name">The name of the parameter.</param>
36+
/// <param name="value">The value of the parameter.</param>
37+
/// <returns>The current <see cref="PathBuilder"/> instance.</returns>
38+
public PathBuilder AddRequiredParameter(
39+
string name,
40+
string value)
41+
{
42+
if (_firstParameter)
43+
{
44+
_stringBuilder.Append('?');
45+
_firstParameter = false;
46+
}
47+
else
48+
{
49+
_stringBuilder.Append('&');
50+
}
51+
52+
_stringBuilder.Append(global::System.Uri.EscapeDataString(name));
53+
_stringBuilder.Append('=');
54+
_stringBuilder.Append(global::System.Uri.EscapeDataString(value));
55+
56+
return this;
57+
}
58+
59+
/// <summary>
60+
/// Adds a required parameter with multiple values to the URL.
61+
/// </summary>
62+
/// <param name="name">The name of the parameter.</param>
63+
/// <param name="value">The values of the parameter.</param>
64+
/// <param name="delimiter">The delimiter to use between values.</param>
65+
/// <param name="explode">Whether to explode the values into separate parameters.</param>
66+
/// <returns>The current <see cref="PathBuilder"/> instance.</returns>
67+
public PathBuilder AddRequiredParameter(
68+
string name,
69+
global::System.Collections.Generic.IEnumerable<string> value,
70+
string delimiter = ",",
71+
bool explode = false)
72+
{
73+
if (explode)
74+
{
75+
foreach (var item in value)
76+
{
77+
AddRequiredParameter($"{name}", item);
78+
}
79+
80+
return this;
81+
}
82+
83+
AddRequiredParameter(name, string.Join(delimiter, value));
84+
85+
return this;
86+
}
87+
88+
/// <summary>
89+
/// Adds a required parameter with multiple values to the URL, using a selector function.
90+
/// </summary>
91+
/// <typeparam name="T">The type of the values.</typeparam>
92+
/// <param name="name">The name of the parameter.</param>
93+
/// <param name="value">The values of the parameter.</param>
94+
/// <param name="selector">The function to select the string representation of each value.</param>
95+
/// <param name="delimiter">The delimiter to use between values.</param>
96+
/// <param name="explode">Whether to explode the values into separate parameters.</param>
97+
/// <returns>The current <see cref="PathBuilder"/> instance.</returns>
98+
public PathBuilder AddRequiredParameter<T>(
99+
string name,
100+
global::System.Collections.Generic.IEnumerable<T> value,
101+
global::System.Func<T, string> selector,
102+
string delimiter = ",",
103+
bool explode = false)
104+
{
105+
AddRequiredParameter(
106+
name,
107+
global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(value, selector)),
108+
delimiter,
109+
explode);
110+
111+
return this;
112+
}
113+
114+
/// <summary>
115+
/// Adds an optional parameter to the URL.
116+
/// </summary>
117+
/// <param name="name">The name of the parameter.</param>
118+
/// <param name="value">The value of the parameter, or null if not present.</param>
119+
/// <returns>The current <see cref="PathBuilder"/> instance.</returns>
120+
public PathBuilder AddOptionalParameter(
121+
string name,
122+
string? value)
123+
{
124+
if (value is not null)
125+
{
126+
AddRequiredParameter(name, value);
127+
}
128+
129+
return this;
130+
}
131+
132+
/// <summary>
133+
/// Adds an optional parameter with multiple values to the URL.
134+
/// </summary>
135+
/// <param name="name">The name of the parameter.</param>
136+
/// <param name="value">The values of the parameter, or null if not present.</param>
137+
/// <param name="delimiter">The delimiter to use between values.</param>
138+
/// <param name="explode">Whether to explode the values into separate parameters.</param>
139+
/// <returns>The current <see cref="PathBuilder"/> instance.</returns>
140+
public PathBuilder AddOptionalParameter(
141+
string name,
142+
global::System.Collections.Generic.IEnumerable<string>? value,
143+
string delimiter = ",",
144+
bool explode = false)
145+
{
146+
if (value is not null)
147+
{
148+
AddRequiredParameter(name, value, delimiter, explode);
149+
}
150+
151+
return this;
152+
}
153+
154+
/// <summary>
155+
/// Adds an optional parameter with multiple values to the URL, using a selector function.
156+
/// </summary>
157+
/// <typeparam name="T">The type of the values.</typeparam>
158+
/// <param name="name">The name of the parameter.</param>
159+
/// <param name="value">The values of the parameter, or null if not present.</param>
160+
/// <param name="selector">The function to select the string representation of each value.</param>
161+
/// <param name="delimiter">The delimiter to use between values.</param>
162+
/// <param name="explode">Whether to explode the values into separate parameters.</param>
163+
/// <returns>The current <see cref="PathBuilder"/> instance.</returns>
164+
public PathBuilder AddOptionalParameter<T>(
165+
string name,
166+
global::System.Collections.Generic.IEnumerable<T>? value,
167+
global::System.Func<T, string> selector,
168+
string delimiter = ",",
169+
bool explode = false)
170+
{
171+
if (value is not null)
172+
{
173+
AddRequiredParameter(
174+
name,
175+
global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(value, selector)),
176+
delimiter,
177+
explode);
178+
}
179+
180+
return this;
181+
}
182+
183+
/// <summary>
184+
/// Adds a required parameter to the URL, using a formattable value.
185+
/// </summary>
186+
/// <typeparam name="T">The type of the value.</typeparam>
187+
/// <param name="name">The name of the parameter.</param>
188+
/// <param name="value">The value of the parameter.</param>
189+
/// <param name="format">The format string.</param>
190+
/// <param name="formatProvider">The format provider.</param>
191+
/// <returns>The current <see cref="PathBuilder"/> instance.</returns>
192+
public PathBuilder AddRequiredParameter<T>(
193+
string name,
194+
T value,
195+
string? format = null,
196+
global::System.IFormatProvider? formatProvider = null)
197+
where T : global::System.IFormattable
198+
{
199+
AddRequiredParameter(name, value.ToString(format, formatProvider));
200+
201+
return this;
202+
}
203+
204+
/// <summary>
205+
/// Adds an optional parameter to the URL, using a formattable value.
206+
/// </summary>
207+
/// <typeparam name="T">The type of the value.</typeparam>
208+
/// <param name="name">The name of the parameter.</param>
209+
/// <param name="value">The value of the parameter, or null if not present.</param>
210+
/// <param name="format">The format string.</param>
211+
/// <param name="formatProvider">The format provider.</param>
212+
/// <returns>The current <see cref="PathBuilder"/> instance.</returns>
213+
public PathBuilder AddOptionalParameter<T>(
214+
string name,
215+
T? value,
216+
string? format = null,
217+
global::System.IFormatProvider? formatProvider = null)
218+
where T : global::System.IFormattable
219+
{
220+
if (value is not null)
221+
{
222+
AddOptionalParameter(name, value.ToString(format, formatProvider));
223+
}
224+
225+
return this;
226+
}
227+
228+
/// <summary>
229+
/// Returns the constructed URL as a string.
230+
/// </summary>
231+
/// <returns>The constructed URL.</returns>
232+
public override string ToString() => _stringBuilder.ToString();
233+
}
234+
235+
/// <summary>
236+
///
237+
/// </summary>
238+
public class EndPointAuthorization
239+
{
240+
/// <summary>
241+
///
242+
/// </summary>
243+
public string Type { get; set; } = string.Empty;
244+
245+
/// <summary>
246+
///
247+
/// </summary>
248+
public string Location { get; set; } = string.Empty;
249+
250+
/// <summary>
251+
///
252+
/// </summary>
253+
public string Name { get; set; } = string.Empty;
254+
255+
/// <summary>
256+
///
257+
/// </summary>
258+
public string Value { get; set; } = string.Empty;
259+
}
260+
}

0 commit comments

Comments
 (0)