-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.Net: Allow customization of building REST API operation URL, payload…
…, and headers (#9985) ### Motivation and Context CopilotAgentPlugin functionality may need more control over the way url, headers and payload are created. ### Description This PR adds internal factories for creating URLs, headers, and payloads. The factories are kept internal because the necessity of having them and their structure may change in the future.
- Loading branch information
1 parent
7c25ac4
commit 6d02eef
Showing
6 changed files
with
199 additions
and
8 deletions.
There are no files selected for viewing
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
14 changes: 14 additions & 0 deletions
14
dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationHeadersFactory.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,14 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.SemanticKernel.Plugins.OpenApi; | ||
|
||
/// <summary> | ||
/// Represents a delegate for creating headers for a REST API operation. | ||
/// </summary> | ||
/// <param name="operation">The REST API operation.</param> | ||
/// <param name="arguments">The arguments for the operation.</param> | ||
/// <param name="options">The operation run options.</param> | ||
/// <returns>The operation headers.</returns> | ||
internal delegate IDictionary<string, string>? RestApiOperationHeadersFactory(RestApiOperation operation, IDictionary<string, object?> arguments, RestApiOperationRunOptions? options); |
23 changes: 23 additions & 0 deletions
23
dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationPayloadFactory.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,23 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System.Collections.Generic; | ||
using System.Net.Http; | ||
|
||
namespace Microsoft.SemanticKernel.Plugins.OpenApi; | ||
|
||
/// <summary> | ||
/// Represents a delegate for creating a payload for a REST API operation. | ||
/// </summary> | ||
/// <param name="operation">The REST API operation.</param> | ||
/// <param name="arguments">The arguments for the operation.</param> | ||
/// <param name="enableDynamicPayload"> | ||
/// Determines whether the operation payload is constructed dynamically based on operation payload metadata. | ||
/// If false, the operation payload must be provided via the 'payload' property. | ||
/// </param> | ||
/// <param name="enablePayloadNamespacing"> | ||
/// Determines whether payload parameters are resolved from the arguments by | ||
/// full name (parameter name prefixed with the parent property name). | ||
/// </param> | ||
/// <param name="options">The operation run options.</param> | ||
/// <returns>The operation payload.</returns> | ||
internal delegate (object Payload, HttpContent Content)? RestApiOperationPayloadFactory(RestApiOperation operation, IDictionary<string, object?> arguments, bool enableDynamicPayload, bool enablePayloadNamespacing, RestApiOperationRunOptions? options); |
15 changes: 15 additions & 0 deletions
15
dotnet/src/Functions/Functions.OpenApi/Model/RestApiOperationUrlFactory.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,15 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.SemanticKernel.Plugins.OpenApi; | ||
|
||
/// <summary> | ||
/// Represents a delegate for creating a URL for a REST API operation. | ||
/// </summary> | ||
/// <param name="operation">The REST API operation.</param> | ||
/// <param name="arguments">The arguments for the operation.</param> | ||
/// <param name="options">The operation run options.</param> | ||
/// <returns>The operation URL.</returns> | ||
internal delegate Uri? RestApiOperationUrlFactory(RestApiOperation operation, IDictionary<string, object?> arguments, RestApiOperationRunOptions? options); |
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