RESTCLIENT.NET / API REFERENCE
RestClient.Net.OpenApiGenerator.CodeGenerationHelpers
All API types · RestClient.Net.OpenApiGenerator · View source
public static partial class CodeGenerationHelpers
Helper methods for code generation.
Members
BuildPathExpression
public static string BuildPathExpression(string path);
Builds a path expression from a path template.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
string |
Required | The path template. |
Returns: The path expression.
View source: RestClient.Net.OpenApiGenerator/CodeGenerationHelpers.cs:72
Indent
public static string Indent(string text, int level);
Indents text by the specified number of levels.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
string |
Required | The text to indent. |
level |
int |
Required | The indentation level (1 level = 4 spaces). |
Returns: The indented text.
View source: RestClient.Net.OpenApiGenerator/CodeGenerationHelpers.cs:63
PathParameterRegex
[GeneratedRegex(@"\{[^}]+\}")]
public static partial Regex PathParameterRegex();
Regular expression for matching path parameters.
View source: RestClient.Net.OpenApiGenerator/CodeGenerationHelpers.cs:97
SanitizePathParameters
public static string SanitizePathParameters(string path, List<ParameterInfo> parameters);
Replaces path parameter names with their sanitized C# equivalents.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
string |
Required | The path template with original parameter names. |
parameters |
List<ParameterInfo> |
Required | List of parameters with original and sanitized names. |
Returns: The path with sanitized parameter names.
View source: RestClient.Net.OpenApiGenerator/CodeGenerationHelpers.cs:81
ToCamelCase
public static string ToCamelCase(string text);
Converts a string to camelCase.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
string |
Required | The text to convert. |
Returns: The camelCase version of the text.
View source: RestClient.Net.OpenApiGenerator/CodeGenerationHelpers.cs:48
ToPascalCase
public static string ToPascalCase(string text);
Converts a string to PascalCase.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
string |
Required | The text to convert. |
Returns: The PascalCase version of the text.
View source: RestClient.Net.OpenApiGenerator/CodeGenerationHelpers.cs:11