Skip to content

Commit

Permalink
RestAPI: Move to Skills.OpenApi package (#887)
Browse files Browse the repository at this point in the history
### Description
Moving the RestAPI* classes back into the Skills.OpenAPI package, where
they can remain as internals. This aligns with the Skills.Grpc format as
well.
  • Loading branch information
shawncal authored May 10, 2023
1 parent 1a78633 commit b274f6d
Show file tree
Hide file tree
Showing 21 changed files with 24 additions and 50 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
using System.Net.Http;
using System.Threading.Tasks;

namespace Microsoft.SemanticKernel.Connectors.WebApi.Rest;
namespace Microsoft.SemanticKernel.Skills.OpenAPI.Authentication;

public delegate Task AuthenticateRequestAsyncCallback(HttpRequestMessage request);
2 changes: 1 addition & 1 deletion dotnet/src/Skills/Skills.OpenAPI/Authentication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The Semantic Kernel OpenAPI Skill enables developers to take any REST API that f

## The `AuthenticateRequestAsyncCallback` delegate

[`AuthenticateRequestAsyncCallback`](../../../SemanticKernel.Abstractions/Connectors/WebApi/Rest/AuthenticateRequestAsyncCallback.cs) is a delegate type that serves as a callback function for adding authentication information to HTTP requests sent by the OpenAPI skill.
[`AuthenticateRequestAsyncCallback`](AuthenticateRequestAsyncCallback.cs) is a delegate type that serves as a callback function for adding authentication information to HTTP requests sent by the OpenAPI skill.

```csharp
public delegate Task AuthenticateRequestAsyncCallback(HttpRequestMessage request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest;
using Microsoft.SemanticKernel.Diagnostics;
using Microsoft.SemanticKernel.Reliability;
using Microsoft.SemanticKernel.SkillDefinition;
using Microsoft.SemanticKernel.Skills.OpenAPI.Authentication;
using Microsoft.SemanticKernel.Skills.OpenAPI.Skills;

#pragma warning disable IDE0130
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
using Microsoft.SemanticKernel.Diagnostics;
using Microsoft.SemanticKernel.Orchestration;
using Microsoft.SemanticKernel.Reliability;
using Microsoft.SemanticKernel.SkillDefinition;
using Microsoft.SemanticKernel.Skills.OpenAPI;
using Microsoft.SemanticKernel.Skills.OpenAPI.Authentication;
using Microsoft.SemanticKernel.Skills.OpenAPI.Model;
using Microsoft.SemanticKernel.Skills.OpenAPI.OpenApi;
using Microsoft.SemanticKernel.Skills.OpenAPI.Skills;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Net.Http;
using System.Text.RegularExpressions;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;

#pragma warning disable IDE0130
// ReSharper disable once CheckNamespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Text.RegularExpressions;
using System.Web;

namespace Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
namespace Microsoft.SemanticKernel.Skills.OpenAPI.Model;

/// <summary>
/// The REST API operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using System;

namespace Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
namespace Microsoft.SemanticKernel.Skills.OpenAPI.Model;

/// <summary>
/// Exception to be throw if a REST API operation has failed. E.g. mandatory property is missing or empty, value is out of range
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.

namespace Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
namespace Microsoft.SemanticKernel.Skills.OpenAPI.Model;

/// <summary>
/// The REST API operation parameter.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.

namespace Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
namespace Microsoft.SemanticKernel.Skills.OpenAPI.Model;

/// <summary>
/// The REST API operation parameter location.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.

namespace Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
namespace Microsoft.SemanticKernel.Skills.OpenAPI.Model;

/// <summary>
/// The REST API operation parameter style.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using System.Collections.Generic;

namespace Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
namespace Microsoft.SemanticKernel.Skills.OpenAPI.Model;

/// <summary>
/// The REST API operation payload.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using System.Collections.Generic;

namespace Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
namespace Microsoft.SemanticKernel.Skills.OpenAPI.Model;

/// <summary>
/// The REST API operation payload property.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
using Microsoft.SemanticKernel.Skills.OpenAPI.Model;

namespace Microsoft.SemanticKernel.Skills.OpenAPI.OpenApi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Readers;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
using Microsoft.SemanticKernel.Diagnostics;
using Microsoft.SemanticKernel.Skills.OpenAPI.Model;
using Microsoft.SemanticKernel.Text;

namespace Microsoft.SemanticKernel.Skills.OpenAPI.OpenApi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
using System.Text.Json.Nodes;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
using Microsoft.SemanticKernel.Skills.OpenAPI.Authentication;
using Microsoft.SemanticKernel.Skills.OpenAPI.Model;

namespace Microsoft.SemanticKernel.Connectors.WebApi.Rest;
namespace Microsoft.SemanticKernel.Skills.OpenAPI;

/// <summary>
/// Runs REST API operation represented by RestApiOperation model class.
/// </summary>
public sealed class RestApiOperationRunner : IRestApiOperationRunner
internal sealed class RestApiOperationRunner
{
private const string MediaTypeApplicationJson = "application/json";
private const string MediaTypeTextPlain = "text/plain";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
using System.Text.Json.Nodes;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
using Microsoft.SemanticKernel.Skills.OpenAPI;
using Microsoft.SemanticKernel.Skills.OpenAPI.Authentication;
using Microsoft.SemanticKernel.Skills.OpenAPI.Model;
using Moq;
using Xunit;

namespace SemanticKernel.UnitTests.Connectors.WebApi.Rest;
namespace SemanticKernel.Skills.UnitTests.Connectors.WebApi.Rest;

public sealed class RestApiOperationRunnerTests : IDisposable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using System.Collections.Generic;
using System.Net.Http;
using System.Web;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
using Microsoft.SemanticKernel.Skills.OpenAPI.Model;
using Xunit;

namespace SemanticKernel.UnitTests.Connectors.WebApi.Rest;
namespace SemanticKernel.Skills.UnitTests.Connectors.WebApi.Rest;

public class RestApiOperationTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
using Microsoft.SemanticKernel.Skills.OpenAPI.Model;
using Microsoft.SemanticKernel.Skills.OpenAPI.OpenApi;
using SemanticKernel.Skills.UnitTests.OpenAPI.TestSkills;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
using Microsoft.SemanticKernel.Skills.OpenAPI.Model;
using Microsoft.SemanticKernel.Skills.OpenAPI.OpenApi;
using SemanticKernel.Skills.UnitTests.OpenAPI.TestSkills;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.SemanticKernel.Connectors.WebApi.Rest.Model;
using Microsoft.SemanticKernel.Skills.OpenAPI.Model;
using Microsoft.SemanticKernel.Skills.OpenAPI.OpenApi;
using SemanticKernel.Skills.UnitTests.OpenAPI.TestSkills;
Expand Down

0 comments on commit b274f6d

Please sign in to comment.