Removed example test projects.
This commit is contained in:
Родитель
52a6d97538
Коммит
423aaff70a
|
@ -1,39 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<AssemblyName>BodyComplex</AssemblyName>
|
||||
<RootNamespace>BodyComplex</RootNamespace>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<PublishDir>$(OutputPath)</PublishDir>
|
||||
<!-- Some methods are marked async and don't have an await in them -->
|
||||
<NoWarn>1998</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors />
|
||||
<Nullable>enable</Nullable>
|
||||
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
|
||||
<RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DelaySign>false</DelaySign>
|
||||
<DefineConstants>TRACE;DEBUG;NETSTANDARD</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<DelaySign>true</DelaySign>
|
||||
<AssemblyOriginatorKeyFile>MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
|
||||
<DefineConstants>TRACE;RELEASE;NETSTANDARD;SIGN</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Azure.Core" Version="1.0.0" />
|
||||
<PackageReference Include="Azure.Identity" Version="1.0.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29230.61
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BodyComplex", "BodyComplex.csproj", "{9D45DE3E-1AA8-45A3-9652-99D096A0D483}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tester", "..\Tester\Tester.csproj", "{0180FC3B-1832-4683-910A-8A77F9C4FC6E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9D45DE3E-1AA8-45A3-9652-99D096A0D483}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9D45DE3E-1AA8-45A3-9652-99D096A0D483}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9D45DE3E-1AA8-45A3-9652-99D096A0D483}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9D45DE3E-1AA8-45A3-9652-99D096A0D483}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0180FC3B-1832-4683-910A-8A77F9C4FC6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0180FC3B-1832-4683-910A-8A77F9C4FC6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0180FC3B-1832-4683-910A-8A77F9C4FC6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0180FC3B-1832-4683-910A-8A77F9C4FC6E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {943E4AF3-24DB-4213-872E-E061096F7F29}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,190 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Azure.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a heap-based, array-backed output sink into which <typeparam name="T"/> data can be written.
|
||||
/// </summary>
|
||||
internal sealed class ArrayBufferWriter<T> : IBufferWriter<T>
|
||||
{
|
||||
private T[] _buffer;
|
||||
private const int DefaultInitialBufferSize = 256;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of an <see cref="ArrayBufferWriter{T}"/>, in which data can be written to,
|
||||
/// with the default initial capacity.
|
||||
/// </summary>
|
||||
public ArrayBufferWriter()
|
||||
{
|
||||
_buffer = Array.Empty<T>();
|
||||
WrittenCount = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of an <see cref="ArrayBufferWriter{T}"/>, in which data can be written to,
|
||||
/// with an initial capacity specified.
|
||||
/// </summary>
|
||||
/// <param name="initialCapacity">The minimum capacity with which to initialize the underlying buffer.</param>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="initialCapacity"/> is not positive (i.e. less than or equal to 0).
|
||||
/// </exception>
|
||||
public ArrayBufferWriter(int initialCapacity)
|
||||
{
|
||||
if (initialCapacity <= 0)
|
||||
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
|
||||
throw new ArgumentException(nameof(initialCapacity));
|
||||
#pragma warning restore CA2208 // Instantiate argument exceptions correctly
|
||||
|
||||
_buffer = new T[initialCapacity];
|
||||
WrittenCount = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the data written to the underlying buffer so far, as a <see cref="ReadOnlyMemory{T}"/>.
|
||||
/// </summary>
|
||||
public ReadOnlyMemory<T> WrittenMemory => _buffer.AsMemory(0, WrittenCount);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the data written to the underlying buffer so far, as a <see cref="ReadOnlySpan{T}"/>.
|
||||
/// </summary>
|
||||
public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, WrittenCount);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the amount of data written to the underlying buffer so far.
|
||||
/// </summary>
|
||||
public int WrittenCount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the total amount of space within the underlying buffer.
|
||||
/// </summary>
|
||||
public int Capacity => _buffer.Length;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the amount of space available that can still be written into without forcing the underlying buffer to grow.
|
||||
/// </summary>
|
||||
public int FreeCapacity => _buffer.Length - WrittenCount;
|
||||
|
||||
/// <summary>
|
||||
/// Clears the data written to the underlying buffer.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// You must clear the <see cref="ArrayBufferWriter{T}"/> before trying to re-use it.
|
||||
/// </remarks>
|
||||
public void Clear()
|
||||
{
|
||||
Debug.Assert(_buffer.Length >= WrittenCount);
|
||||
_buffer.AsSpan(0, WrittenCount).Clear();
|
||||
WrittenCount = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notifies <see cref="IBufferWriter{T}"/> that <paramref name="count"/> amount of data was written to the output <see cref="Span{T}"/>/<see cref="Memory{T}"/>
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="count"/> is negative.
|
||||
/// </exception>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown when attempting to advance past the end of the underlying buffer.
|
||||
/// </exception>
|
||||
/// <remarks>
|
||||
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
|
||||
/// </remarks>
|
||||
public void Advance(int count)
|
||||
{
|
||||
if (count < 0)
|
||||
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
|
||||
throw new ArgumentException(nameof(count));
|
||||
#pragma warning restore CA2208 // Instantiate argument exceptions correctly
|
||||
|
||||
if (WrittenCount > _buffer.Length - count)
|
||||
ThrowInvalidOperationException_AdvancedTooFar(_buffer.Length);
|
||||
|
||||
WrittenCount += count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="Memory{T}"/> to write to that is at least the requested length (specified by <paramref name="sizeHint"/>).
|
||||
/// If no <paramref name="sizeHint"/> is provided (or it's equal to <code>0</code>), some non-empty buffer is returned.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="sizeHint"/> is negative.
|
||||
/// </exception>
|
||||
/// <remarks>
|
||||
/// This will never return an empty <see cref="Memory{T}"/>.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
|
||||
/// </remarks>
|
||||
public Memory<T> GetMemory(int sizeHint = 0)
|
||||
{
|
||||
CheckAndResizeBuffer(sizeHint);
|
||||
Debug.Assert(_buffer.Length > WrittenCount);
|
||||
return _buffer.AsMemory(WrittenCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="Span{T}"/> to write to that is at least the requested length (specified by <paramref name="sizeHint"/>).
|
||||
/// If no <paramref name="sizeHint"/> is provided (or it's equal to <code>0</code>), some non-empty buffer is returned.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="sizeHint"/> is negative.
|
||||
/// </exception>
|
||||
/// <remarks>
|
||||
/// This will never return an empty <see cref="Span{T}"/>.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
|
||||
/// </remarks>
|
||||
public Span<T> GetSpan(int sizeHint = 0)
|
||||
{
|
||||
CheckAndResizeBuffer(sizeHint);
|
||||
Debug.Assert(_buffer.Length > WrittenCount);
|
||||
return _buffer.AsSpan(WrittenCount);
|
||||
}
|
||||
|
||||
private void CheckAndResizeBuffer(int sizeHint)
|
||||
{
|
||||
if (sizeHint < 0)
|
||||
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
|
||||
throw new ArgumentException(nameof(sizeHint));
|
||||
#pragma warning restore CA2208 // Instantiate argument exceptions correctly
|
||||
|
||||
if (sizeHint == 0)
|
||||
{
|
||||
sizeHint = 1;
|
||||
}
|
||||
|
||||
if (sizeHint > FreeCapacity)
|
||||
{
|
||||
int growBy = Math.Max(sizeHint, _buffer.Length);
|
||||
|
||||
if (_buffer.Length == 0)
|
||||
{
|
||||
growBy = Math.Max(growBy, DefaultInitialBufferSize);
|
||||
}
|
||||
|
||||
int newSize = checked(_buffer.Length + growBy);
|
||||
|
||||
Array.Resize(ref _buffer, newSize);
|
||||
}
|
||||
|
||||
Debug.Assert(FreeCapacity > 0 && FreeCapacity >= sizeHint);
|
||||
}
|
||||
|
||||
private static void ThrowInvalidOperationException_AdvancedTooFar(int capacity)
|
||||
{
|
||||
throw new InvalidOperationException($"Advanced past capacity of {capacity}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Azure.Core.Pipeline
|
||||
{
|
||||
internal readonly struct DiagnosticScope : IDisposable
|
||||
{
|
||||
private readonly DiagnosticActivity? _activity;
|
||||
|
||||
private readonly string _name;
|
||||
|
||||
private readonly DiagnosticListener _source;
|
||||
|
||||
internal DiagnosticScope(string name, DiagnosticListener source)
|
||||
{
|
||||
_name = name;
|
||||
_source = source;
|
||||
_activity = _source.IsEnabled(_name) ? new DiagnosticActivity(_name) : null;
|
||||
_activity?.SetW3CFormat();
|
||||
}
|
||||
|
||||
public bool IsEnabled => _activity != null;
|
||||
|
||||
public void AddAttribute(string name, string value)
|
||||
{
|
||||
_activity?.AddTag(name, value);
|
||||
}
|
||||
|
||||
public void AddAttribute<T>(string name, T value)
|
||||
{
|
||||
if (_activity != null && value != null)
|
||||
{
|
||||
AddAttribute(name, value.ToString()!);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddAttribute<T>(string name, T value, Func<T, string> format)
|
||||
{
|
||||
if (_activity != null)
|
||||
{
|
||||
AddAttribute(name, format(value));
|
||||
}
|
||||
}
|
||||
|
||||
public void AddLink(string id)
|
||||
{
|
||||
if (_activity != null)
|
||||
{
|
||||
var linkedActivity = new Activity("LinkedActivity");
|
||||
linkedActivity.SetW3CFormat();
|
||||
linkedActivity.SetParentId(id);
|
||||
|
||||
_activity.AddLink(linkedActivity);
|
||||
}
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (_activity != null)
|
||||
{
|
||||
_source.StartActivity(_activity, _activity);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_activity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_source != null)
|
||||
{
|
||||
_source.StopActivity(_activity, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
_activity?.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void Failed(Exception e)
|
||||
{
|
||||
if (_activity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_source?.Write(_activity.OperationName + ".Exception", e);
|
||||
|
||||
}
|
||||
|
||||
private class DiagnosticActivity : Activity
|
||||
{
|
||||
private List<Activity>? _links;
|
||||
|
||||
public IEnumerable<Activity> Links => (IEnumerable<Activity>?)_links ?? Array.Empty<Activity>();
|
||||
|
||||
public DiagnosticActivity(string operationName) : base(operationName)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddLink(Activity activity)
|
||||
{
|
||||
_links ??= new List<Activity>();
|
||||
_links.Add(activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HACK HACK HACK. Some runtime environments like Azure.Functions downgrade System.Diagnostic.DiagnosticSource package version causing method not found exceptions in customer apps
|
||||
/// This type is a temporary workaround to avoid the issue.
|
||||
/// </summary>
|
||||
internal static class ActivityExtensions
|
||||
{
|
||||
private static readonly MethodInfo? s_setIdFormatMethod = typeof(Activity).GetMethod("SetIdFormat");
|
||||
private static readonly MethodInfo? s_getIdFormatMethod = typeof(Activity).GetProperty("IdFormat")?.GetMethod;
|
||||
private static readonly MethodInfo? s_getTraceStateStringMethod = typeof(Activity).GetProperty("TraceStateString")?.GetMethod;
|
||||
|
||||
public static bool SetW3CFormat(this Activity activity)
|
||||
{
|
||||
if (s_setIdFormatMethod == null) return false;
|
||||
|
||||
s_setIdFormatMethod.Invoke(activity, new object[]{ 2 /* ActivityIdFormat.W3C */});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsW3CFormat(this Activity activity)
|
||||
{
|
||||
if (s_getIdFormatMethod == null) return false;
|
||||
|
||||
object? result = s_getIdFormatMethod.Invoke(activity, Array.Empty<object>());
|
||||
|
||||
return result is int resultInt && resultInt == 2 /* ActivityIdFormat.W3C */;
|
||||
}
|
||||
|
||||
public static bool TryGetTraceState(this Activity activity, out string? traceState)
|
||||
{
|
||||
traceState = null;
|
||||
|
||||
if (s_getTraceStateStringMethod == null) return false;
|
||||
|
||||
traceState = s_getTraceStateStringMethod.Invoke(activity, Array.Empty<object>()) as string;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class ArrayWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("array-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (_array != null)
|
||||
{
|
||||
writer.WriteStartArray("array");
|
||||
foreach (var item in _array)
|
||||
{
|
||||
writer.WriteStringValue(item);
|
||||
}
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static ArrayWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new ArrayWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("array"))
|
||||
{
|
||||
foreach (var item in property.Value.EnumerateArray())
|
||||
{
|
||||
result.Array.Add(item.GetString());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class ArrayWrapper
|
||||
{
|
||||
private List<string>? _array;
|
||||
|
||||
public ICollection<string> Array => LazyInitializer.EnsureInitialized(ref _array);
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Basic
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("basic");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Id != null)
|
||||
{
|
||||
writer.WriteNumber("id", Id.Value);
|
||||
}
|
||||
if (Name != null)
|
||||
{
|
||||
writer.WriteString("name", Name);
|
||||
}
|
||||
if (Color != null)
|
||||
{
|
||||
// SealedChoiceSchema Color: Not Implemented
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Basic Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Basic();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("id"))
|
||||
{
|
||||
result.Id = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("name"))
|
||||
{
|
||||
result.Name = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("color"))
|
||||
{
|
||||
// SealedChoiceSchema Color: Not Implemented
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Basic
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public CMYKColors? Color { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class BooleanWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("boolean-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (FieldTrue != null)
|
||||
{
|
||||
writer.WriteBoolean("field_true", FieldTrue.Value);
|
||||
}
|
||||
if (FieldFalse != null)
|
||||
{
|
||||
writer.WriteBoolean("field_false", FieldFalse.Value);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static BooleanWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new BooleanWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("field_true"))
|
||||
{
|
||||
result.FieldTrue = property.Value.GetBoolean();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("field_false"))
|
||||
{
|
||||
result.FieldFalse = property.Value.GetBoolean();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class BooleanWrapper
|
||||
{
|
||||
public bool? FieldTrue { get; set; }
|
||||
public bool? FieldFalse { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class ByteWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("byte-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Field != null)
|
||||
{
|
||||
// ByteArraySchema Field: Not Implemented
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static ByteWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new ByteWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("field"))
|
||||
{
|
||||
// ByteArraySchema Field: Not Implemented
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class ByteWrapper
|
||||
{
|
||||
public byte[]? Field { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
|
||||
namespace BodyComplex.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 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public enum CMYKColors
|
||||
{
|
||||
Cyan,
|
||||
Magenta,
|
||||
YELLOW,
|
||||
BlacK
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Cat
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("cat");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Color != null)
|
||||
{
|
||||
writer.WriteString("color", Color);
|
||||
}
|
||||
if (_hates != null)
|
||||
{
|
||||
writer.WriteStartArray("hates");
|
||||
foreach (var item in _hates)
|
||||
{
|
||||
item?.Serialize(writer);
|
||||
}
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Cat Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Cat();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("color"))
|
||||
{
|
||||
result.Color = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("hates"))
|
||||
{
|
||||
foreach (var item in property.Value.EnumerateArray())
|
||||
{
|
||||
result.Hates.Add(BodyComplex.Models.V20160229.Dog.Deserialize(item));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Cat
|
||||
{
|
||||
private List<Dog>? _hates;
|
||||
|
||||
public string? Color { get; set; }
|
||||
public ICollection<Dog> Hates => LazyInitializer.EnsureInitialized(ref _hates);
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class ComponentsSchemasSmartSalmonAdditionalproperties
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("components·schemas·smart_salmon·additionalproperties");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static ComponentsSchemasSmartSalmonAdditionalproperties Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new ComponentsSchemasSmartSalmonAdditionalproperties();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class ComponentsSchemasSmartSalmonAdditionalproperties
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Cookiecuttershark
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("cookiecuttershark");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Cookiecuttershark Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Cookiecuttershark();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Cookiecuttershark
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DateWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("date-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Field != null)
|
||||
{
|
||||
writer.WriteString("field", Field.ToString());
|
||||
}
|
||||
if (Leap != null)
|
||||
{
|
||||
writer.WriteString("leap", Leap.ToString());
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static DateWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new DateWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("field"))
|
||||
{
|
||||
result.Field = property.Value.GetDateTime();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("leap"))
|
||||
{
|
||||
result.Leap = property.Value.GetDateTime();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DateWrapper
|
||||
{
|
||||
public DateTime? Field { get; set; }
|
||||
public DateTime? Leap { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DatetimeWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("datetime-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Field != null)
|
||||
{
|
||||
writer.WriteString("field", Field.ToString());
|
||||
}
|
||||
if (Now != null)
|
||||
{
|
||||
writer.WriteString("now", Now.ToString());
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static DatetimeWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new DatetimeWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("field"))
|
||||
{
|
||||
result.Field = property.Value.GetDateTime();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("now"))
|
||||
{
|
||||
result.Now = property.Value.GetDateTime();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DatetimeWrapper
|
||||
{
|
||||
public DateTime? Field { get; set; }
|
||||
public DateTime? Now { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Datetimerfc1123Wrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("datetimerfc1123-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Field != null)
|
||||
{
|
||||
writer.WriteString("field", Field.ToString());
|
||||
}
|
||||
if (Now != null)
|
||||
{
|
||||
writer.WriteString("now", Now.ToString());
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Datetimerfc1123Wrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Datetimerfc1123Wrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("field"))
|
||||
{
|
||||
result.Field = property.Value.GetDateTime();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("now"))
|
||||
{
|
||||
result.Now = property.Value.GetDateTime();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Datetimerfc1123Wrapper
|
||||
{
|
||||
public DateTime? Field { get; set; }
|
||||
public DateTime? Now { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DictionaryWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("dictionary-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (_defaultProgram != null)
|
||||
{
|
||||
writer.WriteStartObject("defaultProgram");
|
||||
foreach (var item in _defaultProgram)
|
||||
{
|
||||
writer.WriteString(item.Key, item.Value);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static DictionaryWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new DictionaryWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("defaultProgram"))
|
||||
{
|
||||
foreach (var item in property.Value.EnumerateObject())
|
||||
{
|
||||
result.DefaultProgram.Add(item.Name, item.Value.GetString());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DictionaryWrapper
|
||||
{
|
||||
private Dictionary<string, string>? _defaultProgram;
|
||||
|
||||
public IDictionary<string, string> DefaultProgram => LazyInitializer.EnsureInitialized(ref _defaultProgram);
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DictionaryWrapperDefaultProgram
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("dictionary-wrapper-defaultProgram");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static DictionaryWrapperDefaultProgram Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new DictionaryWrapperDefaultProgram();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DictionaryWrapperDefaultProgram
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Dog
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("dog");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Food != null)
|
||||
{
|
||||
writer.WriteString("food", Food);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Dog Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Dog();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("food"))
|
||||
{
|
||||
result.Food = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Dog
|
||||
{
|
||||
public string? Food { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DotFish
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("DotFish");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
writer.WriteString("fish.type", FishType);
|
||||
if (Species != null)
|
||||
{
|
||||
writer.WriteString("species", Species);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static DotFish Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new DotFish();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("fish.type"))
|
||||
{
|
||||
result.FishType = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("species"))
|
||||
{
|
||||
result.Species = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DotFish
|
||||
{
|
||||
public string FishType { get; private set; }
|
||||
public string? Species { get; set; }
|
||||
|
||||
#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
|
||||
private DotFish()
|
||||
{
|
||||
}
|
||||
#pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
|
||||
|
||||
public DotFish(string fishType)
|
||||
{
|
||||
FishType = fishType;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DotFishMarket
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("DotFishMarket");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (SampleSalmon != null)
|
||||
{
|
||||
SampleSalmon?.Serialize(writer);
|
||||
}
|
||||
if (_salmons != null)
|
||||
{
|
||||
writer.WriteStartArray("salmons");
|
||||
foreach (var item in _salmons)
|
||||
{
|
||||
item?.Serialize(writer);
|
||||
}
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
if (SampleFish != null)
|
||||
{
|
||||
SampleFish?.Serialize(writer);
|
||||
}
|
||||
if (_fishes != null)
|
||||
{
|
||||
writer.WriteStartArray("fishes");
|
||||
foreach (var item in _fishes)
|
||||
{
|
||||
item?.Serialize(writer);
|
||||
}
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static DotFishMarket Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new DotFishMarket();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("sampleSalmon"))
|
||||
{
|
||||
result.SampleSalmon = BodyComplex.Models.V20160229.DotSalmon.Deserialize(property.Value);
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("salmons"))
|
||||
{
|
||||
foreach (var item in property.Value.EnumerateArray())
|
||||
{
|
||||
result.Salmons.Add(BodyComplex.Models.V20160229.DotSalmon.Deserialize(item));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("sampleFish"))
|
||||
{
|
||||
result.SampleFish = BodyComplex.Models.V20160229.DotFish.Deserialize(property.Value);
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("fishes"))
|
||||
{
|
||||
foreach (var item in property.Value.EnumerateArray())
|
||||
{
|
||||
result.Fishes.Add(BodyComplex.Models.V20160229.DotFish.Deserialize(item));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DotFishMarket
|
||||
{
|
||||
private List<DotSalmon>? _salmons;
|
||||
private List<DotFish>? _fishes;
|
||||
|
||||
public DotSalmon? SampleSalmon { get; set; }
|
||||
public ICollection<DotSalmon> Salmons => LazyInitializer.EnsureInitialized(ref _salmons);
|
||||
public DotFish? SampleFish { get; set; }
|
||||
public ICollection<DotFish> Fishes => LazyInitializer.EnsureInitialized(ref _fishes);
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DotSalmon
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("DotSalmon");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Location != null)
|
||||
{
|
||||
writer.WriteString("location", Location);
|
||||
}
|
||||
if (Iswild != null)
|
||||
{
|
||||
writer.WriteBoolean("iswild", Iswild.Value);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static DotSalmon Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new DotSalmon();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("location"))
|
||||
{
|
||||
result.Location = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("iswild"))
|
||||
{
|
||||
result.Iswild = property.Value.GetBoolean();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DotSalmon
|
||||
{
|
||||
public string? Location { get; set; }
|
||||
public bool? Iswild { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DoubleWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("double-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Field1 != null)
|
||||
{
|
||||
writer.WriteNumber("field1", Field1.Value);
|
||||
}
|
||||
if (Field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose != null)
|
||||
{
|
||||
writer.WriteNumber("field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose", Field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose.Value);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static DoubleWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new DoubleWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("field1"))
|
||||
{
|
||||
result.Field1 = property.Value.GetDouble();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose"))
|
||||
{
|
||||
result.Field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose = property.Value.GetDouble();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DoubleWrapper
|
||||
{
|
||||
public double? Field1 { get; set; }
|
||||
public double? Field56ZerosAfterTheDotAndNegativeZeroBeforeDotAndThisIsALongFieldNameOnPurpose { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DurationWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("duration-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Field != null)
|
||||
{
|
||||
writer.WriteString("field", Field.ToString());
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static DurationWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new DurationWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("field"))
|
||||
{
|
||||
// DurationSchema Field: Not Implemented
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class DurationWrapper
|
||||
{
|
||||
public TimeSpan? Field { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Error
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("Error");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Status != null)
|
||||
{
|
||||
writer.WriteNumber("status", Status.Value);
|
||||
}
|
||||
if (Message != null)
|
||||
{
|
||||
writer.WriteString("message", Message);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Error Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Error();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("status"))
|
||||
{
|
||||
result.Status = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("message"))
|
||||
{
|
||||
result.Message = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Error
|
||||
{
|
||||
public int? Status { get; set; }
|
||||
public string? Message { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Fish
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("Fish");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
writer.WriteString("fishtype", Fishtype);
|
||||
if (Species != null)
|
||||
{
|
||||
writer.WriteString("species", Species);
|
||||
}
|
||||
writer.WriteNumber("length", Length);
|
||||
if (_siblings != null)
|
||||
{
|
||||
writer.WriteStartArray("siblings");
|
||||
foreach (var item in _siblings)
|
||||
{
|
||||
item?.Serialize(writer);
|
||||
}
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Fish Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Fish();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("fishtype"))
|
||||
{
|
||||
result.Fishtype = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("species"))
|
||||
{
|
||||
result.Species = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("length"))
|
||||
{
|
||||
result.Length = property.Value.GetDouble();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("siblings"))
|
||||
{
|
||||
foreach (var item in property.Value.EnumerateArray())
|
||||
{
|
||||
result.Siblings.Add(BodyComplex.Models.V20160229.Fish.Deserialize(item));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Fish
|
||||
{
|
||||
private List<Fish>? _siblings;
|
||||
|
||||
public string Fishtype { get; private set; }
|
||||
public string? Species { get; set; }
|
||||
public double Length { get; private set; }
|
||||
public ICollection<Fish> Siblings => LazyInitializer.EnsureInitialized(ref _siblings);
|
||||
|
||||
#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
|
||||
private Fish()
|
||||
{
|
||||
}
|
||||
#pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
|
||||
|
||||
public Fish(string fishtype, double length)
|
||||
{
|
||||
Fishtype = fishtype;
|
||||
Length = length;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class FloatWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("float-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Field1 != null)
|
||||
{
|
||||
writer.WriteNumber("field1", Field1.Value);
|
||||
}
|
||||
if (Field2 != null)
|
||||
{
|
||||
writer.WriteNumber("field2", Field2.Value);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static FloatWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new FloatWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("field1"))
|
||||
{
|
||||
result.Field1 = property.Value.GetDouble();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("field2"))
|
||||
{
|
||||
result.Field2 = property.Value.GetDouble();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class FloatWrapper
|
||||
{
|
||||
public double? Field1 { get; set; }
|
||||
public double? Field2 { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
|
||||
namespace BodyComplex.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 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public enum GoblinSharkColor
|
||||
{
|
||||
Pink,
|
||||
Gray,
|
||||
Brown
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Goblinshark
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("goblinshark");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Jawsize != null)
|
||||
{
|
||||
writer.WriteNumber("jawsize", Jawsize.Value);
|
||||
}
|
||||
if (Color != null)
|
||||
{
|
||||
// SealedChoiceSchema Color: Not Implemented
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Goblinshark Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Goblinshark();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("jawsize"))
|
||||
{
|
||||
result.Jawsize = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("color"))
|
||||
{
|
||||
// SealedChoiceSchema Color: Not Implemented
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Goblinshark
|
||||
{
|
||||
public int? Jawsize { get; set; }
|
||||
public GoblinSharkColor? Color { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class IntWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("int-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Field1 != null)
|
||||
{
|
||||
writer.WriteNumber("field1", Field1.Value);
|
||||
}
|
||||
if (Field2 != null)
|
||||
{
|
||||
writer.WriteNumber("field2", Field2.Value);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static IntWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new IntWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("field1"))
|
||||
{
|
||||
result.Field1 = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("field2"))
|
||||
{
|
||||
result.Field2 = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class IntWrapper
|
||||
{
|
||||
public int? Field1 { get; set; }
|
||||
public int? Field2 { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class LongWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("long-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Field1 != null)
|
||||
{
|
||||
writer.WriteNumber("field1", Field1.Value);
|
||||
}
|
||||
if (Field2 != null)
|
||||
{
|
||||
writer.WriteNumber("field2", Field2.Value);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static LongWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new LongWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("field1"))
|
||||
{
|
||||
result.Field1 = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("field2"))
|
||||
{
|
||||
result.Field2 = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class LongWrapper
|
||||
{
|
||||
public int? Field1 { get; set; }
|
||||
public int? Field2 { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class MyBaseHelperType
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("MyBaseHelperType");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (PropBH1 != null)
|
||||
{
|
||||
writer.WriteString("propBH1", PropBH1);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static MyBaseHelperType Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new MyBaseHelperType();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("propBH1"))
|
||||
{
|
||||
result.PropBH1 = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class MyBaseHelperType
|
||||
{
|
||||
public string? PropBH1 { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class MyBaseType
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("MyBaseType");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (PropB1 != null)
|
||||
{
|
||||
writer.WriteString("propB1", PropB1);
|
||||
}
|
||||
if (Helper != null)
|
||||
{
|
||||
Helper?.Serialize(writer);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static MyBaseType Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new MyBaseType();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("propB1"))
|
||||
{
|
||||
result.PropB1 = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("helper"))
|
||||
{
|
||||
result.Helper = BodyComplex.Models.V20160229.MyBaseHelperType.Deserialize(property.Value);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class MyBaseType
|
||||
{
|
||||
public string? PropB1 { get; set; }
|
||||
public MyBaseHelperType? Helper { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class MyDerivedType
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("MyDerivedType");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (PropD1 != null)
|
||||
{
|
||||
writer.WriteString("propD1", PropD1);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static MyDerivedType Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new MyDerivedType();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("propD1"))
|
||||
{
|
||||
result.PropD1 = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class MyDerivedType
|
||||
{
|
||||
public string? PropD1 { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Pet
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("pet");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Id != null)
|
||||
{
|
||||
writer.WriteNumber("id", Id.Value);
|
||||
}
|
||||
if (Name != null)
|
||||
{
|
||||
writer.WriteString("name", Name);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Pet Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Pet();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("id"))
|
||||
{
|
||||
result.Id = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("name"))
|
||||
{
|
||||
result.Name = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Pet
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class ReadonlyObj
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("readonly-obj");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Id != null)
|
||||
{
|
||||
writer.WriteString("id", Id);
|
||||
}
|
||||
if (Size != null)
|
||||
{
|
||||
writer.WriteNumber("size", Size.Value);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static ReadonlyObj Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new ReadonlyObj();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("id"))
|
||||
{
|
||||
result.Id = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("size"))
|
||||
{
|
||||
result.Size = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class ReadonlyObj
|
||||
{
|
||||
public string? Id { get; set; }
|
||||
public int? Size { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Salmon
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("salmon");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Location != null)
|
||||
{
|
||||
writer.WriteString("location", Location);
|
||||
}
|
||||
if (Iswild != null)
|
||||
{
|
||||
writer.WriteBoolean("iswild", Iswild.Value);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Salmon Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Salmon();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("location"))
|
||||
{
|
||||
result.Location = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("iswild"))
|
||||
{
|
||||
result.Iswild = property.Value.GetBoolean();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Salmon
|
||||
{
|
||||
public string? Location { get; set; }
|
||||
public bool? Iswild { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Sawshark
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("sawshark");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Picture != null)
|
||||
{
|
||||
// ByteArraySchema Picture: Not Implemented
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Sawshark Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Sawshark();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("picture"))
|
||||
{
|
||||
// ByteArraySchema Picture: Not Implemented
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Sawshark
|
||||
{
|
||||
public byte[]? Picture { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Shark
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("shark");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Age != null)
|
||||
{
|
||||
writer.WriteNumber("age", Age.Value);
|
||||
}
|
||||
writer.WriteString("birthday", Birthday.ToString());
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Shark Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Shark();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("age"))
|
||||
{
|
||||
result.Age = property.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("birthday"))
|
||||
{
|
||||
result.Birthday = property.Value.GetDateTime();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Shark
|
||||
{
|
||||
public int? Age { get; set; }
|
||||
public DateTime Birthday { get; private set; }
|
||||
|
||||
#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
|
||||
private Shark()
|
||||
{
|
||||
}
|
||||
#pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
|
||||
|
||||
public Shark(DateTime birthday)
|
||||
{
|
||||
Birthday = birthday;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Siamese
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("siamese");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Breed != null)
|
||||
{
|
||||
writer.WriteString("breed", Breed);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static Siamese Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new Siamese();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("breed"))
|
||||
{
|
||||
result.Breed = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class Siamese
|
||||
{
|
||||
public string? Breed { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class SmartSalmon
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("smart_salmon");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (CollegeDegree != null)
|
||||
{
|
||||
writer.WriteString("college_degree", CollegeDegree);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static SmartSalmon Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new SmartSalmon();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("college_degree"))
|
||||
{
|
||||
result.CollegeDegree = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class SmartSalmon
|
||||
{
|
||||
public string? CollegeDegree { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class StringWrapper
|
||||
{
|
||||
internal void Serialize(Utf8JsonWriter writer, bool includeName = true)
|
||||
{
|
||||
if (includeName)
|
||||
{
|
||||
writer.WriteStartObject("string-wrapper");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
}
|
||||
if (Field != null)
|
||||
{
|
||||
writer.WriteString("field", Field);
|
||||
}
|
||||
if (Empty != null)
|
||||
{
|
||||
writer.WriteString("empty", Empty);
|
||||
}
|
||||
if (NullProperty != null)
|
||||
{
|
||||
writer.WriteString("", NullProperty);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
internal static StringWrapper Deserialize(JsonElement element)
|
||||
{
|
||||
var result = new StringWrapper();
|
||||
foreach (var property in element.EnumerateObject())
|
||||
{
|
||||
if (property.NameEquals("field"))
|
||||
{
|
||||
result.Field = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals("empty"))
|
||||
{
|
||||
result.Empty = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
if (property.NameEquals(""))
|
||||
{
|
||||
result.NullProperty = property.Value.GetString();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace BodyComplex.Models.V20160229
|
||||
{
|
||||
public partial class StringWrapper
|
||||
{
|
||||
public string? Field { get; set; }
|
||||
public string? Empty { get; set; }
|
||||
public string? NullProperty { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
using Azure.Core.Pipeline;
|
||||
using BodyComplex.Models.V20160229;
|
||||
|
||||
namespace BodyComplex.Operations
|
||||
{
|
||||
public static class ArrayOperations
|
||||
{
|
||||
public static async ValueTask<Response<ArrayWrapper>> GetValidAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(ArrayWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutValidAsync(Uri uri, HttpPipeline pipeline, ArrayWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<ArrayWrapper>> GetEmptyAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetEmpty");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(ArrayWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutEmptyAsync(Uri uri, HttpPipeline pipeline, ArrayWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutEmpty");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<ArrayWrapper>> GetNotProvidedAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetNotProvided");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(ArrayWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
using Azure.Core.Pipeline;
|
||||
using BodyComplex.Models.V20160229;
|
||||
|
||||
namespace BodyComplex.Operations
|
||||
{
|
||||
public static class BasicOperations
|
||||
{
|
||||
public static async ValueTask<Response<Basic>> GetValidAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(Basic.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutValidAsync(Uri uri, HttpPipeline pipeline, Basic? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<Basic>> GetInvalidAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetInvalid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(Basic.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<Basic>> GetEmptyAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetEmpty");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(Basic.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<Basic>> GetNullAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetNull");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(Basic.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<Basic>> GetNotProvidedAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetNotProvided");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(Basic.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
using Azure.Core.Pipeline;
|
||||
using BodyComplex.Models.V20160229;
|
||||
|
||||
namespace BodyComplex.Operations
|
||||
{
|
||||
public static class DictionaryOperations
|
||||
{
|
||||
public static async ValueTask<Response<DictionaryWrapper>> GetValidAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(DictionaryWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutValidAsync(Uri uri, HttpPipeline pipeline, DictionaryWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<DictionaryWrapper>> GetEmptyAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetEmpty");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(DictionaryWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutEmptyAsync(Uri uri, HttpPipeline pipeline, DictionaryWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutEmpty");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<DictionaryWrapper>> GetNullAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetNull");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(DictionaryWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<DictionaryWrapper>> GetNotProvidedAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetNotProvided");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(DictionaryWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
using Azure.Core.Pipeline;
|
||||
using BodyComplex.Models.V20160229;
|
||||
|
||||
namespace BodyComplex.Operations
|
||||
{
|
||||
public static class FlattencomplexOperations
|
||||
{
|
||||
public static async ValueTask<Response<MyBaseType>> GetValidAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(MyBaseType.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
using Azure.Core.Pipeline;
|
||||
using BodyComplex.Models.V20160229;
|
||||
|
||||
namespace BodyComplex.Operations
|
||||
{
|
||||
public static class InheritanceOperations
|
||||
{
|
||||
public static async ValueTask<Response<Siamese>> GetValidAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(Siamese.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutValidAsync(Uri uri, HttpPipeline pipeline, Siamese? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
using Azure.Core.Pipeline;
|
||||
using BodyComplex.Models.V20160229;
|
||||
|
||||
namespace BodyComplex.Operations
|
||||
{
|
||||
public static class PolymorphicrecursiveOperations
|
||||
{
|
||||
public static async ValueTask<Response<Fish>> GetValidAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(Fish.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutValidAsync(Uri uri, HttpPipeline pipeline, Fish? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,232 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
using Azure.Core.Pipeline;
|
||||
using BodyComplex.Models.V20160229;
|
||||
|
||||
namespace BodyComplex.Operations
|
||||
{
|
||||
public static class PolymorphismOperations
|
||||
{
|
||||
public static async ValueTask<Response<Fish>> GetValidAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(Fish.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutValidAsync(Uri uri, HttpPipeline pipeline, Fish? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<DotFish>> GetDotSyntaxAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetDotSyntax");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(DotFish.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<DotFishMarket>> GetComposedWithDiscriminatorAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetComposedWithDiscriminator");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(DotFishMarket.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<DotFishMarket>> GetComposedWithoutDiscriminatorAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetComposedWithoutDiscriminator");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(DotFishMarket.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<Salmon>> GetComplicatedAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetComplicated");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(Salmon.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutComplicatedAsync(Uri uri, HttpPipeline pipeline, Salmon? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutComplicated");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<Salmon>> PutMissingDiscriminatorAsync(Uri uri, HttpPipeline pipeline, Salmon? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutMissingDiscriminator");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(Salmon.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutValidMissingRequiredAsync(Uri uri, HttpPipeline pipeline, Fish? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutValidMissingRequired");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,545 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
using Azure.Core.Pipeline;
|
||||
using BodyComplex.Models.V20160229;
|
||||
|
||||
namespace BodyComplex.Operations
|
||||
{
|
||||
public static class PrimitiveOperations
|
||||
{
|
||||
public static async ValueTask<Response<IntWrapper>> GetIntAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetInt");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(IntWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutIntAsync(Uri uri, HttpPipeline pipeline, IntWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutInt");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<LongWrapper>> GetLongAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetLong");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(LongWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutLongAsync(Uri uri, HttpPipeline pipeline, LongWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutLong");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<FloatWrapper>> GetFloatAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetFloat");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(FloatWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutFloatAsync(Uri uri, HttpPipeline pipeline, FloatWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutFloat");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<DoubleWrapper>> GetDoubleAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetDouble");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(DoubleWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutDoubleAsync(Uri uri, HttpPipeline pipeline, DoubleWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutDouble");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<BooleanWrapper>> GetBoolAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetBool");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(BooleanWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutBoolAsync(Uri uri, HttpPipeline pipeline, BooleanWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutBool");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<StringWrapper>> GetStringAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetString");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(StringWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutStringAsync(Uri uri, HttpPipeline pipeline, StringWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutString");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<DateWrapper>> GetDateAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetDate");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(DateWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutDateAsync(Uri uri, HttpPipeline pipeline, DateWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutDate");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<DatetimeWrapper>> GetDateTimeAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetDateTime");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(DatetimeWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutDateTimeAsync(Uri uri, HttpPipeline pipeline, DatetimeWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutDateTime");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<Datetimerfc1123Wrapper>> GetDateTimeRfc1123Async(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetDateTimeRfc1123");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(Datetimerfc1123Wrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutDateTimeRfc1123Async(Uri uri, HttpPipeline pipeline, Datetimerfc1123Wrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutDateTimeRfc1123");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<DurationWrapper>> GetDurationAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetDuration");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(DurationWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutDurationAsync(Uri uri, HttpPipeline pipeline, DurationWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutDuration");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<ByteWrapper>> GetByteAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetByte");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(ByteWrapper.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutByteAsync(Uri uri, HttpPipeline pipeline, ByteWrapper? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutByte");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Azure;
|
||||
using Azure.Core;
|
||||
using Azure.Core.Pipeline;
|
||||
using BodyComplex.Models.V20160229;
|
||||
|
||||
namespace BodyComplex.Operations
|
||||
{
|
||||
public static class ReadonlypropertyOperations
|
||||
{
|
||||
public static async ValueTask<Response<ReadonlyObj>> GetValidAsync(Uri uri, HttpPipeline pipeline, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.GetValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Get;
|
||||
request.Uri.Reset(uri);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
|
||||
return Response.FromValue(ReadonlyObj.Deserialize(document.RootElement), response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async ValueTask<Response<string>> PutValidAsync(Uri uri, HttpPipeline pipeline, ReadonlyObj? complexBody = default, CancellationToken cancellationToken = default)
|
||||
{
|
||||
//using ClientDiagnostics scope = clientDiagnostics.CreateScope("BodyComplex.Operations.PutValid");
|
||||
//scope.AddAttribute("key", name)
|
||||
//scope.Start()
|
||||
try
|
||||
{
|
||||
var request = pipeline.CreateRequest();
|
||||
request.Method = RequestMethod.Put;
|
||||
request.Uri.Reset(uri);
|
||||
var buffer = new ArrayBufferWriter<byte>();
|
||||
await using var writer = new Utf8JsonWriter(buffer);
|
||||
complexBody?.Serialize(writer);
|
||||
writer.Flush();
|
||||
request.Content = RequestContent.Create(buffer.WrittenMemory);
|
||||
var response = await pipeline.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
return Response.FromValue(string.Empty, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//scope.Failed(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
using System;
|
||||
using Azure.Core;
|
||||
using Azure.Core.Pipeline;
|
||||
using Azure.Identity;
|
||||
using BodyComplex.Operations;
|
||||
|
||||
namespace Tester
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var uri = new Uri("http://localhost:3000/complex/basic/valid");
|
||||
var pipeline = HttpPipelineBuilder.Build(new DefaultAzureCredentialOptions());
|
||||
var result = BasicOperations.GetValidAsync(uri, pipeline).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BodyComplex\BodyComplex.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,10 +0,0 @@
|
|||
# BodyComplex
|
||||
### AutoRest Configuration
|
||||
> see https://aka.ms/autorest
|
||||
|
||||
``` yaml
|
||||
title: BodyComplex
|
||||
require: $(this-folder)/../readme.samples.md
|
||||
input-file: https://github.com/Azure/autorest.testserver/blob/master/swagger/body-complex.json
|
||||
namespace: BodyComplex
|
||||
```
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,39 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<AssemblyName>Azure.Dns</AssemblyName>
|
||||
<RootNamespace>Azure.Dns</RootNamespace>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<OutputPath>bin</OutputPath>
|
||||
<PublishDir>$(OutputPath)</PublishDir>
|
||||
<!-- Some methods are marked async and don't have an await in them -->
|
||||
<NoWarn>1998</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors />
|
||||
<Nullable>enable</Nullable>
|
||||
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
|
||||
<RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DelaySign>false</DelaySign>
|
||||
<DefineConstants>DEBUG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<DelaySign>true</DelaySign>
|
||||
<AssemblyOriginatorKeyFile>MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
|
||||
<DefineConstants>TRACE;RELEASE;NETSTANDARD;SIGN</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Azure.Core" Version="1.0.0" />
|
||||
<PackageReference Include="Azure.Identity" Version="1.0.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29514.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dns", "Dns.csproj", "{09B14CA6-5225-4867-B484-8850EA90BDDF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{09B14CA6-5225-4867-B484-8850EA90BDDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{09B14CA6-5225-4867-B484-8850EA90BDDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{09B14CA6-5225-4867-B484-8850EA90BDDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{09B14CA6-5225-4867-B484-8850EA90BDDF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {195B3FFE-D49B-4267-A257-7457C401714A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,190 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Azure.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a heap-based, array-backed output sink into which <typeparam name="T"/> data can be written.
|
||||
/// </summary>
|
||||
internal sealed class ArrayBufferWriter<T> : IBufferWriter<T>
|
||||
{
|
||||
private T[] _buffer;
|
||||
private const int DefaultInitialBufferSize = 256;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of an <see cref="ArrayBufferWriter{T}"/>, in which data can be written to,
|
||||
/// with the default initial capacity.
|
||||
/// </summary>
|
||||
public ArrayBufferWriter()
|
||||
{
|
||||
_buffer = Array.Empty<T>();
|
||||
WrittenCount = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of an <see cref="ArrayBufferWriter{T}"/>, in which data can be written to,
|
||||
/// with an initial capacity specified.
|
||||
/// </summary>
|
||||
/// <param name="initialCapacity">The minimum capacity with which to initialize the underlying buffer.</param>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="initialCapacity"/> is not positive (i.e. less than or equal to 0).
|
||||
/// </exception>
|
||||
public ArrayBufferWriter(int initialCapacity)
|
||||
{
|
||||
if (initialCapacity <= 0)
|
||||
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
|
||||
throw new ArgumentException(nameof(initialCapacity));
|
||||
#pragma warning restore CA2208 // Instantiate argument exceptions correctly
|
||||
|
||||
_buffer = new T[initialCapacity];
|
||||
WrittenCount = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the data written to the underlying buffer so far, as a <see cref="ReadOnlyMemory{T}"/>.
|
||||
/// </summary>
|
||||
public ReadOnlyMemory<T> WrittenMemory => _buffer.AsMemory(0, WrittenCount);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the data written to the underlying buffer so far, as a <see cref="ReadOnlySpan{T}"/>.
|
||||
/// </summary>
|
||||
public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, WrittenCount);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the amount of data written to the underlying buffer so far.
|
||||
/// </summary>
|
||||
public int WrittenCount { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the total amount of space within the underlying buffer.
|
||||
/// </summary>
|
||||
public int Capacity => _buffer.Length;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the amount of space available that can still be written into without forcing the underlying buffer to grow.
|
||||
/// </summary>
|
||||
public int FreeCapacity => _buffer.Length - WrittenCount;
|
||||
|
||||
/// <summary>
|
||||
/// Clears the data written to the underlying buffer.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// You must clear the <see cref="ArrayBufferWriter{T}"/> before trying to re-use it.
|
||||
/// </remarks>
|
||||
public void Clear()
|
||||
{
|
||||
Debug.Assert(_buffer.Length >= WrittenCount);
|
||||
_buffer.AsSpan(0, WrittenCount).Clear();
|
||||
WrittenCount = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notifies <see cref="IBufferWriter{T}"/> that <paramref name="count"/> amount of data was written to the output <see cref="Span{T}"/>/<see cref="Memory{T}"/>
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="count"/> is negative.
|
||||
/// </exception>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown when attempting to advance past the end of the underlying buffer.
|
||||
/// </exception>
|
||||
/// <remarks>
|
||||
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
|
||||
/// </remarks>
|
||||
public void Advance(int count)
|
||||
{
|
||||
if (count < 0)
|
||||
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
|
||||
throw new ArgumentException(nameof(count));
|
||||
#pragma warning restore CA2208 // Instantiate argument exceptions correctly
|
||||
|
||||
if (WrittenCount > _buffer.Length - count)
|
||||
ThrowInvalidOperationException_AdvancedTooFar(_buffer.Length);
|
||||
|
||||
WrittenCount += count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="Memory{T}"/> to write to that is at least the requested length (specified by <paramref name="sizeHint"/>).
|
||||
/// If no <paramref name="sizeHint"/> is provided (or it's equal to <code>0</code>), some non-empty buffer is returned.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="sizeHint"/> is negative.
|
||||
/// </exception>
|
||||
/// <remarks>
|
||||
/// This will never return an empty <see cref="Memory{T}"/>.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
|
||||
/// </remarks>
|
||||
public Memory<T> GetMemory(int sizeHint = 0)
|
||||
{
|
||||
CheckAndResizeBuffer(sizeHint);
|
||||
Debug.Assert(_buffer.Length > WrittenCount);
|
||||
return _buffer.AsMemory(WrittenCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="Span{T}"/> to write to that is at least the requested length (specified by <paramref name="sizeHint"/>).
|
||||
/// If no <paramref name="sizeHint"/> is provided (or it's equal to <code>0</code>), some non-empty buffer is returned.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="sizeHint"/> is negative.
|
||||
/// </exception>
|
||||
/// <remarks>
|
||||
/// This will never return an empty <see cref="Span{T}"/>.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
|
||||
/// </remarks>
|
||||
public Span<T> GetSpan(int sizeHint = 0)
|
||||
{
|
||||
CheckAndResizeBuffer(sizeHint);
|
||||
Debug.Assert(_buffer.Length > WrittenCount);
|
||||
return _buffer.AsSpan(WrittenCount);
|
||||
}
|
||||
|
||||
private void CheckAndResizeBuffer(int sizeHint)
|
||||
{
|
||||
if (sizeHint < 0)
|
||||
#pragma warning disable CA2208 // Instantiate argument exceptions correctly
|
||||
throw new ArgumentException(nameof(sizeHint));
|
||||
#pragma warning restore CA2208 // Instantiate argument exceptions correctly
|
||||
|
||||
if (sizeHint == 0)
|
||||
{
|
||||
sizeHint = 1;
|
||||
}
|
||||
|
||||
if (sizeHint > FreeCapacity)
|
||||
{
|
||||
int growBy = Math.Max(sizeHint, _buffer.Length);
|
||||
|
||||
if (_buffer.Length == 0)
|
||||
{
|
||||
growBy = Math.Max(growBy, DefaultInitialBufferSize);
|
||||
}
|
||||
|
||||
int newSize = checked(_buffer.Length + growBy);
|
||||
|
||||
Array.Resize(ref _buffer, newSize);
|
||||
}
|
||||
|
||||
Debug.Assert(FreeCapacity > 0 && FreeCapacity >= sizeHint);
|
||||
}
|
||||
|
||||
private static void ThrowInvalidOperationException_AdvancedTooFar(int capacity)
|
||||
{
|
||||
throw new InvalidOperationException($"Advanced past capacity of {capacity}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Azure.Core.Pipeline
|
||||
{
|
||||
internal readonly struct DiagnosticScope : IDisposable
|
||||
{
|
||||
private readonly DiagnosticActivity? _activity;
|
||||
|
||||
private readonly string _name;
|
||||
|
||||
private readonly DiagnosticListener _source;
|
||||
|
||||
internal DiagnosticScope(string name, DiagnosticListener source)
|
||||
{
|
||||
_name = name;
|
||||
_source = source;
|
||||
_activity = _source.IsEnabled(_name) ? new DiagnosticActivity(_name) : null;
|
||||
_activity?.SetW3CFormat();
|
||||
}
|
||||
|
||||
public bool IsEnabled => _activity != null;
|
||||
|
||||
public void AddAttribute(string name, string value)
|
||||
{
|
||||
_activity?.AddTag(name, value);
|
||||
}
|
||||
|
||||
public void AddAttribute<T>(string name, T value)
|
||||
{
|
||||
if (_activity != null && value != null)
|
||||
{
|
||||
AddAttribute(name, value.ToString()!);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddAttribute<T>(string name, T value, Func<T, string> format)
|
||||
{
|
||||
if (_activity != null)
|
||||
{
|
||||
AddAttribute(name, format(value));
|
||||
}
|
||||
}
|
||||
|
||||
public void AddLink(string id)
|
||||
{
|
||||
if (_activity != null)
|
||||
{
|
||||
var linkedActivity = new Activity("LinkedActivity");
|
||||
linkedActivity.SetW3CFormat();
|
||||
linkedActivity.SetParentId(id);
|
||||
|
||||
_activity.AddLink(linkedActivity);
|
||||
}
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (_activity != null)
|
||||
{
|
||||
_source.StartActivity(_activity, _activity);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_activity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_source != null)
|
||||
{
|
||||
_source.StopActivity(_activity, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
_activity?.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void Failed(Exception e)
|
||||
{
|
||||
if (_activity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_source?.Write(_activity.OperationName + ".Exception", e);
|
||||
|
||||
}
|
||||
|
||||
private class DiagnosticActivity : Activity
|
||||
{
|
||||
private List<Activity>? _links;
|
||||
|
||||
public IEnumerable<Activity> Links => (IEnumerable<Activity>?)_links ?? Array.Empty<Activity>();
|
||||
|
||||
public DiagnosticActivity(string operationName) : base(operationName)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddLink(Activity activity)
|
||||
{
|
||||
_links ??= new List<Activity>();
|
||||
_links.Add(activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HACK HACK HACK. Some runtime environments like Azure.Functions downgrade System.Diagnostic.DiagnosticSource package version causing method not found exceptions in customer apps
|
||||
/// This type is a temporary workaround to avoid the issue.
|
||||
/// </summary>
|
||||
internal static class ActivityExtensions
|
||||
{
|
||||
private static readonly MethodInfo? s_setIdFormatMethod = typeof(Activity).GetMethod("SetIdFormat");
|
||||
private static readonly MethodInfo? s_getIdFormatMethod = typeof(Activity).GetProperty("IdFormat")?.GetMethod;
|
||||
private static readonly MethodInfo? s_getTraceStateStringMethod = typeof(Activity).GetProperty("TraceStateString")?.GetMethod;
|
||||
|
||||
public static bool SetW3CFormat(this Activity activity)
|
||||
{
|
||||
if (s_setIdFormatMethod == null) return false;
|
||||
|
||||
s_setIdFormatMethod.Invoke(activity, new object[]{ 2 /* ActivityIdFormat.W3C */});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsW3CFormat(this Activity activity)
|
||||
{
|
||||
if (s_getIdFormatMethod == null) return false;
|
||||
|
||||
object? result = s_getIdFormatMethod.Invoke(activity, Array.Empty<object>());
|
||||
|
||||
return result is int resultInt && resultInt == 2 /* ActivityIdFormat.W3C */;
|
||||
}
|
||||
|
||||
public static bool TryGetTraceState(this Activity activity, out string? traceState)
|
||||
{
|
||||
traceState = null;
|
||||
|
||||
if (s_getTraceStateStringMethod == null) return false;
|
||||
|
||||
traceState = s_getTraceStateStringMethod.Invoke(activity, Array.Empty<object>()) as string;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace Azure.Dns.Models.V20180501
|
||||
{
|
||||
public partial class ARecord
|
||||
{
|
||||
public string? Ipv4Address { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace Azure.Dns.Models.V20180501
|
||||
{
|
||||
public partial class AaaaRecord
|
||||
{
|
||||
public string? Ipv6Address { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace Azure.Dns.Models.V20180501
|
||||
{
|
||||
public partial class CaaRecord
|
||||
{
|
||||
public int? Flags { get; set; }
|
||||
public string? Tag { get; set; }
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
}
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче