diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ClientPipelineExtensionsProvider.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ClientPipelineExtensionsProvider.cs
index 8d3f9a2f19..41efb2c775 100644
--- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ClientPipelineExtensionsProvider.cs
+++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ClientPipelineExtensionsProvider.cs
@@ -138,7 +138,7 @@ private MethodProvider BuildProcessMessage()
Throw(New.Instance(typeof(ClientResultException), _message.Response))
},
MethodBodyStatement.EmptyLine,
- Declare(typeof(PipelineResponse), "response", new TernaryConditionalExpression(_message.BufferResponse, _message.Response, _message.ExtractResponse()), out var response),
+ Declare("response", typeof(PipelineResponse), new TernaryConditionalExpression(_message.BufferResponse, _message.Response, _message.ExtractResponse()), out var response),
Return(response)
}, this);
}
@@ -173,7 +173,7 @@ private MethodProvider BuildProcessMessageAsync()
Throw(new InvokeStaticMethodExpression(typeof(ClientResultException), nameof(ClientResultException.CreateAsync), [_message.Response], CallAsAsync: true))
},
MethodBodyStatement.EmptyLine,
- Declare(typeof(PipelineResponse), "response", new TernaryConditionalExpression(_message.BufferResponse, _message.Response, _message.ExtractResponse()), out var response),
+ Declare("response", typeof(PipelineResponse), new TernaryConditionalExpression(_message.BufferResponse, _message.Response, _message.ExtractResponse()), out var response),
Return(response)
}, this);
}
diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/MrwSerializationTypeProvider.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/MrwSerializationTypeProvider.cs
index f141116349..ac0ef56066 100644
--- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/MrwSerializationTypeProvider.cs
+++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/MrwSerializationTypeProvider.cs
@@ -2,6 +2,7 @@
// Licensed under the MIT License.
using System;
+using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.IO;
@@ -159,7 +160,10 @@ protected override MethodProvider[] BuildMethods()
// Add PersistableModel serialization methods
BuildPersistableModelWriteMethod(),
BuildPersistableModelCreateMethod(),
- BuildPersistableModelGetFormatFromOptionsMethod()
+ BuildPersistableModelGetFormatFromOptionsMethod(),
+ //cast operators
+ BuildImplicitToBinaryContent(),
+ BuildExplicitFromClientResult()
};
if (_isStruct)
@@ -170,6 +174,26 @@ protected override MethodProvider[] BuildMethods()
return [.. methods];
}
+ private MethodProvider BuildExplicitFromClientResult()
+ {
+ var result = new ParameterProvider("result", $"The {typeof(ClientResult):C} to deserialize the {Type:C} from.", typeof(ClientResult));
+ var modifiers = MethodSignatureModifiers.Public | MethodSignatureModifiers.Static | MethodSignatureModifiers.Explicit | MethodSignatureModifiers.Operator;
+ return new MethodProvider(
+ new MethodSignature(Type.Name, null, modifiers, null, null, [result]),
+ Throw(New.NotImplementedException(Literal("Not implemented"))), //TODO https://github.com/microsoft/typespec/issues/3696
+ this);
+ }
+
+ private MethodProvider BuildImplicitToBinaryContent()
+ {
+ var model = new ParameterProvider(Type.Name.ToVariableName(), $"The {Type:C} to serialize into {typeof(BinaryContent):C}", Type);
+ var modifiers = MethodSignatureModifiers.Public | MethodSignatureModifiers.Static | MethodSignatureModifiers.Implicit | MethodSignatureModifiers.Operator;
+ return new MethodProvider(
+ new MethodSignature(nameof(BinaryContent), null, modifiers, null, null, [model]),
+ Throw(New.NotImplementedException(Literal("Not implemented"))), //TODO https://github.com/microsoft/typespec/issues/3696
+ this);
+ }
+
///
/// Builds the types that the model type serialization implements.
///
diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ScmMethodProviderCollection.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ScmMethodProviderCollection.cs
index 6bd4310559..4cd557def7 100644
--- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ScmMethodProviderCollection.cs
+++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/src/Providers/ScmMethodProviderCollection.cs
@@ -19,6 +19,7 @@ internal class ScmMethodProviderCollection : MethodProviderCollection
{
private string _cleanOperationName;
private string _createRequestMethodName;
+ private ParameterProvider? _bodyParameter;
public ScmMethodProviderCollection(InputOperation operation, TypeProvider enclosingType)
: base(operation, enclosingType)
@@ -34,24 +35,66 @@ protected override IReadOnlyList BuildMethods()
// TO-DO: Add Protocol and Convenience methods https://github.com/Azure/autorest.csharp/issues/4585, https://github.com/Azure/autorest.csharp/issues/4586
BuildCreateMessageMethod(),
BuildProtocolMethod(false),
- BuildProtocolMethod(true)
+ BuildProtocolMethod(true),
+ BuildConvenienceMethod(false),
+ BuildConvenienceMethod(true),
];
}
+ private MethodProvider BuildConvenienceMethod(bool isAsync)
+ {
+ ClientProvider? client = _enclosingType as ClientProvider;
+ if (client is null)
+ {
+ throw new InvalidOperationException("Protocol methods can only be built for client types.");
+ }
+
+ var methodModifier = MethodSignatureModifiers.Public | MethodSignatureModifiers.Virtual;
+ if (isAsync)
+ {
+ methodModifier |= MethodSignatureModifiers.Async;
+ }
+ var methodSignature = new MethodSignature(
+ isAsync ? _cleanOperationName + "Async" : _cleanOperationName,
+ FormattableStringHelpers.FromString(_operation.Description),
+ methodModifier,
+ GetResponseType(_operation.Responses, true, isAsync),
+ null,
+ Parameters: ConvenienceMethodParameters);
+ var processMessageName = isAsync ? "ProcessMessageAsync" : "ProcessMessage";
+ MethodBodyStatement[] methodBody = _bodyParameter is null
+ ? [Return(This.Invoke(methodSignature.Name, [.. ConvenienceMethodParameters, Null], null, isAsync, isAsync))]
+ : [
+ Declare("result", typeof(ClientResult), This.Invoke(methodSignature.Name, [.. ConvenienceMethodParameters, Null], null, isAsync, isAsync), out var result),
+ Return(new InvokeStaticMethodExpression(
+ typeof(ClientResult),
+ nameof(ClientResult.FromValue),
+ [result.CastTo(_bodyParameter.Type), result.Invoke("GetRawResponse")])),
+ ];
+
+ var convenienceMethod = new MethodProvider(methodSignature, methodBody, _enclosingType);
+ convenienceMethod.XmlDocs!.Exceptions.Add(new(typeof(ClientResultException), "Service returned a non-success status code.", []));
+ return convenienceMethod;
+ }
+
private List? _methodParameters;
- private List MethodParameters => _methodParameters ??= GetMethodParameters(_operation);
+ private List MethodParameters => _methodParameters ??= GetMethodParameters(false);
+
+ private List? _convenienceMethodParameters;
+ private List ConvenienceMethodParameters => _convenienceMethodParameters ??= GetMethodParameters(true);
- private static List GetMethodParameters(InputOperation operation)
+ private List GetMethodParameters(bool isConvenience)
{
List methodParameters = new();
- foreach (InputParameter inputParam in operation.Parameters)
+ foreach (InputParameter inputParam in _operation.Parameters)
{
if (inputParam.Kind != InputOperationParameterKind.Method)
continue;
if (inputParam.Location == RequestLocation.Body)
{
- // TODO: add concrete body with https://github.com/Azure/autorest.csharp/issues/4586
- methodParameters.Add(ScmKnownParameters.BinaryContent);
+ var parameter = isConvenience ? ClientModelPlugin.Instance.TypeFactory.CreateCSharpParam(inputParam) : ScmKnownParameters.BinaryContent;
+ _bodyParameter = parameter;
+ methodParameters.Add(parameter);
}
else
{
diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/test/Providers/ScmMethodProviderCollectionTests.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/test/Providers/ScmMethodProviderCollectionTests.cs
index 9cc1fbfa46..7a1dea3028 100644
--- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/test/Providers/ScmMethodProviderCollectionTests.cs
+++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp.ClientModel/test/Providers/ScmMethodProviderCollectionTests.cs
@@ -54,7 +54,7 @@ public void TestDefaultCSharpMethodCollection(InputOperation inputOperation)
{
var methodCollection = new ScmMethodProviderCollection(inputOperation, new MockClientTypeProvider());
Assert.IsNotNull(methodCollection);
- Assert.AreEqual(3, methodCollection.Count);
+ Assert.AreEqual(5, methodCollection.Count);
var method = methodCollection![0];
var signature = method.Signature;
diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Snippets/Snippet.DeclarationStatements.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Snippets/Snippet.DeclarationStatements.cs
index d884efc4c4..0db59b8edc 100644
--- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Snippets/Snippet.DeclarationStatements.cs
+++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Snippets/Snippet.DeclarationStatements.cs
@@ -22,7 +22,7 @@ public static MethodBodyStatement UsingDeclare(string name, StreamSnippet value,
public static MethodBodyStatement UsingDeclare(VariableExpression variable, ValueExpression value)
=> new DeclarationExpression(variable, false, true).Assign(value).Terminate();
- public static MethodBodyStatement Declare(CSharpType variableType, string name, ValueExpression value, out VariableExpression variable)
+ public static MethodBodyStatement Declare(string name, CSharpType variableType, ValueExpression value, out VariableExpression variable)
{
var variableRef = new VariableExpression(variableType, name);
variable = variableRef;
diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Writers/CodeWriter.cs b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Writers/CodeWriter.cs
index 54e4b522ca..3741cfd275 100644
--- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Writers/CodeWriter.cs
+++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Writers/CodeWriter.cs
@@ -701,7 +701,7 @@ public IDisposable WriteMethodDeclarationNoScope(MethodSignatureBase methodBase,
if (isImplicitOrExplicit)
{
- Append($"{method.ReturnType}");
+ AppendIf($"{method.ReturnType}", method.ReturnType is not null);
}
if (method.ExplicitInterface is not null)
diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/Friend.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/Friend.Serialization.cs
index c5ba2fa86b..90b7ba2e81 100644
--- a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/Friend.Serialization.cs
+++ b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/Friend.Serialization.cs
@@ -3,6 +3,7 @@
#nullable disable
using System;
+using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.Text.Json;
@@ -75,5 +76,17 @@ Friend IPersistableModel.Create(BinaryData data, ModelReaderWriterOption
}
string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// The to serialize into .
+ public static implicit operator BinaryContent(Friend friend)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
+
+ /// The to deserialize the from.
+ public static explicit operator Friend(ClientResult result)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
}
}
diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ModelWithRequiredNullableProperties.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ModelWithRequiredNullableProperties.Serialization.cs
index b16901be3c..a1037bcc59 100644
--- a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ModelWithRequiredNullableProperties.Serialization.cs
+++ b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ModelWithRequiredNullableProperties.Serialization.cs
@@ -3,6 +3,7 @@
#nullable disable
using System;
+using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.Text.Json;
@@ -102,5 +103,17 @@ ModelWithRequiredNullableProperties IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// The to serialize into .
+ public static implicit operator BinaryContent(ModelWithRequiredNullableProperties modelWithRequiredNullableProperties)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
+
+ /// The to deserialize the from.
+ public static explicit operator ModelWithRequiredNullableProperties(ClientResult result)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
}
}
diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ProjectedModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ProjectedModel.Serialization.cs
index d20a15408c..6902c1c7b5 100644
--- a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ProjectedModel.Serialization.cs
+++ b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ProjectedModel.Serialization.cs
@@ -3,6 +3,7 @@
#nullable disable
using System;
+using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.Text.Json;
@@ -75,5 +76,17 @@ ProjectedModel IPersistableModel.Create(BinaryData data, ModelRe
}
string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// The to serialize into .
+ public static implicit operator BinaryContent(ProjectedModel projectedModel)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
+
+ /// The to deserialize the from.
+ public static explicit operator ProjectedModel(ClientResult result)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
}
}
diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResponse.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResponse.Serialization.cs
index 854d06391f..79e2bdd613 100644
--- a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResponse.Serialization.cs
+++ b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/ReturnsAnonymousModelResponse.Serialization.cs
@@ -3,6 +3,7 @@
#nullable disable
using System;
+using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.Text.Json;
@@ -68,5 +69,17 @@ ReturnsAnonymousModelResponse IPersistableModel.C
}
string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// The to serialize into .
+ public static implicit operator BinaryContent(ReturnsAnonymousModelResponse returnsAnonymousModelResponse)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
+
+ /// The to deserialize the from.
+ public static explicit operator ReturnsAnonymousModelResponse(ClientResult result)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
}
}
diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs
index 9e0a8d11fe..6355bc6de9 100644
--- a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs
+++ b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/RoundTripModel.Serialization.cs
@@ -3,6 +3,7 @@
#nullable disable
using System;
+using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.Text.Json;
@@ -286,5 +287,17 @@ RoundTripModel IPersistableModel.Create(BinaryData data, ModelRe
}
string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// The to serialize into .
+ public static implicit operator BinaryContent(RoundTripModel roundTripModel)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
+
+ /// The to deserialize the from.
+ public static explicit operator RoundTripModel(ClientResult result)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
}
}
diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/Thing.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/Thing.Serialization.cs
index 5612767697..3499912053 100644
--- a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/Thing.Serialization.cs
+++ b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/Models/Thing.Serialization.cs
@@ -3,6 +3,7 @@
#nullable disable
using System;
+using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.Text.Json;
@@ -146,5 +147,17 @@ Thing IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions
}
string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// The to serialize into .
+ public static implicit operator BinaryContent(Thing thing)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
+
+ /// The to deserialize the from.
+ public static explicit operator Thing(ClientResult result)
+ {
+ throw new NotImplementedException("Not implemented");
+ }
}
}
diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs
index eabb4bacb6..193a9fbcda 100644
--- a/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs
+++ b/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Generated/UnbrandedTypeSpecClient.cs
@@ -6,6 +6,7 @@
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Threading.Tasks;
+using UnbrandedTypeSpec.Models;
namespace UnbrandedTypeSpec
{
@@ -73,6 +74,34 @@ public virtual async Task SayHiAsync(string headParameter, string
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// Return hi.
+ ///
+ ///
+ ///
+ /// or is null.
+ /// Service returned a non-success status code.
+ public virtual ClientResult SayHi(string headParameter, string queryParameter, string optionalQuery)
+ {
+ Argument.AssertNotNull(headParameter, nameof(headParameter));
+ Argument.AssertNotNull(queryParameter, nameof(queryParameter));
+
+ return SayHi(headParameter, queryParameter, optionalQuery, null);
+ }
+
+ /// Return hi.
+ ///
+ ///
+ ///
+ /// or is null.
+ /// Service returned a non-success status code.
+ public virtual async Task SayHiAsync(string headParameter, string queryParameter, string optionalQuery)
+ {
+ Argument.AssertNotNull(headParameter, nameof(headParameter));
+ Argument.AssertNotNull(queryParameter, nameof(queryParameter));
+
+ return await SayHiAsync(headParameter, queryParameter, optionalQuery, null).ConfigureAwait(false);
+ }
+
internal PipelineMessage CreateHelloAgainRequest(string p1, string p2, BinaryContent content, RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -126,6 +155,38 @@ public virtual async Task HelloAgainAsync(string p1, string p2, Bi
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// Return hi again.
+ ///
+ ///
+ ///
+ /// , or is null.
+ /// Service returned a non-success status code.
+ public virtual ClientResult HelloAgain(string p1, string p2, RoundTripModel action)
+ {
+ Argument.AssertNotNull(p1, nameof(p1));
+ Argument.AssertNotNull(p2, nameof(p2));
+ Argument.AssertNotNull(action, nameof(action));
+
+ ClientResult result = HelloAgain(p1, p2, action, null);
+ return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse());
+ }
+
+ /// Return hi again.
+ ///
+ ///
+ ///
+ /// , or is null.
+ /// Service returned a non-success status code.
+ public virtual async Task HelloAgainAsync(string p1, string p2, RoundTripModel action)
+ {
+ Argument.AssertNotNull(p1, nameof(p1));
+ Argument.AssertNotNull(p2, nameof(p2));
+ Argument.AssertNotNull(action, nameof(action));
+
+ ClientResult result = await HelloAgainAsync(p1, p2, action, null).ConfigureAwait(false);
+ return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse());
+ }
+
internal PipelineMessage CreateNoContentTypeRequest(string p1, string p2, BinaryContent content, RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -179,6 +240,38 @@ public virtual async Task NoContentTypeAsync(string p1, string p2,
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// Return hi again.
+ ///
+ ///
+ ///
+ /// , or is null.
+ /// Service returned a non-success status code.
+ public virtual ClientResult NoContentType(string p1, string p2, RoundTripModel action)
+ {
+ Argument.AssertNotNull(p1, nameof(p1));
+ Argument.AssertNotNull(p2, nameof(p2));
+ Argument.AssertNotNull(action, nameof(action));
+
+ ClientResult result = NoContentType(p1, p2, action, null);
+ return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse());
+ }
+
+ /// Return hi again.
+ ///
+ ///
+ ///
+ /// , or is null.
+ /// Service returned a non-success status code.
+ public virtual async Task NoContentTypeAsync(string p1, string p2, RoundTripModel action)
+ {
+ Argument.AssertNotNull(p1, nameof(p1));
+ Argument.AssertNotNull(p2, nameof(p2));
+ Argument.AssertNotNull(action, nameof(action));
+
+ ClientResult result = await NoContentTypeAsync(p1, p2, action, null).ConfigureAwait(false);
+ return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse());
+ }
+
internal PipelineMessage CreateHelloDemo2Request(RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -218,6 +311,20 @@ public virtual async Task HelloDemo2Async(RequestOptions options)
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// Return hi in demo2.
+ /// Service returned a non-success status code.
+ public virtual ClientResult HelloDemo2()
+ {
+ return HelloDemo2(null);
+ }
+
+ /// Return hi in demo2.
+ /// Service returned a non-success status code.
+ public virtual async Task HelloDemo2Async()
+ {
+ return await HelloDemo2Async(null).ConfigureAwait(false);
+ }
+
internal PipelineMessage CreateCreateLiteralRequest(BinaryContent content, RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -259,6 +366,30 @@ public virtual async Task CreateLiteralAsync(BinaryContent content
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// Create with literal value.
+ ///
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual ClientResult CreateLiteral(Thing body)
+ {
+ Argument.AssertNotNull(body, nameof(body));
+
+ ClientResult result = CreateLiteral(body, null);
+ return ClientResult.FromValue((Thing)result, result.GetRawResponse());
+ }
+
+ /// Create with literal value.
+ ///
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual async Task CreateLiteralAsync(Thing body)
+ {
+ Argument.AssertNotNull(body, nameof(body));
+
+ ClientResult result = await CreateLiteralAsync(body, null).ConfigureAwait(false);
+ return ClientResult.FromValue((Thing)result, result.GetRawResponse());
+ }
+
internal PipelineMessage CreateHelloLiteralRequest(RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -298,6 +429,20 @@ public virtual async Task HelloLiteralAsync(RequestOptions options
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// Send literal parameters.
+ /// Service returned a non-success status code.
+ public virtual ClientResult HelloLiteral()
+ {
+ return HelloLiteral(null);
+ }
+
+ /// Send literal parameters.
+ /// Service returned a non-success status code.
+ public virtual async Task HelloLiteralAsync()
+ {
+ return await HelloLiteralAsync(null).ConfigureAwait(false);
+ }
+
internal PipelineMessage CreateTopActionRequest(DateTimeOffset action, RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -345,6 +490,28 @@ public virtual async Task TopActionAsync(DateTimeOffset action, Re
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// top level method.
+ ///
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual ClientResult TopAction(DateTimeOffset action)
+ {
+ Argument.AssertNotNull(action, nameof(action));
+
+ return TopAction(action, null);
+ }
+
+ /// top level method.
+ ///
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual async Task TopActionAsync(DateTimeOffset action)
+ {
+ Argument.AssertNotNull(action, nameof(action));
+
+ return await TopActionAsync(action, null).ConfigureAwait(false);
+ }
+
internal PipelineMessage CreateTopAction2Request(RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -384,6 +551,20 @@ public virtual async Task TopAction2Async(RequestOptions options)
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// top level method2.
+ /// Service returned a non-success status code.
+ public virtual ClientResult TopAction2()
+ {
+ return TopAction2(null);
+ }
+
+ /// top level method2.
+ /// Service returned a non-success status code.
+ public virtual async Task TopAction2Async()
+ {
+ return await TopAction2Async(null).ConfigureAwait(false);
+ }
+
internal PipelineMessage CreatePatchActionRequest(BinaryContent content, RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -425,6 +606,30 @@ public virtual async Task PatchActionAsync(BinaryContent content,
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// top level patch.
+ ///
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual ClientResult PatchAction(Thing body)
+ {
+ Argument.AssertNotNull(body, nameof(body));
+
+ ClientResult result = PatchAction(body, null);
+ return ClientResult.FromValue((Thing)result, result.GetRawResponse());
+ }
+
+ /// top level patch.
+ ///
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual async Task PatchActionAsync(Thing body)
+ {
+ Argument.AssertNotNull(body, nameof(body));
+
+ ClientResult result = await PatchActionAsync(body, null).ConfigureAwait(false);
+ return ClientResult.FromValue((Thing)result, result.GetRawResponse());
+ }
+
internal PipelineMessage CreateAnonymousBodyRequest(BinaryContent content, RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -466,6 +671,30 @@ public virtual async Task AnonymousBodyAsync(BinaryContent content
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// body parameter without body decorator.
+ /// A model with a few properties of literal types.
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual ClientResult AnonymousBody(Thing Thing)
+ {
+ Argument.AssertNotNull(Thing, nameof(Thing));
+
+ ClientResult result = AnonymousBody(Thing, null);
+ return ClientResult.FromValue((Thing)result, result.GetRawResponse());
+ }
+
+ /// body parameter without body decorator.
+ /// A model with a few properties of literal types.
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual async Task AnonymousBodyAsync(Thing Thing)
+ {
+ Argument.AssertNotNull(Thing, nameof(Thing));
+
+ ClientResult result = await AnonymousBodyAsync(Thing, null).ConfigureAwait(false);
+ return ClientResult.FromValue((Thing)result, result.GetRawResponse());
+ }
+
internal PipelineMessage CreateFriendlyModelRequest(BinaryContent content, RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -507,6 +736,30 @@ public virtual async Task FriendlyModelAsync(BinaryContent content
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// Model can have its friendly name.
+ /// this is not a friendly model but with a friendly name.
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual ClientResult FriendlyModel(Friend Friend)
+ {
+ Argument.AssertNotNull(Friend, nameof(Friend));
+
+ ClientResult result = FriendlyModel(Friend, null);
+ return ClientResult.FromValue((Friend)result, result.GetRawResponse());
+ }
+
+ /// Model can have its friendly name.
+ /// this is not a friendly model but with a friendly name.
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual async Task FriendlyModelAsync(Friend Friend)
+ {
+ Argument.AssertNotNull(Friend, nameof(Friend));
+
+ ClientResult result = await FriendlyModelAsync(Friend, null).ConfigureAwait(false);
+ return ClientResult.FromValue((Friend)result, result.GetRawResponse());
+ }
+
internal PipelineMessage CreateAddTimeHeaderRequest(DateTimeOffset repeatabilityFirstSent, RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -548,6 +801,22 @@ public virtual async Task AddTimeHeaderAsync(DateTimeOffset repeat
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// addTimeHeader.
+ ///
+ /// Service returned a non-success status code.
+ public virtual ClientResult AddTimeHeader(DateTimeOffset repeatabilityFirstSent)
+ {
+ return AddTimeHeader(repeatabilityFirstSent, null);
+ }
+
+ /// addTimeHeader.
+ ///
+ /// Service returned a non-success status code.
+ public virtual async Task AddTimeHeaderAsync(DateTimeOffset repeatabilityFirstSent)
+ {
+ return await AddTimeHeaderAsync(repeatabilityFirstSent, null).ConfigureAwait(false);
+ }
+
internal PipelineMessage CreateProjectedNameModelRequest(BinaryContent content, RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -589,6 +858,30 @@ public virtual async Task ProjectedNameModelAsync(BinaryContent co
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// Model can have its projected name.
+ /// this is a model with a projected name.
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual ClientResult ProjectedNameModel(ProjectedModel ProjectedModel)
+ {
+ Argument.AssertNotNull(ProjectedModel, nameof(ProjectedModel));
+
+ ClientResult result = ProjectedNameModel(ProjectedModel, null);
+ return ClientResult.FromValue((ProjectedModel)result, result.GetRawResponse());
+ }
+
+ /// Model can have its projected name.
+ /// this is a model with a projected name.
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual async Task ProjectedNameModelAsync(ProjectedModel ProjectedModel)
+ {
+ Argument.AssertNotNull(ProjectedModel, nameof(ProjectedModel));
+
+ ClientResult result = await ProjectedNameModelAsync(ProjectedModel, null).ConfigureAwait(false);
+ return ClientResult.FromValue((ProjectedModel)result, result.GetRawResponse());
+ }
+
internal PipelineMessage CreateReturnsAnonymousModelRequest(RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -628,6 +921,20 @@ public virtual async Task ReturnsAnonymousModelAsync(RequestOption
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// return anonymous model.
+ /// Service returned a non-success status code.
+ public virtual ClientResult ReturnsAnonymousModel()
+ {
+ return ReturnsAnonymousModel(null);
+ }
+
+ /// return anonymous model.
+ /// Service returned a non-success status code.
+ public virtual async Task ReturnsAnonymousModelAsync()
+ {
+ return await ReturnsAnonymousModelAsync(null).ConfigureAwait(false);
+ }
+
internal PipelineMessage CreateGetUnknownValueRequest(RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -667,6 +974,20 @@ public virtual async Task GetUnknownValueAsync(RequestOptions opti
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// get extensible enum.
+ /// Service returned a non-success status code.
+ public virtual ClientResult GetUnknownValue()
+ {
+ return GetUnknownValue(null);
+ }
+
+ /// get extensible enum.
+ /// Service returned a non-success status code.
+ public virtual async Task GetUnknownValueAsync()
+ {
+ return await GetUnknownValueAsync(null).ConfigureAwait(false);
+ }
+
internal PipelineMessage CreateInternalProtocolRequest(BinaryContent content, RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -708,6 +1029,30 @@ public virtual async Task InternalProtocolAsync(BinaryContent cont
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// When set protocol false and convenient true, then the protocol method should be internal.
+ ///
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual ClientResult InternalProtocol(Thing body)
+ {
+ Argument.AssertNotNull(body, nameof(body));
+
+ ClientResult result = InternalProtocol(body, null);
+ return ClientResult.FromValue((Thing)result, result.GetRawResponse());
+ }
+
+ /// When set protocol false and convenient true, then the protocol method should be internal.
+ ///
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual async Task InternalProtocolAsync(Thing body)
+ {
+ Argument.AssertNotNull(body, nameof(body));
+
+ ClientResult result = await InternalProtocolAsync(body, null).ConfigureAwait(false);
+ return ClientResult.FromValue((Thing)result, result.GetRawResponse());
+ }
+
internal PipelineMessage CreateStillConvenientRequest(RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -747,6 +1092,20 @@ public virtual async Task StillConvenientAsync(RequestOptions opti
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+ /// When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one.
+ /// Service returned a non-success status code.
+ public virtual ClientResult StillConvenient()
+ {
+ return StillConvenient(null);
+ }
+
+ /// When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one.
+ /// Service returned a non-success status code.
+ public virtual async Task StillConvenientAsync()
+ {
+ return await StillConvenientAsync(null).ConfigureAwait(false);
+ }
+
internal PipelineMessage CreateHeadAsBooleanRequest(string id, RequestOptions options)
{
throw new NotImplementedException("Method not implemented.");
@@ -793,5 +1152,27 @@ public virtual async Task HeadAsBooleanAsync(string id, RequestOpt
using PipelineMessage message = CreateHeadAsBooleanRequest(id, options);
return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
}
+
+ /// head as boolean.
+ ///
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual ClientResult HeadAsBoolean(string id)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+
+ return HeadAsBoolean(id, null);
+ }
+
+ /// head as boolean.
+ ///
+ /// is null.
+ /// Service returned a non-success status code.
+ public virtual async Task HeadAsBooleanAsync(string id)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+
+ return await HeadAsBooleanAsync(id, null).ConfigureAwait(false);
+ }
}
}