Update Autorest (#321)
* Update to autorest * More * Noreset * Again * Fixes and comments * More fixes * Launch settings
This commit is contained in:
Родитель
808f6fc147
Коммит
4839e20154
|
@ -1,4 +1,4 @@
|
||||||
param($name, [switch]$noDebug)
|
param($name, [switch]$noDebug, [switch]$NoReset)
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
function Invoke-Block([scriptblock]$cmd) {
|
function Invoke-Block([scriptblock]$cmd) {
|
||||||
|
@ -38,6 +38,11 @@ $configurationPath = Join-Path $testServerDirectory 'readme.tests.md'
|
||||||
$testServerSwaggerPath = Join-Path $repoRoot 'node_modules' '@microsoft.azure' 'autorest.testserver' 'swagger'
|
$testServerSwaggerPath = Join-Path $repoRoot 'node_modules' '@microsoft.azure' 'autorest.testserver' 'swagger'
|
||||||
$testNames = if ($name) { $name } else { 'url', 'body-string', 'body-complex', 'custom-baseUrl', 'custom-baseUrl-more-options', 'header' }
|
$testNames = if ($name) { $name } else { 'url', 'body-string', 'body-complex', 'custom-baseUrl', 'custom-baseUrl-more-options', 'header' }
|
||||||
|
|
||||||
|
if (!$NoReset)
|
||||||
|
{
|
||||||
|
Invoke-AutoRest "--reset" $repoRoot
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($testName in $testNames)
|
foreach ($testName in $testNames)
|
||||||
{
|
{
|
||||||
$inputFile = Join-Path $testServerSwaggerPath "$testName.json"
|
$inputFile = Join-Path $testServerSwaggerPath "$testName.json"
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@autorest/autorest": {
|
"@autorest/autorest": {
|
||||||
"version": "3.0.6122",
|
"version": "https://github.com/Azure/autorest/releases/download/autorest-3.0.6146/autorest-autorest-3.0.6146.tgz",
|
||||||
"resolved": "https://registry.npmjs.org/@autorest/autorest/-/autorest-3.0.6122.tgz",
|
"integrity": "sha512-K+2u+CyT6EKb9loGqHE5forJTqVH9042ivJQcLzKaH9CrJWkF5jF2LYBHu8ffszyHv6vLQuHSUNgM6Km2kdkbQ==",
|
||||||
"integrity": "sha512-A7eapUdRG/HRDAV6rVFHD/CyK4sAshaQjaAJBZJk9jBFxjUGSPMk1PjCFpP50pvZs5iL/EktBW1/ncFaw4SiTA==",
|
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@autorest/test-server": {
|
"@autorest/test-server": {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"debug": "dotnet ./artifacts/bin/AutoRest.CSharp.V3/Debug/netcoreapp3.0/AutoRest.CSharp.V3.dll --server --launch-debugger"
|
"debug": "dotnet ./artifacts/bin/AutoRest.CSharp.V3/Debug/netcoreapp3.0/AutoRest.CSharp.V3.dll --server --launch-debugger"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@autorest/autorest": "^3.0.6122",
|
"@autorest/autorest": "https://github.com/Azure/autorest/releases/download/autorest-3.0.6146/autorest-autorest-3.0.6146.tgz",
|
||||||
"@autorest/test-server": "3.0.27",
|
"@autorest/test-server": "3.0.27",
|
||||||
"@microsoft.azure/autorest.testserver": "^2.7.1"
|
"@microsoft.azure/autorest.testserver": "^2.7.1"
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
## Configuration
|
## Configuration
|
||||||
```yaml
|
```yaml
|
||||||
use-extension:
|
use-extension:
|
||||||
"@autorest/modelerfour": "4.1.60"
|
"@autorest/modelerfour": "4.2.84"
|
||||||
|
version: 3.0.6162
|
||||||
pipeline:
|
pipeline:
|
||||||
cs-modeler:
|
cs-modeler:
|
||||||
input: modelerfour/identity
|
input: modelerfour/identity
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace AutoRest.CSharp.V3.ClientModels
|
||||||
{
|
{
|
||||||
internal struct ClientConstant
|
internal struct ClientConstant
|
||||||
{
|
{
|
||||||
public ClientConstant(object? value, FrameworkTypeReference type)
|
public ClientConstant(object? value, ClientTypeReference type)
|
||||||
{
|
{
|
||||||
Debug.Assert(value == null || value.GetType().Namespace?.StartsWith("System") == true);
|
Debug.Assert(value == null || value.GetType().Namespace?.StartsWith("System") == true);
|
||||||
Value = value;
|
Value = value;
|
||||||
|
@ -23,13 +23,20 @@ namespace AutoRest.CSharp.V3.ClientModels
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.GetType() != type.Type)
|
var expectedType = type switch
|
||||||
|
{
|
||||||
|
BinaryTypeReference _ => typeof(byte[]),
|
||||||
|
FrameworkTypeReference frameworkType => frameworkType.Type,
|
||||||
|
_ => throw new InvalidOperationException("Unexpected type kind")
|
||||||
|
};
|
||||||
|
|
||||||
|
if (value.GetType() != expectedType)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Constant type mismatch");
|
throw new InvalidOperationException("Constant type mismatch");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public object? Value { get; }
|
public object? Value { get; }
|
||||||
public FrameworkTypeReference Type { get; }
|
public ClientTypeReference Type { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,17 @@ namespace AutoRest.CSharp.V3.ClientModels
|
||||||
{
|
{
|
||||||
internal class QueryParameter
|
internal class QueryParameter
|
||||||
{
|
{
|
||||||
public QueryParameter(string name, ConstantOrParameter value, bool escape)
|
public QueryParameter(string name, ConstantOrParameter value, bool escape, SerializationFormat serializationFormat)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Value = value;
|
Value = value;
|
||||||
Escape = escape;
|
Escape = escape;
|
||||||
|
SerializationFormat = serializationFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
public ConstantOrParameter Value { get; }
|
public ConstantOrParameter Value { get; }
|
||||||
|
public SerializationFormat SerializationFormat { get; }
|
||||||
public bool Escape { get; }
|
public bool Escape { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,60 @@ namespace AutoRest.CSharp.V3.CodeGen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void WriteConstant(ClientConstant constant)
|
||||||
|
{
|
||||||
|
if (constant.Value == null)
|
||||||
|
{
|
||||||
|
Literal(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (constant.Type)
|
||||||
|
{
|
||||||
|
case FrameworkTypeReference frameworkType when frameworkType.Type == typeof(DateTime):
|
||||||
|
var dateTimeValue = (DateTime)constant.Value;
|
||||||
|
dateTimeValue = dateTimeValue.ToUniversalTime();
|
||||||
|
|
||||||
|
Append("new ");
|
||||||
|
Append(Type(typeof(DateTime)));
|
||||||
|
Append("(");
|
||||||
|
Literal(dateTimeValue.Year);
|
||||||
|
Append(", ");
|
||||||
|
Literal(dateTimeValue.Month);
|
||||||
|
Append(", ");
|
||||||
|
Literal(dateTimeValue.Day);
|
||||||
|
Append(", ");
|
||||||
|
Literal(dateTimeValue.Hour);
|
||||||
|
Append(", ");
|
||||||
|
Literal(dateTimeValue.Minute);
|
||||||
|
Append(", ");
|
||||||
|
Literal(dateTimeValue.Second);
|
||||||
|
Append(", ");
|
||||||
|
Literal(dateTimeValue.Millisecond);
|
||||||
|
Append(", ");
|
||||||
|
Append(Type(typeof(DateTimeKind)));
|
||||||
|
Append(".");
|
||||||
|
Append(nameof(DateTimeKind.Utc));
|
||||||
|
Append(")");
|
||||||
|
break;
|
||||||
|
case FrameworkTypeReference _:
|
||||||
|
Literal(constant.Value);
|
||||||
|
break;
|
||||||
|
case BinaryTypeReference _:
|
||||||
|
var value = (byte[])constant.Value;
|
||||||
|
Append("new byte[] {");
|
||||||
|
foreach (byte b in value)
|
||||||
|
{
|
||||||
|
Literal(b);
|
||||||
|
Append(", ");
|
||||||
|
}
|
||||||
|
Append("}");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new InvalidOperationException("Unknown constant type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void WritePathSegment(PathSegment segment)
|
private void WritePathSegment(PathSegment segment)
|
||||||
{
|
{
|
||||||
var value = segment.Value;
|
var value = segment.Value;
|
||||||
|
@ -144,7 +198,7 @@ namespace AutoRest.CSharp.V3.CodeGen
|
||||||
if (value.IsConstant)
|
if (value.IsConstant)
|
||||||
{
|
{
|
||||||
Append("request.Uri.AppendPath(");
|
Append("request.Uri.AppendPath(");
|
||||||
Literal(value.Constant.Value);
|
WriteConstant(value.Constant);
|
||||||
WriteSerializationFormat(segment.Format);
|
WriteSerializationFormat(segment.Format);
|
||||||
Append(", ");
|
Append(", ");
|
||||||
Literal(segment.Escape);
|
Literal(segment.Escape);
|
||||||
|
@ -167,7 +221,7 @@ namespace AutoRest.CSharp.V3.CodeGen
|
||||||
Append("request.Headers.Add(");
|
Append("request.Headers.Add(");
|
||||||
Literal(header.Name);
|
Literal(header.Name);
|
||||||
Append(", ");
|
Append(", ");
|
||||||
Literal(header.Value.Constant.Value);
|
WriteConstant(header.Value.Constant);
|
||||||
Line(");");
|
Line(");");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +270,8 @@ namespace AutoRest.CSharp.V3.CodeGen
|
||||||
Append("request.Uri.AppendQuery(");
|
Append("request.Uri.AppendQuery(");
|
||||||
Literal(queryParameter.Name);
|
Literal(queryParameter.Name);
|
||||||
Append(", ");
|
Append(", ");
|
||||||
Literal(value.Constant.Value);
|
WriteConstant(value.Constant);
|
||||||
|
WriteSerializationFormat(queryParameter.SerializationFormat);
|
||||||
Append(", ");
|
Append(", ");
|
||||||
Literal(queryParameter.Escape);
|
Literal(queryParameter.Escape);
|
||||||
Line(");");
|
Line(");");
|
||||||
|
@ -235,6 +290,7 @@ namespace AutoRest.CSharp.V3.CodeGen
|
||||||
{
|
{
|
||||||
Append(".Value");
|
Append(".Value");
|
||||||
}
|
}
|
||||||
|
WriteSerializationFormat(queryParameter.SerializationFormat);
|
||||||
Append(", ");
|
Append(", ");
|
||||||
Literal(queryParameter.Escape);
|
Literal(queryParameter.Escape);
|
||||||
Line(");");
|
Line(");");
|
||||||
|
|
|
@ -1500,8 +1500,11 @@ namespace AutoRest.CSharp.V3.Pipeline.Generated
|
||||||
[System.Runtime.Serialization.EnumMember(Value = @"spaceDelimited")]
|
[System.Runtime.Serialization.EnumMember(Value = @"spaceDelimited")]
|
||||||
SpaceDelimited = 8,
|
SpaceDelimited = 8,
|
||||||
|
|
||||||
|
[System.Runtime.Serialization.EnumMember(Value = @"tabDelimited")]
|
||||||
|
TabDelimited = 9,
|
||||||
|
|
||||||
[System.Runtime.Serialization.EnumMember(Value = @"xml")]
|
[System.Runtime.Serialization.EnumMember(Value = @"xml")]
|
||||||
Xml = 9,
|
Xml = 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.23.0 (Newtonsoft.Json v9.0.0.0)")]
|
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.0.23.0 (Newtonsoft.Json v9.0.0.0)")]
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -86,11 +87,13 @@ namespace AutoRest.CSharp.V3.Plugins
|
||||||
string defaultName = requestParameter.Language.Default.Name;
|
string defaultName = requestParameter.Language.Default.Name;
|
||||||
string serializedName = requestParameter.Language.Default.SerializedName ?? defaultName;
|
string serializedName = requestParameter.Language.Default.SerializedName ?? defaultName;
|
||||||
ConstantOrParameter? constantOrParameter;
|
ConstantOrParameter? constantOrParameter;
|
||||||
|
Schema valueSchema = requestParameter.Schema;
|
||||||
|
|
||||||
switch (requestParameter.Schema)
|
switch (requestParameter.Schema)
|
||||||
{
|
{
|
||||||
case ConstantSchema constant:
|
case ConstantSchema constant:
|
||||||
constantOrParameter = ParseClientConstant(constant.Value.Value, (FrameworkTypeReference)CreateType(constant.ValueType, true));
|
constantOrParameter = ParseClientConstant(constant.Value.Value, CreateType(constant.ValueType, true));
|
||||||
|
valueSchema = constant.ValueType;
|
||||||
break;
|
break;
|
||||||
case BinarySchema _:
|
case BinarySchema _:
|
||||||
// skip
|
// skip
|
||||||
|
@ -116,16 +119,17 @@ namespace AutoRest.CSharp.V3.Plugins
|
||||||
|
|
||||||
if (requestParameter.Protocol.Http is HttpParameter httpParameter)
|
if (requestParameter.Protocol.Http is HttpParameter httpParameter)
|
||||||
{
|
{
|
||||||
|
SerializationFormat serializationFormat = GetSerializationFormat(valueSchema);
|
||||||
switch (httpParameter.In)
|
switch (httpParameter.In)
|
||||||
{
|
{
|
||||||
case ParameterLocation.Header:
|
case ParameterLocation.Header:
|
||||||
headers.Add(new RequestHeader(serializedName, constantOrParameter.Value, GetSerializationFormat(requestParameter.Schema)));
|
headers.Add(new RequestHeader(serializedName, constantOrParameter.Value, serializationFormat));
|
||||||
break;
|
break;
|
||||||
case ParameterLocation.Query:
|
case ParameterLocation.Query:
|
||||||
query.Add(new QueryParameter(serializedName, constantOrParameter.Value, true));
|
query.Add(new QueryParameter(serializedName, constantOrParameter.Value, true, serializationFormat));
|
||||||
break;
|
break;
|
||||||
case ParameterLocation.Path:
|
case ParameterLocation.Path:
|
||||||
pathParameters.Add(serializedName, new PathSegment(constantOrParameter.Value, true, GetSerializationFormat(requestParameter.Schema)));
|
pathParameters.Add(serializedName, new PathSegment(constantOrParameter.Value, true, serializationFormat));
|
||||||
break;
|
break;
|
||||||
case ParameterLocation.Body:
|
case ParameterLocation.Body:
|
||||||
body = constantOrParameter;
|
body = constantOrParameter;
|
||||||
|
@ -178,8 +182,8 @@ namespace AutoRest.CSharp.V3.Plugins
|
||||||
{
|
{
|
||||||
UnixTimeSchema _ => SerializationFormat.DateTimeUnix,
|
UnixTimeSchema _ => SerializationFormat.DateTimeUnix,
|
||||||
DateTimeSchema dateTimeSchema when dateTimeSchema.Format == DateTimeSchemaFormat.DateTime => SerializationFormat.DateTimeISO8601,
|
DateTimeSchema dateTimeSchema when dateTimeSchema.Format == DateTimeSchemaFormat.DateTime => SerializationFormat.DateTimeISO8601,
|
||||||
DateSchema _ => SerializationFormat.Date,
|
|
||||||
DateTimeSchema dateTimeSchema when dateTimeSchema.Format == DateTimeSchemaFormat.DateTimeRfc1123 => SerializationFormat.DateTimeRFC1123,
|
DateTimeSchema dateTimeSchema when dateTimeSchema.Format == DateTimeSchemaFormat.DateTimeRfc1123 => SerializationFormat.DateTimeRFC1123,
|
||||||
|
DateSchema _ => SerializationFormat.Date,
|
||||||
_ => SerializationFormat.Default,
|
_ => SerializationFormat.Default,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -276,9 +280,18 @@ namespace AutoRest.CSharp.V3.Plugins
|
||||||
_ => new SchemaTypeReference(schema, isNullable)
|
_ => new SchemaTypeReference(schema, isNullable)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static ClientConstant ParseClientConstant(object? value, FrameworkTypeReference type)
|
private static ClientConstant ParseClientConstant(object? value, ClientTypeReference type)
|
||||||
{
|
{
|
||||||
return new ClientConstant(Convert.ChangeType(value, type.Type), type);
|
var normalizedValue = type switch
|
||||||
|
{
|
||||||
|
BinaryTypeReference _ when value is string base64String => Convert.FromBase64String(base64String),
|
||||||
|
FrameworkTypeReference frameworkType when
|
||||||
|
frameworkType.Type == typeof(DateTime) &&
|
||||||
|
value is string dateTimeString => DateTime.Parse(dateTimeString, styles: DateTimeStyles.AssumeUniversal),
|
||||||
|
FrameworkTypeReference frameworkType => Convert.ChangeType(value, frameworkType.Type),
|
||||||
|
_ => null
|
||||||
|
};
|
||||||
|
return new ClientConstant(normalizedValue, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Refactor as this is written quite... ugly.
|
//TODO: Refactor as this is written quite... ugly.
|
||||||
|
|
|
@ -19,14 +19,13 @@ namespace AutoRest.CodeModel
|
||||||
private static void Main()
|
private static void Main()
|
||||||
{
|
{
|
||||||
using var webClient = new WebClient();
|
using var webClient = new WebClient();
|
||||||
webClient.DownloadFile(@"https://raw.githubusercontent.com/Azure/perks/master/codemodel/.resources/all-in-one/json/code-model.json", "../../../../../src/AutoRest.CodeModel/code-model.json");
|
webClient.DownloadFile(@"https://raw.githubusercontent.com/Azure/perks/master/codemodel/.resources/all-in-one/json/code-model.json", "code-model.json");
|
||||||
|
|
||||||
var schemaJsonLines = File.ReadAllLines("../../../../../src/AutoRest.CodeModel/code-model.json");
|
var schemaJson = File.ReadAllText("code-model.json")
|
||||||
var schemaJson = String.Join(Environment.NewLine, schemaJsonLines)
|
|
||||||
// Fixes + and - enum values that cannot be generated into C# enum names
|
// Fixes + and - enum values that cannot be generated into C# enum names
|
||||||
.Replace("\"+\"", "\"plus\"").Replace("\"-\"", "\"minus\"")
|
.Replace("\"+\"", "\"plus\"").Replace("\"-\"", "\"minus\"")
|
||||||
// Makes Choices only have string values
|
// Makes Choices only have string values
|
||||||
.Replace($" \"type\": [{Environment.NewLine} \"string\",{Environment.NewLine} \"number\",{Environment.NewLine} \"boolean\"{Environment.NewLine} ]{Environment.NewLine}", $" \"type\": \"string\"{Environment.NewLine}");
|
.Replace(" \"type\": [\n \"string\",\n \"number\",\n \"boolean\"\n ]\n", $" \"type\": \"string\"\n");
|
||||||
var schema = JsonSchema.FromJsonAsync(schemaJson).GetAwaiter().GetResult();
|
var schema = JsonSchema.FromJsonAsync(schemaJson).GetAwaiter().GetResult();
|
||||||
var settings = new CSharpGeneratorSettings
|
var settings = new CSharpGeneratorSettings
|
||||||
{
|
{
|
||||||
|
@ -67,7 +66,7 @@ namespace AutoRest.CodeModel
|
||||||
})
|
})
|
||||||
.SkipLast(1)
|
.SkipLast(1)
|
||||||
.Prepend(lines.First()));
|
.Prepend(lines.First()));
|
||||||
File.WriteAllText($"../../../../../src/{Path}/CodeModel.cs", fileWithNullable);
|
File.WriteAllText($"../../src/{Path}/CodeModel.cs", fileWithNullable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"AutoRest.CodeModel": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"workingDirectory": "$(ProjectDir)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2024,6 +2024,7 @@
|
||||||
"pipeDelimited",
|
"pipeDelimited",
|
||||||
"simple",
|
"simple",
|
||||||
"spaceDelimited",
|
"spaceDelimited",
|
||||||
|
"tabDelimited",
|
||||||
"xml"
|
"xml"
|
||||||
],
|
],
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|
|
@ -62,6 +62,11 @@ namespace Azure.Core
|
||||||
builder.AppendQuery(name, value.ToString(TypeFormatters.DefaultNumberFormat), escape);
|
builder.AppendQuery(name, value.ToString(TypeFormatters.DefaultNumberFormat), escape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void AppendQuery(this RequestUriBuilder builder, string name, DateTime value, string format, bool escape = true)
|
||||||
|
{
|
||||||
|
builder.AppendQuery(name, TypeFormatters.ToString(value, format), escape);
|
||||||
|
}
|
||||||
|
|
||||||
public static void AppendQuery(this RequestUriBuilder builder, string name, double value, bool escape = true)
|
public static void AppendQuery(this RequestUriBuilder builder, string name, double value, bool escape = true)
|
||||||
{
|
{
|
||||||
builder.AppendQuery(name, value.ToString(TypeFormatters.DefaultNumberFormat), escape);
|
builder.AppendQuery(name, value.ToString(TypeFormatters.DefaultNumberFormat), escape);
|
||||||
|
|
|
@ -985,5 +985,15 @@ namespace AutoRest.TestServer.Tests
|
||||||
var value = new ReadonlyObj();
|
var value = new ReadonlyObj();
|
||||||
return await ReadonlypropertyOperations.PutValidAsync(ClientDiagnostics, pipeline, value, host);
|
return await ReadonlypropertyOperations.PutValidAsync(ClientDiagnostics, pipeline, value, host);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void EnumGeneratedAsExtensibleWithCorrectName()
|
||||||
|
{
|
||||||
|
// Name directive
|
||||||
|
Assert.AreEqual("CMYKColors", typeof(CMYKColors).Name);
|
||||||
|
// modelAsString
|
||||||
|
Assert.True(typeof(CMYKColors).IsValueType);
|
||||||
|
Assert.False(typeof(CMYKColors).IsEnum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,22 +13,56 @@ namespace AutoRest.TestServer.Tests
|
||||||
public UrlPathItemsTests(TestServerVersion version) : base(version, "pathitem") { }
|
public UrlPathItemsTests(TestServerVersion version) : base(version, "pathitem") { }
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("globalStringQuery not generated")]
|
[IgnoreOnTestServer(TestServerVersion.V2, "No recording")]
|
||||||
public Task UrlPathItemGetAll() => TestStatus(async (host, pipeline) =>
|
public Task UrlPathItemGetAll() => TestStatus(async (host, pipeline) =>
|
||||||
await PathItemsOperations.GetAllWithValuesAsync(ClientDiagnostics, pipeline, pathItemStringPath: "pathItemStringPath", pathItemStringQuery: "pathItemStringQuery", localStringPath: "localStringPath", localStringQuery: "localStringQuery", host));
|
await PathItemsOperations.GetAllWithValuesAsync(ClientDiagnostics,
|
||||||
|
pipeline,
|
||||||
|
pathItemStringPath: "pathItemStringPath",
|
||||||
|
pathItemStringQuery: "pathItemStringQuery",
|
||||||
|
globalStringPath: "globalStringPath",
|
||||||
|
globalStringQuery: "globalStringQuery",
|
||||||
|
localStringPath: "localStringPath",
|
||||||
|
localStringQuery: "localStringQuery",
|
||||||
|
host: host));
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("globalStringQuery not generated")]
|
|
||||||
public Task UrlPathItemGetPathItemAndLocalNull() => TestStatus(async (host, pipeline) =>
|
public Task UrlPathItemGetPathItemAndLocalNull() => TestStatus(async (host, pipeline) =>
|
||||||
await PathItemsOperations.GetLocalPathItemQueryNullAsync(ClientDiagnostics, pipeline, pathItemStringPath: "pathItemStringPath", pathItemStringQuery: "pathItemStringQuery", localStringPath: "localStringPath", localStringQuery: null, host));
|
await PathItemsOperations.GetLocalPathItemQueryNullAsync(
|
||||||
|
ClientDiagnostics,
|
||||||
|
pipeline,
|
||||||
|
pathItemStringPath: "pathItemStringPath",
|
||||||
|
pathItemStringQuery: null,
|
||||||
|
globalStringPath: "globalStringPath",
|
||||||
|
globalStringQuery: "globalStringQuery",
|
||||||
|
localStringPath: "localStringPath",
|
||||||
|
localStringQuery: null,
|
||||||
|
host));
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[IgnoreOnTestServer(TestServerVersion.V2, "No recording")]
|
[IgnoreOnTestServer(TestServerVersion.V2, "No recording")]
|
||||||
public Task UrlPathItemGetGlobalNull() => TestStatus(async (host, pipeline) =>
|
public Task UrlPathItemGetGlobalNull() => TestStatus(async (host, pipeline) =>
|
||||||
await PathItemsOperations.GetGlobalQueryNullAsync(ClientDiagnostics, pipeline, pathItemStringPath: "pathItemStringPath", pathItemStringQuery: "pathItemStringQuery", localStringPath: "localStringPath", localStringQuery: "localStringQuery", host));
|
await PathItemsOperations.GetGlobalQueryNullAsync(
|
||||||
|
ClientDiagnostics,
|
||||||
|
pipeline,
|
||||||
|
pathItemStringPath: "pathItemStringPath",
|
||||||
|
pathItemStringQuery: "pathItemStringQuery",
|
||||||
|
globalStringPath: "globalStringPath",
|
||||||
|
globalStringQuery: null,
|
||||||
|
localStringPath: "localStringPath",
|
||||||
|
localStringQuery: "localStringQuery",
|
||||||
|
host));
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public Task UrlPathItemGetGlobalAndLocalNull() => TestStatus(async (host, pipeline) =>
|
public Task UrlPathItemGetGlobalAndLocalNull() => TestStatus(async (host, pipeline) =>
|
||||||
await PathItemsOperations.GetGlobalAndLocalQueryNullAsync(ClientDiagnostics, pipeline, pathItemStringPath: "pathItemStringPath", pathItemStringQuery: "pathItemStringQuery", localStringPath: "localStringPath", localStringQuery: null, host));
|
await PathItemsOperations.GetGlobalAndLocalQueryNullAsync(
|
||||||
|
ClientDiagnostics,
|
||||||
|
pipeline,
|
||||||
|
pathItemStringPath: "pathItemStringPath",
|
||||||
|
pathItemStringQuery: "pathItemStringQuery",
|
||||||
|
globalStringPath: "globalStringPath",
|
||||||
|
globalStringQuery: null,
|
||||||
|
localStringPath: "localStringPath",
|
||||||
|
localStringQuery: null,
|
||||||
|
host));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ namespace AutoRest.TestServer.Tests
|
||||||
public Task UrlQueriesStringNull() => TestStatus(async (host, pipeline) => await QueriesOperations.StringNullAsync(ClientDiagnostics, pipeline, null, host: host));
|
public Task UrlQueriesStringNull() => TestStatus(async (host, pipeline) => await QueriesOperations.StringNullAsync(ClientDiagnostics, pipeline, null, host: host));
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
[Ignore("Not implemented https://github.com/Azure/autorest.csharp/issues/325")]
|
||||||
public Task UrlQueriesEnumValid() => TestStatus(async (host, pipeline) => await QueriesOperations.EnumValidAsync(ClientDiagnostics, pipeline, UriColor.GreenColor, host: host));
|
public Task UrlQueriesEnumValid() => TestStatus(async (host, pipeline) => await QueriesOperations.EnumValidAsync(ClientDiagnostics, pipeline, UriColor.GreenColor, host: host));
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace AutoRest.TestServer.Tests
|
||||||
public Task UrlPathsStringEmpty() => TestStatus(async (host, pipeline) => await PathsOperations.StringEmptyAsync(ClientDiagnostics, pipeline, host));
|
public Task UrlPathsStringEmpty() => TestStatus(async (host, pipeline) => await PathsOperations.StringEmptyAsync(ClientDiagnostics, pipeline, host));
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
[Ignore("Not implemented https://github.com/Azure/autorest.csharp/issues/325")]
|
||||||
public Task UrlPathsEnumValid() => TestStatus(async (host, pipeline) => await PathsOperations.EnumValidAsync(ClientDiagnostics, pipeline, UriColor.GreenColor, host));
|
public Task UrlPathsEnumValid() => TestStatus(async (host, pipeline) => await PathsOperations.EnumValidAsync(ClientDiagnostics, pipeline, UriColor.GreenColor, host));
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -105,6 +106,14 @@ namespace AutoRest.TestServer.Tests
|
||||||
[Test]
|
[Test]
|
||||||
public Task UrlPathsDoublePositive() => TestStatus(async (host, pipeline) => await PathsOperations.DoubleDecimalPositiveAsync(ClientDiagnostics, pipeline, host));
|
public Task UrlPathsDoublePositive() => TestStatus(async (host, pipeline) => await PathsOperations.DoubleDecimalPositiveAsync(ClientDiagnostics, pipeline, host));
|
||||||
|
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void EnumGeneratedNonExtesibleWithoutModelAsString()
|
||||||
|
{
|
||||||
|
// modelAsString
|
||||||
|
Assert.True(typeof(UriColor).IsEnum);
|
||||||
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> AdditionalKnownScenarios { get; } = new string[] {"UrlPathsBoolFalse",
|
public override IEnumerable<string> AdditionalKnownScenarios { get; } = new string[] {"UrlPathsBoolFalse",
|
||||||
"UrlPathsBoolTrue",
|
"UrlPathsBoolTrue",
|
||||||
"UrlPathsIntPositive",
|
"UrlPathsIntPositive",
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace body_complex.Models.V20160229
|
||||||
if (Color != null)
|
if (Color != null)
|
||||||
{
|
{
|
||||||
writer.WritePropertyName("color");
|
writer.WritePropertyName("color");
|
||||||
writer.WriteStringValue(Color.Value.ToSerialString());
|
writer.WriteStringValue(Color.ToString());
|
||||||
}
|
}
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ namespace body_complex.Models.V20160229
|
||||||
}
|
}
|
||||||
if (property.NameEquals("color"))
|
if (property.NameEquals("color"))
|
||||||
{
|
{
|
||||||
result.Color = property.Value.GetString().ToCMYKColors();
|
result.Color = new CMYKColors(property.Value.GetString());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace body_complex.Models.V20160229
|
|
||||||
{
|
|
||||||
internal static class CMYKColorsExtensions
|
|
||||||
{
|
|
||||||
public static string ToSerialString(this CMYKColors value) => value switch
|
|
||||||
{
|
|
||||||
CMYKColors.Cyan => "cyan",
|
|
||||||
CMYKColors.Magenta => "Magenta",
|
|
||||||
CMYKColors.YELLOW => "YELLOW",
|
|
||||||
CMYKColors.BlacK => "blacK",
|
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown CMYKColors value.")
|
|
||||||
};
|
|
||||||
|
|
||||||
public static CMYKColors ToCMYKColors(this string value) => value switch
|
|
||||||
{
|
|
||||||
"cyan" => CMYKColors.Cyan,
|
|
||||||
"Magenta" => CMYKColors.Magenta,
|
|
||||||
"YELLOW" => CMYKColors.YELLOW,
|
|
||||||
"blacK" => CMYKColors.BlacK,
|
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown CMYKColors value.")
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +1,39 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace body_complex.Models.V20160229
|
namespace body_complex.Models.V20160229
|
||||||
{
|
{
|
||||||
public enum CMYKColors
|
public readonly partial struct CMYKColors : IEquatable<CMYKColors>
|
||||||
{
|
{
|
||||||
Cyan,
|
private readonly string? _value;
|
||||||
Magenta,
|
|
||||||
YELLOW,
|
public CMYKColors(string value)
|
||||||
BlacK
|
{
|
||||||
|
_value = value ?? throw new ArgumentNullException(nameof(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
private const string CyanValue = "cyan";
|
||||||
|
private const string MagentaValue = "Magenta";
|
||||||
|
private const string YELLOWValue = "YELLOW";
|
||||||
|
private const string BlacKValue = "blacK";
|
||||||
|
|
||||||
|
public static CMYKColors Cyan { get; } = new CMYKColors(CyanValue);
|
||||||
|
public static CMYKColors Magenta { get; } = new CMYKColors(MagentaValue);
|
||||||
|
public static CMYKColors YELLOW { get; } = new CMYKColors(YELLOWValue);
|
||||||
|
public static CMYKColors BlacK { get; } = new CMYKColors(BlacKValue);
|
||||||
|
public static bool operator ==(CMYKColors left, CMYKColors right) => left.Equals(right);
|
||||||
|
public static bool operator !=(CMYKColors left, CMYKColors right) => !left.Equals(right);
|
||||||
|
public static implicit operator CMYKColors(string value) => new CMYKColors(value);
|
||||||
|
|
||||||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
|
public override bool Equals(object? obj) => obj is CMYKColors other && Equals(other);
|
||||||
|
public bool Equals(CMYKColors other) => string.Equals(_value, other._value, StringComparison.Ordinal);
|
||||||
|
|
||||||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
|
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
|
||||||
|
public override string? ToString() => _value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
// Licensed under the MIT License.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace body_complex.Models.V20160229
|
|
||||||
{
|
|
||||||
internal static class GoblinSharkColorExtensions
|
|
||||||
{
|
|
||||||
public static string ToSerialString(this GoblinSharkColor value) => value switch
|
|
||||||
{
|
|
||||||
GoblinSharkColor.Pink => "pink",
|
|
||||||
GoblinSharkColor.Gray => "gray",
|
|
||||||
GoblinSharkColor.Brown => "brown",
|
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown GoblinSharkColor value.")
|
|
||||||
};
|
|
||||||
|
|
||||||
public static GoblinSharkColor ToGoblinSharkColor(this string value) => value switch
|
|
||||||
{
|
|
||||||
"pink" => GoblinSharkColor.Pink,
|
|
||||||
"gray" => GoblinSharkColor.Gray,
|
|
||||||
"brown" => GoblinSharkColor.Brown,
|
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown GoblinSharkColor value.")
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +1,37 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace body_complex.Models.V20160229
|
namespace body_complex.Models.V20160229
|
||||||
{
|
{
|
||||||
public enum GoblinSharkColor
|
public readonly partial struct GoblinSharkColor : IEquatable<GoblinSharkColor>
|
||||||
{
|
{
|
||||||
Pink,
|
private readonly string? _value;
|
||||||
Gray,
|
|
||||||
Brown
|
public GoblinSharkColor(string value)
|
||||||
|
{
|
||||||
|
_value = value ?? throw new ArgumentNullException(nameof(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
private const string PinkValue = "pink";
|
||||||
|
private const string GrayValue = "gray";
|
||||||
|
private const string BrownValue = "brown";
|
||||||
|
|
||||||
|
public static GoblinSharkColor Pink { get; } = new GoblinSharkColor(PinkValue);
|
||||||
|
public static GoblinSharkColor Gray { get; } = new GoblinSharkColor(GrayValue);
|
||||||
|
public static GoblinSharkColor Brown { get; } = new GoblinSharkColor(BrownValue);
|
||||||
|
public static bool operator ==(GoblinSharkColor left, GoblinSharkColor right) => left.Equals(right);
|
||||||
|
public static bool operator !=(GoblinSharkColor left, GoblinSharkColor right) => !left.Equals(right);
|
||||||
|
public static implicit operator GoblinSharkColor(string value) => new GoblinSharkColor(value);
|
||||||
|
|
||||||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
|
public override bool Equals(object? obj) => obj is GoblinSharkColor other && Equals(other);
|
||||||
|
public bool Equals(GoblinSharkColor other) => string.Equals(_value, other._value, StringComparison.Ordinal);
|
||||||
|
|
||||||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
|
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
|
||||||
|
public override string? ToString() => _value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace body_complex.Models.V20160229
|
||||||
if (Color != null)
|
if (Color != null)
|
||||||
{
|
{
|
||||||
writer.WritePropertyName("color");
|
writer.WritePropertyName("color");
|
||||||
writer.WriteStringValue(Color.Value.ToSerialString());
|
writer.WriteStringValue(Color.ToString());
|
||||||
}
|
}
|
||||||
writer.WriteEndObject();
|
writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ namespace body_complex.Models.V20160229
|
||||||
}
|
}
|
||||||
if (property.NameEquals("color"))
|
if (property.NameEquals("color"))
|
||||||
{
|
{
|
||||||
result.Color = property.Value.GetString().ToGoblinSharkColor();
|
result.Color = new GoblinSharkColor(property.Value.GetString());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace body_string.Models.V100
|
||||||
|
{
|
||||||
|
internal static class ColorsExtensions
|
||||||
|
{
|
||||||
|
public static string ToSerialString(this Colors value) => value switch
|
||||||
|
{
|
||||||
|
Colors.RedColor => "red color",
|
||||||
|
Colors.GreenColor => "green-color",
|
||||||
|
Colors.BlueColor => "blue_color",
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown Colors value.")
|
||||||
|
};
|
||||||
|
|
||||||
|
public static Colors ToColors(this string value) => value switch
|
||||||
|
{
|
||||||
|
"red color" => Colors.RedColor,
|
||||||
|
"green-color" => Colors.GreenColor,
|
||||||
|
"blue_color" => Colors.BlueColor,
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown Colors value.")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,37 +1,12 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace body_string.Models.V100
|
namespace body_string.Models.V100
|
||||||
{
|
{
|
||||||
public readonly partial struct Colors : IEquatable<Colors>
|
public enum Colors
|
||||||
{
|
{
|
||||||
private readonly string? _value;
|
RedColor,
|
||||||
|
GreenColor,
|
||||||
public Colors(string value)
|
BlueColor
|
||||||
{
|
|
||||||
_value = value ?? throw new ArgumentNullException(nameof(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
private const string RedColorValue = "red color";
|
|
||||||
private const string GreenColorValue = "green-color";
|
|
||||||
private const string BlueColorValue = "blue_color";
|
|
||||||
|
|
||||||
public static Colors RedColor { get; } = new Colors(RedColorValue);
|
|
||||||
public static Colors GreenColor { get; } = new Colors(GreenColorValue);
|
|
||||||
public static Colors BlueColor { get; } = new Colors(BlueColorValue);
|
|
||||||
public static bool operator ==(Colors left, Colors right) => left.Equals(right);
|
|
||||||
public static bool operator !=(Colors left, Colors right) => !left.Equals(right);
|
|
||||||
public static implicit operator Colors(string value) => new Colors(value);
|
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
||||||
public override bool Equals(object? obj) => obj is Colors other && Equals(other);
|
|
||||||
public bool Equals(Colors other) => string.Equals(_value, other._value, StringComparison.Ordinal);
|
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
||||||
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
|
|
||||||
public override string? ToString() => _value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace body_string
|
||||||
switch (response.Status)
|
switch (response.Status)
|
||||||
{
|
{
|
||||||
case 200:
|
case 200:
|
||||||
return Response.FromValue(new Colors(document.RootElement.GetString()), response);
|
return Response.FromValue(document.RootElement.GetString().ToColors(), response);
|
||||||
default:
|
default:
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ namespace body_string
|
||||||
request.Headers.Add("Content-Type", "application/json");
|
request.Headers.Add("Content-Type", "application/json");
|
||||||
var buffer = new ArrayBufferWriter<byte>();
|
var buffer = new ArrayBufferWriter<byte>();
|
||||||
await using var writer = new Utf8JsonWriter(buffer);
|
await using var writer = new Utf8JsonWriter(buffer);
|
||||||
writer.WriteStringValue(stringBody.ToString());
|
writer.WriteStringValue(stringBody.ToSerialString());
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||||
|
@ -83,7 +83,7 @@ namespace body_string
|
||||||
switch (response.Status)
|
switch (response.Status)
|
||||||
{
|
{
|
||||||
case 200:
|
case 200:
|
||||||
return Response.FromValue(new Colors(document.RootElement.GetString()), response);
|
return Response.FromValue(document.RootElement.GetString().ToColors(), response);
|
||||||
default:
|
default:
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ namespace body_string
|
||||||
request.Headers.Add("Content-Type", "application/json");
|
request.Headers.Add("Content-Type", "application/json");
|
||||||
var buffer = new ArrayBufferWriter<byte>();
|
var buffer = new ArrayBufferWriter<byte>();
|
||||||
await using var writer = new Utf8JsonWriter(buffer);
|
await using var writer = new Utf8JsonWriter(buffer);
|
||||||
writer.WriteStringValue(enumStringBody.ToString());
|
writer.WriteStringValue(enumStringBody.ToSerialString());
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace header.Models.V100
|
||||||
|
{
|
||||||
|
internal static class GreyscaleColorsExtensions
|
||||||
|
{
|
||||||
|
public static string ToSerialString(this GreyscaleColors value) => value switch
|
||||||
|
{
|
||||||
|
GreyscaleColors.White => "White",
|
||||||
|
GreyscaleColors.Black => "black",
|
||||||
|
GreyscaleColors.GREY => "GREY",
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown GreyscaleColors value.")
|
||||||
|
};
|
||||||
|
|
||||||
|
public static GreyscaleColors ToGreyscaleColors(this string value) => value switch
|
||||||
|
{
|
||||||
|
"White" => GreyscaleColors.White,
|
||||||
|
"black" => GreyscaleColors.Black,
|
||||||
|
"GREY" => GreyscaleColors.GREY,
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown GreyscaleColors value.")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,37 +1,12 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace header.Models.V100
|
namespace header.Models.V100
|
||||||
{
|
{
|
||||||
public readonly partial struct GreyscaleColors : IEquatable<GreyscaleColors>
|
public enum GreyscaleColors
|
||||||
{
|
{
|
||||||
private readonly string? _value;
|
White,
|
||||||
|
Black,
|
||||||
public GreyscaleColors(string value)
|
GREY
|
||||||
{
|
|
||||||
_value = value ?? throw new ArgumentNullException(nameof(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
private const string WhiteValue = "White";
|
|
||||||
private const string BlackValue = "black";
|
|
||||||
private const string GREYValue = "GREY";
|
|
||||||
|
|
||||||
public static GreyscaleColors White { get; } = new GreyscaleColors(WhiteValue);
|
|
||||||
public static GreyscaleColors Black { get; } = new GreyscaleColors(BlackValue);
|
|
||||||
public static GreyscaleColors GREY { get; } = new GreyscaleColors(GREYValue);
|
|
||||||
public static bool operator ==(GreyscaleColors left, GreyscaleColors right) => left.Equals(right);
|
|
||||||
public static bool operator !=(GreyscaleColors left, GreyscaleColors right) => !left.Equals(right);
|
|
||||||
public static implicit operator GreyscaleColors(string value) => new GreyscaleColors(value);
|
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
||||||
public override bool Equals(object? obj) => obj is GreyscaleColors other && Equals(other);
|
|
||||||
public bool Equals(GreyscaleColors other) => string.Equals(_value, other._value, StringComparison.Ordinal);
|
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
||||||
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
|
|
||||||
public override string? ToString() => _value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace url.Models.V100
|
||||||
|
{
|
||||||
|
internal static class UriColorExtensions
|
||||||
|
{
|
||||||
|
public static string ToSerialString(this UriColor value) => value switch
|
||||||
|
{
|
||||||
|
UriColor.RedColor => "red color",
|
||||||
|
UriColor.GreenColor => "green color",
|
||||||
|
UriColor.BlueColor => "blue color",
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown UriColor value.")
|
||||||
|
};
|
||||||
|
|
||||||
|
public static UriColor ToUriColor(this string value) => value switch
|
||||||
|
{
|
||||||
|
"red color" => UriColor.RedColor,
|
||||||
|
"green color" => UriColor.GreenColor,
|
||||||
|
"blue color" => UriColor.BlueColor,
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown UriColor value.")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,37 +1,12 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace url.Models.V100
|
namespace url.Models.V100
|
||||||
{
|
{
|
||||||
public readonly partial struct UriColor : IEquatable<UriColor>
|
public enum UriColor
|
||||||
{
|
{
|
||||||
private readonly string? _value;
|
RedColor,
|
||||||
|
GreenColor,
|
||||||
public UriColor(string value)
|
BlueColor
|
||||||
{
|
|
||||||
_value = value ?? throw new ArgumentNullException(nameof(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
private const string RedColorValue = "red color";
|
|
||||||
private const string GreenColorValue = "green color";
|
|
||||||
private const string BlueColorValue = "blue color";
|
|
||||||
|
|
||||||
public static UriColor RedColor { get; } = new UriColor(RedColorValue);
|
|
||||||
public static UriColor GreenColor { get; } = new UriColor(GreenColorValue);
|
|
||||||
public static UriColor BlueColor { get; } = new UriColor(BlueColorValue);
|
|
||||||
public static bool operator ==(UriColor left, UriColor right) => left.Equals(right);
|
|
||||||
public static bool operator !=(UriColor left, UriColor right) => !left.Equals(right);
|
|
||||||
public static implicit operator UriColor(string value) => new UriColor(value);
|
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
||||||
public override bool Equals(object? obj) => obj is UriColor other && Equals(other);
|
|
||||||
public bool Equals(UriColor other) => string.Equals(_value, other._value, StringComparison.Ordinal);
|
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
||||||
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
|
|
||||||
public override string? ToString() => _value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace url
|
||||||
{
|
{
|
||||||
internal static class PathItemsOperations
|
internal static class PathItemsOperations
|
||||||
{
|
{
|
||||||
public static async ValueTask<Response> GetAllWithValuesAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string pathItemStringPath, string? pathItemStringQuery, string localStringPath, string? localStringQuery, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
public static async ValueTask<Response> GetAllWithValuesAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string pathItemStringPath, string? pathItemStringQuery, string globalStringPath, string? globalStringQuery, string localStringPath, string? localStringQuery, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
using var scope = clientDiagnostics.CreateScope("url.GetAllWithValues");
|
using var scope = clientDiagnostics.CreateScope("url.GetAllWithValues");
|
||||||
scope.Start();
|
scope.Start();
|
||||||
|
@ -22,7 +22,7 @@ namespace url
|
||||||
request.Method = RequestMethod.Get;
|
request.Method = RequestMethod.Get;
|
||||||
request.Uri.Reset(new Uri($"{host}"));
|
request.Uri.Reset(new Uri($"{host}"));
|
||||||
request.Uri.AppendPath("/pathitem/nullable/globalStringPath/", false);
|
request.Uri.AppendPath("/pathitem/nullable/globalStringPath/", false);
|
||||||
request.Uri.AppendPath("globalStringPath", false);
|
request.Uri.AppendPath(globalStringPath, true);
|
||||||
request.Uri.AppendPath("/pathItemStringPath/", false);
|
request.Uri.AppendPath("/pathItemStringPath/", false);
|
||||||
request.Uri.AppendPath(pathItemStringPath, true);
|
request.Uri.AppendPath(pathItemStringPath, true);
|
||||||
request.Uri.AppendPath("/localStringPath/", false);
|
request.Uri.AppendPath("/localStringPath/", false);
|
||||||
|
@ -32,6 +32,10 @@ namespace url
|
||||||
{
|
{
|
||||||
request.Uri.AppendQuery("pathItemStringQuery", pathItemStringQuery, true);
|
request.Uri.AppendQuery("pathItemStringQuery", pathItemStringQuery, true);
|
||||||
}
|
}
|
||||||
|
if (globalStringQuery != null)
|
||||||
|
{
|
||||||
|
request.Uri.AppendQuery("globalStringQuery", globalStringQuery, true);
|
||||||
|
}
|
||||||
if (localStringQuery != null)
|
if (localStringQuery != null)
|
||||||
{
|
{
|
||||||
request.Uri.AppendQuery("localStringQuery", localStringQuery, true);
|
request.Uri.AppendQuery("localStringQuery", localStringQuery, true);
|
||||||
|
@ -46,7 +50,7 @@ namespace url
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static async ValueTask<Response> GetGlobalQueryNullAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string pathItemStringPath, string? pathItemStringQuery, string localStringPath, string? localStringQuery, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
public static async ValueTask<Response> GetGlobalQueryNullAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string pathItemStringPath, string? pathItemStringQuery, string globalStringPath, string? globalStringQuery, string localStringPath, string? localStringQuery, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
using var scope = clientDiagnostics.CreateScope("url.GetGlobalQueryNull");
|
using var scope = clientDiagnostics.CreateScope("url.GetGlobalQueryNull");
|
||||||
scope.Start();
|
scope.Start();
|
||||||
|
@ -56,7 +60,7 @@ namespace url
|
||||||
request.Method = RequestMethod.Get;
|
request.Method = RequestMethod.Get;
|
||||||
request.Uri.Reset(new Uri($"{host}"));
|
request.Uri.Reset(new Uri($"{host}"));
|
||||||
request.Uri.AppendPath("/pathitem/nullable/globalStringPath/", false);
|
request.Uri.AppendPath("/pathitem/nullable/globalStringPath/", false);
|
||||||
request.Uri.AppendPath("globalStringPath", false);
|
request.Uri.AppendPath(globalStringPath, true);
|
||||||
request.Uri.AppendPath("/pathItemStringPath/", false);
|
request.Uri.AppendPath("/pathItemStringPath/", false);
|
||||||
request.Uri.AppendPath(pathItemStringPath, true);
|
request.Uri.AppendPath(pathItemStringPath, true);
|
||||||
request.Uri.AppendPath("/localStringPath/", false);
|
request.Uri.AppendPath("/localStringPath/", false);
|
||||||
|
@ -66,6 +70,10 @@ namespace url
|
||||||
{
|
{
|
||||||
request.Uri.AppendQuery("pathItemStringQuery", pathItemStringQuery, true);
|
request.Uri.AppendQuery("pathItemStringQuery", pathItemStringQuery, true);
|
||||||
}
|
}
|
||||||
|
if (globalStringQuery != null)
|
||||||
|
{
|
||||||
|
request.Uri.AppendQuery("globalStringQuery", globalStringQuery, true);
|
||||||
|
}
|
||||||
if (localStringQuery != null)
|
if (localStringQuery != null)
|
||||||
{
|
{
|
||||||
request.Uri.AppendQuery("localStringQuery", localStringQuery, true);
|
request.Uri.AppendQuery("localStringQuery", localStringQuery, true);
|
||||||
|
@ -80,7 +88,7 @@ namespace url
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static async ValueTask<Response> GetGlobalAndLocalQueryNullAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string pathItemStringPath, string? pathItemStringQuery, string localStringPath, string? localStringQuery, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
public static async ValueTask<Response> GetGlobalAndLocalQueryNullAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string pathItemStringPath, string? pathItemStringQuery, string globalStringPath, string? globalStringQuery, string localStringPath, string? localStringQuery, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
using var scope = clientDiagnostics.CreateScope("url.GetGlobalAndLocalQueryNull");
|
using var scope = clientDiagnostics.CreateScope("url.GetGlobalAndLocalQueryNull");
|
||||||
scope.Start();
|
scope.Start();
|
||||||
|
@ -90,7 +98,7 @@ namespace url
|
||||||
request.Method = RequestMethod.Get;
|
request.Method = RequestMethod.Get;
|
||||||
request.Uri.Reset(new Uri($"{host}"));
|
request.Uri.Reset(new Uri($"{host}"));
|
||||||
request.Uri.AppendPath("/pathitem/nullable/globalStringPath/", false);
|
request.Uri.AppendPath("/pathitem/nullable/globalStringPath/", false);
|
||||||
request.Uri.AppendPath("globalStringPath", false);
|
request.Uri.AppendPath(globalStringPath, true);
|
||||||
request.Uri.AppendPath("/pathItemStringPath/", false);
|
request.Uri.AppendPath("/pathItemStringPath/", false);
|
||||||
request.Uri.AppendPath(pathItemStringPath, true);
|
request.Uri.AppendPath(pathItemStringPath, true);
|
||||||
request.Uri.AppendPath("/localStringPath/", false);
|
request.Uri.AppendPath("/localStringPath/", false);
|
||||||
|
@ -100,6 +108,10 @@ namespace url
|
||||||
{
|
{
|
||||||
request.Uri.AppendQuery("pathItemStringQuery", pathItemStringQuery, true);
|
request.Uri.AppendQuery("pathItemStringQuery", pathItemStringQuery, true);
|
||||||
}
|
}
|
||||||
|
if (globalStringQuery != null)
|
||||||
|
{
|
||||||
|
request.Uri.AppendQuery("globalStringQuery", globalStringQuery, true);
|
||||||
|
}
|
||||||
if (localStringQuery != null)
|
if (localStringQuery != null)
|
||||||
{
|
{
|
||||||
request.Uri.AppendQuery("localStringQuery", localStringQuery, true);
|
request.Uri.AppendQuery("localStringQuery", localStringQuery, true);
|
||||||
|
@ -114,7 +126,7 @@ namespace url
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static async ValueTask<Response> GetLocalPathItemQueryNullAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string pathItemStringPath, string? pathItemStringQuery, string localStringPath, string? localStringQuery, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
public static async ValueTask<Response> GetLocalPathItemQueryNullAsync(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string pathItemStringPath, string? pathItemStringQuery, string globalStringPath, string? globalStringQuery, string localStringPath, string? localStringQuery, string host = "http://localhost:3000", CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
using var scope = clientDiagnostics.CreateScope("url.GetLocalPathItemQueryNull");
|
using var scope = clientDiagnostics.CreateScope("url.GetLocalPathItemQueryNull");
|
||||||
scope.Start();
|
scope.Start();
|
||||||
|
@ -124,7 +136,7 @@ namespace url
|
||||||
request.Method = RequestMethod.Get;
|
request.Method = RequestMethod.Get;
|
||||||
request.Uri.Reset(new Uri($"{host}"));
|
request.Uri.Reset(new Uri($"{host}"));
|
||||||
request.Uri.AppendPath("/pathitem/nullable/globalStringPath/", false);
|
request.Uri.AppendPath("/pathitem/nullable/globalStringPath/", false);
|
||||||
request.Uri.AppendPath("globalStringPath", false);
|
request.Uri.AppendPath(globalStringPath, true);
|
||||||
request.Uri.AppendPath("/pathItemStringPath/", false);
|
request.Uri.AppendPath("/pathItemStringPath/", false);
|
||||||
request.Uri.AppendPath(pathItemStringPath, true);
|
request.Uri.AppendPath(pathItemStringPath, true);
|
||||||
request.Uri.AppendPath("/localStringPath/", false);
|
request.Uri.AppendPath("/localStringPath/", false);
|
||||||
|
@ -134,6 +146,10 @@ namespace url
|
||||||
{
|
{
|
||||||
request.Uri.AppendQuery("pathItemStringQuery", pathItemStringQuery, true);
|
request.Uri.AppendQuery("pathItemStringQuery", pathItemStringQuery, true);
|
||||||
}
|
}
|
||||||
|
if (globalStringQuery != null)
|
||||||
|
{
|
||||||
|
request.Uri.AppendQuery("globalStringQuery", globalStringQuery, true);
|
||||||
|
}
|
||||||
if (localStringQuery != null)
|
if (localStringQuery != null)
|
||||||
{
|
{
|
||||||
request.Uri.AppendQuery("localStringQuery", localStringQuery, true);
|
request.Uri.AppendQuery("localStringQuery", localStringQuery, true);
|
||||||
|
|
|
@ -381,7 +381,7 @@ namespace url
|
||||||
request.Method = RequestMethod.Get;
|
request.Method = RequestMethod.Get;
|
||||||
request.Uri.Reset(new Uri($"{host}"));
|
request.Uri.Reset(new Uri($"{host}"));
|
||||||
request.Uri.AppendPath("/paths/byte/empty/", false);
|
request.Uri.AppendPath("/paths/byte/empty/", false);
|
||||||
request.Uri.AppendPath("", true);
|
request.Uri.AppendPath(new byte[] { }, true);
|
||||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return response;
|
return response;
|
||||||
|
@ -423,7 +423,7 @@ namespace url
|
||||||
request.Method = RequestMethod.Get;
|
request.Method = RequestMethod.Get;
|
||||||
request.Uri.Reset(new Uri($"{host}"));
|
request.Uri.Reset(new Uri($"{host}"));
|
||||||
request.Uri.AppendPath("/paths/date/2012-01-01/", false);
|
request.Uri.AppendPath("/paths/date/2012-01-01/", false);
|
||||||
request.Uri.AppendPath("2012-01-01", true);
|
request.Uri.AppendPath(new DateTime(2012, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "D", true);
|
||||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return response;
|
return response;
|
||||||
|
@ -465,7 +465,7 @@ namespace url
|
||||||
request.Method = RequestMethod.Get;
|
request.Method = RequestMethod.Get;
|
||||||
request.Uri.Reset(new Uri($"{host}"));
|
request.Uri.Reset(new Uri($"{host}"));
|
||||||
request.Uri.AppendPath("/paths/datetime/2012-01-01T01%3A01%3A01Z/", false);
|
request.Uri.AppendPath("/paths/datetime/2012-01-01T01%3A01%3A01Z/", false);
|
||||||
request.Uri.AppendPath("2012-01-01T01:01:01Z", true);
|
request.Uri.AppendPath(new DateTime(2012, 1, 1, 1, 1, 1, 0, DateTimeKind.Utc), "S", true);
|
||||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -513,7 +513,7 @@ namespace url
|
||||||
request.Method = RequestMethod.Get;
|
request.Method = RequestMethod.Get;
|
||||||
request.Uri.Reset(new Uri($"{host}"));
|
request.Uri.Reset(new Uri($"{host}"));
|
||||||
request.Uri.AppendPath("/queries/byte/empty", false);
|
request.Uri.AppendPath("/queries/byte/empty", false);
|
||||||
request.Uri.AppendQuery("byteQuery", "", true);
|
request.Uri.AppendQuery("byteQuery", new byte[] { }, true);
|
||||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return response;
|
return response;
|
||||||
|
@ -558,7 +558,7 @@ namespace url
|
||||||
request.Method = RequestMethod.Get;
|
request.Method = RequestMethod.Get;
|
||||||
request.Uri.Reset(new Uri($"{host}"));
|
request.Uri.Reset(new Uri($"{host}"));
|
||||||
request.Uri.AppendPath("/queries/date/2012-01-01", false);
|
request.Uri.AppendPath("/queries/date/2012-01-01", false);
|
||||||
request.Uri.AppendQuery("dateQuery", "2012-01-01", true);
|
request.Uri.AppendQuery("dateQuery", new DateTime(2012, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "D", true);
|
||||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return response;
|
return response;
|
||||||
|
@ -581,7 +581,7 @@ namespace url
|
||||||
request.Uri.AppendPath("/queries/date/null", false);
|
request.Uri.AppendPath("/queries/date/null", false);
|
||||||
if (dateQuery != null)
|
if (dateQuery != null)
|
||||||
{
|
{
|
||||||
request.Uri.AppendQuery("dateQuery", dateQuery.Value, true);
|
request.Uri.AppendQuery("dateQuery", dateQuery.Value, "D", true);
|
||||||
}
|
}
|
||||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
@ -603,7 +603,7 @@ namespace url
|
||||||
request.Method = RequestMethod.Get;
|
request.Method = RequestMethod.Get;
|
||||||
request.Uri.Reset(new Uri($"{host}"));
|
request.Uri.Reset(new Uri($"{host}"));
|
||||||
request.Uri.AppendPath("/queries/datetime/2012-01-01T01%3A01%3A01Z", false);
|
request.Uri.AppendPath("/queries/datetime/2012-01-01T01%3A01%3A01Z", false);
|
||||||
request.Uri.AppendQuery("dateTimeQuery", "2012-01-01T01:01:01Z", true);
|
request.Uri.AppendQuery("dateTimeQuery", new DateTime(2012, 1, 1, 1, 1, 1, 0, DateTimeKind.Utc), "S", true);
|
||||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
return response;
|
return response;
|
||||||
|
@ -626,7 +626,7 @@ namespace url
|
||||||
request.Uri.AppendPath("/queries/datetime/null", false);
|
request.Uri.AppendPath("/queries/datetime/null", false);
|
||||||
if (dateTimeQuery != null)
|
if (dateTimeQuery != null)
|
||||||
{
|
{
|
||||||
request.Uri.AppendQuery("dateTimeQuery", dateTimeQuery.Value, true);
|
request.Uri.AppendQuery("dateTimeQuery", dateTimeQuery.Value, "S", true);
|
||||||
}
|
}
|
||||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче