diff --git a/src/libs/OpenAI/Generated/OpenAI.PathBuilder.g.cs b/src/libs/OpenAI/Generated/OpenAI.PathBuilder.g.cs index 2861d7fa..f1c9c28b 100644 --- a/src/libs/OpenAI/Generated/OpenAI.PathBuilder.g.cs +++ b/src/libs/OpenAI/Generated/OpenAI.PathBuilder.g.cs @@ -4,11 +4,20 @@ namespace OpenAI { + /// + /// A helper class to build URL paths with optional and required parameters. + /// public class PathBuilder { private readonly global::System.Text.StringBuilder _stringBuilder = new global::System.Text.StringBuilder(capacity: 256); private bool _firstParameter = true; + + /// + /// Initializes a new instance of the class. + /// + /// The base path for the URL. + /// The base URI to prepend to the path, if any. public PathBuilder( string path, global::System.Uri? baseUri = null) @@ -17,8 +26,16 @@ public PathBuilder( { _stringBuilder.Append(baseUri.AbsoluteUri.TrimEnd('/')); } + _stringBuilder.Append(path); } + + /// + /// Adds a required parameter to the URL. + /// + /// The name of the parameter. + /// The value of the parameter. + /// The current instance. public PathBuilder AddRequiredParameter( string name, string value) @@ -36,8 +53,18 @@ public PathBuilder AddRequiredParameter( _stringBuilder.Append(global::System.Uri.EscapeDataString(name)); _stringBuilder.Append('='); _stringBuilder.Append(global::System.Uri.EscapeDataString(value)); + return this; } + + /// + /// Adds a required parameter with multiple values to the URL. + /// + /// The name of the parameter. + /// The values of the parameter. + /// The delimiter to use between values. + /// Whether to explode the values into separate parameters. + /// The current instance. public PathBuilder AddRequiredParameter( string name, global::System.Collections.Generic.IEnumerable value, @@ -53,9 +80,22 @@ public PathBuilder AddRequiredParameter( return this; } + AddRequiredParameter(name, string.Join(delimiter, value)); + return this; } + + /// + /// Adds a required parameter with multiple values to the URL, using a selector function. + /// + /// The type of the values. + /// The name of the parameter. + /// The values of the parameter. + /// The function to select the string representation of each value. + /// The delimiter to use between values. + /// Whether to explode the values into separate parameters. + /// The current instance. public PathBuilder AddRequiredParameter( string name, global::System.Collections.Generic.IEnumerable value, @@ -64,8 +104,16 @@ public PathBuilder AddRequiredParameter( bool explode = false) { AddRequiredParameter(name, value.Select(selector).ToArray(), delimiter, explode); + return this; } + + /// + /// Adds an optional parameter to the URL. + /// + /// The name of the parameter. + /// The value of the parameter, or null if not present. + /// The current instance. public PathBuilder AddOptionalParameter( string name, string? value) @@ -74,8 +122,18 @@ public PathBuilder AddOptionalParameter( { AddRequiredParameter(name, value); } + return this; } + + /// + /// Adds an optional parameter with multiple values to the URL. + /// + /// The name of the parameter. + /// The values of the parameter, or null if not present. + /// The delimiter to use between values. + /// Whether to explode the values into separate parameters. + /// The current instance. public PathBuilder AddOptionalParameter( string name, global::System.Collections.Generic.IEnumerable? value, @@ -86,8 +144,20 @@ public PathBuilder AddOptionalParameter( { AddRequiredParameter(name, value, delimiter, explode); } + return this; } + + /// + /// Adds an optional parameter with multiple values to the URL, using a selector function. + /// + /// The type of the values. + /// The name of the parameter. + /// The values of the parameter, or null if not present. + /// The function to select the string representation of each value. + /// The delimiter to use between values. + /// Whether to explode the values into separate parameters. + /// The current instance. public PathBuilder AddOptionalParameter( string name, global::System.Collections.Generic.IEnumerable? value, @@ -99,8 +169,19 @@ public PathBuilder AddOptionalParameter( { AddRequiredParameter(name, value.Select(selector).ToArray(), delimiter, explode); } + return this; } + + /// + /// Adds a required parameter to the URL, using a formattable value. + /// + /// The type of the value. + /// The name of the parameter. + /// The value of the parameter. + /// The format string. + /// The format provider. + /// The current instance. public PathBuilder AddRequiredParameter( string name, T value, @@ -109,8 +190,19 @@ public PathBuilder AddRequiredParameter( where T : global::System.IFormattable { AddRequiredParameter(name, value.ToString(format, formatProvider)); + return this; } + + /// + /// Adds an optional parameter to the URL, using a formattable value. + /// + /// The type of the value. + /// The name of the parameter. + /// The value of the parameter, or null if not present. + /// The format string. + /// The format provider. + /// The current instance. public PathBuilder AddOptionalParameter( string name, T? value, @@ -122,8 +214,14 @@ public PathBuilder AddOptionalParameter( { AddOptionalParameter(name, value.ToString(format, formatProvider)); } + return this; } + + /// + /// Returns the constructed URL as a string. + /// + /// The constructed URL. public override string ToString() => _stringBuilder.ToString(); } } \ No newline at end of file