-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate expressions & statements from autorest (#3402)
This PR migrates the updates to the generator's expressions and statements from autorest. It also updates the existing SCM expressions to that of autorest's which including having to update to the System.ClientModel dependency to `1.1.0-beta.2` to pull in the new types.
- Loading branch information
1 parent
3c1c0d6
commit 3b4bd0b
Showing
32 changed files
with
116 additions
and
317 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...enerator/Microsoft.Generator.CSharp.ClientModel/src/Expressions/ClientResultExpression.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.ClientModel; | ||
using Microsoft.Generator.CSharp.Expressions; | ||
|
||
namespace Microsoft.Generator.CSharp.ClientModel.Expressions | ||
{ | ||
internal sealed record ClientResultExpression(ValueExpression Untyped) : TypedValueExpression<ClientResult>(Untyped) | ||
{ | ||
public ValueExpression Value => Property(nameof(ClientResult<object>.Value)); | ||
public BinaryDataExpression Content => throw new InvalidOperationException("Result does not have a Content property"); | ||
public StreamExpression ContentStream => throw new InvalidOperationException("Result does not have a ContentStream property"); | ||
|
||
public static ClientResultExpression FromResponse(PipelineResponseExpression response) | ||
=> new(InvokeStatic(nameof(ClientResult.FromResponse), response)); | ||
|
||
public static ClientResultExpression FromValue(ValueExpression value, PipelineResponseExpression response) | ||
=> new(InvokeStatic(nameof(ClientResult.FromValue), value, response)); | ||
|
||
public static ClientResultExpression FromValue(CSharpType explicitValueType, ValueExpression value, PipelineResponseExpression response) | ||
=> new(new InvokeStaticMethodExpression(typeof(ClientResult), nameof(ClientResult.FromValue), new[] { value, response }, new[] { explicitValueType })); | ||
|
||
public ClientResultExpression FromValue(ValueExpression value) | ||
=> new(new InvokeStaticMethodExpression(typeof(ClientResult), nameof(ClientResult.FromValue), new[] { value, this })); | ||
|
||
public ClientResultExpression FromValue(CSharpType explicitValueType, ValueExpression value) | ||
=> new(new InvokeStaticMethodExpression(typeof(ClientResult), nameof(ClientResult.FromValue), new[] { value, this }, new[] { explicitValueType })); | ||
|
||
public PipelineResponseExpression GetRawResponse() => new(Invoke(nameof(ClientResult<object>.GetRawResponse))); | ||
} | ||
} |
42 changes: 0 additions & 42 deletions
42
...rator/Microsoft.Generator.CSharp.ClientModel/src/Expressions/MessagePipelineExpression.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
...generator/Microsoft.Generator.CSharp.ClientModel/src/Expressions/RequestBodyExpression.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
...harp/generator/Microsoft.Generator.CSharp.ClientModel/src/Expressions/ResultExpression.cs
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
....CSharp.ClientModel/src/Expressions/SystemExtensibleSnippets.SystemJsonElementSnippets.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...erator/Microsoft.Generator.CSharp.ClientModel/src/Expressions/SystemExtensibleSnippets.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
...r/Microsoft.Generator.CSharp.ClientModel/src/Expressions/Utf8JsonRequestBodyExpression.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.