-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regenerate Face/ComputerVision SDK with latest spec and update the un…
…it tests, separate Face/CV aligning with other Vision APIs. (#3977)
- Loading branch information
1 parent
358e413
commit c95d9ea
Showing
159 changed files
with
2,055 additions
and
2,160 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/SDKs/CognitiveServices/dataPlane/Vision/ComputerVision/ComputerVision.Tests/BaseTests.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,28 @@ | ||
using Microsoft.Azure.CognitiveServices.Vision.ComputerVision; | ||
using System.Net.Http; | ||
using Vision = Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models; | ||
|
||
namespace ComputerVisionSDK.Tests | ||
{ | ||
public abstract class BaseTests | ||
{ | ||
public static bool IsTestTenant = false; | ||
private static readonly string ComputerVisionSubscriptionKey; | ||
|
||
static BaseTests() | ||
{ | ||
// Retrieve the configuration information. | ||
ComputerVisionSubscriptionKey = ""; | ||
} | ||
|
||
protected IComputerVisionAPI GetComputerVisionClient(DelegatingHandler handler) | ||
{ | ||
IComputerVisionAPI client = new ComputerVisionAPI(new ApiKeyServiceClientCredentials(ComputerVisionSubscriptionKey), handlers: handler) | ||
{ | ||
AzureRegion = Vision.AzureRegions.Westus | ||
}; | ||
|
||
return client; | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...ComputerVision.Tests/Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Tests.csproj
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,37 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('AzSdk.test.reference.props'))" /> | ||
<PropertyGroup> | ||
<Description>Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Tests Class Library</Description> | ||
<AssemblyName>Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Tests</AssemblyName> | ||
<VersionPrefix>1.0.2-preview</VersionPrefix> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp1.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="1.6.0-preview" /> | ||
<ProjectReference Include="..\ComputerVision\Microsoft.Azure.CognitiveServices.Vision.ComputerVision.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="SessionRecords\**\*.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="TestImages\*.jpg"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="TestImages\*.png"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
<None Update="testsettings.json"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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
File renamed without changes
7 changes: 2 additions & 5 deletions
7
...Vision/Vision.Tests/VisionAnalyzeTests.cs → ...omputerVision.Tests/VisionAnalyzeTests.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
28 changes: 28 additions & 0 deletions
28
src/SDKs/CognitiveServices/dataPlane/Vision/ComputerVision/ComputerVision.sln
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,28 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.26430.16 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.CognitiveServices.Vision.ComputerVision", "ComputerVision\Microsoft.Azure.CognitiveServices.Vision.ComputerVision.csproj", "{6807B854-8528-4FEE-A25D-C43C3AA2D601}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Tests", "ComputerVision.Tests\Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Tests.csproj", "{5987D97A-E532-450C-BF22-A1F595C927F1}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6807B854-8528-4FEE-A25D-C43C3AA2D601}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6807B854-8528-4FEE-A25D-C43C3AA2D601}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6807B854-8528-4FEE-A25D-C43C3AA2D601}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6807B854-8528-4FEE-A25D-C43C3AA2D601}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{5987D97A-E532-450C-BF22-A1F595C927F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5987D97A-E532-450C-BF22-A1F595C927F1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5987D97A-E532-450C-BF22-A1F595C927F1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5987D97A-E532-450C-BF22-A1F595C927F1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
40 changes: 40 additions & 0 deletions
40
...ane/Vision/ComputerVision/ComputerVision/Customizations/ApiKeyServiceClientCredentials.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,40 @@ | ||
namespace Microsoft.Azure.CognitiveServices.Vision.ComputerVision | ||
{ | ||
using System; | ||
using System.Net.Http; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.Rest; | ||
|
||
/// <summary> | ||
/// Allows authentication to the API using a basic apiKey mechanism | ||
/// </summary> | ||
public class ApiKeyServiceClientCredentials : ServiceClientCredentials | ||
{ | ||
private readonly string subscriptionKey; | ||
|
||
/// <summary> | ||
/// Creates a new instance of the ApiKeyServiceClientCredentails class | ||
/// </summary> | ||
/// <param name="subscriptionKey">The subscription key to authenticate and authorize as</param> | ||
public ApiKeyServiceClientCredentials(string subscriptionKey) | ||
{ | ||
this.subscriptionKey = subscriptionKey; | ||
} | ||
|
||
/// <summary> | ||
/// Add the Basic Authentication Header to each outgoing request | ||
/// </summary> | ||
/// <param name="request">The outgoing request</param> | ||
/// <param name="cancellationToken">A token to cancel the operation</param> | ||
public override Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) | ||
{ | ||
if (request == null) | ||
throw new ArgumentNullException("request"); | ||
|
||
request.Headers.Add("Ocp-Apim-Subscription-Key", this.subscriptionKey); | ||
|
||
return Task.FromResult<object>(null); | ||
} | ||
} | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
...ces/dataPlane/Vision/ComputerVision/ComputerVision/Generated/SdkInfo_ComputerVisionAPI.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 @@ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
internal static partial class SdkInfo | ||
{ | ||
public static IEnumerable<Tuple<string, string, string>> ApiInfo_ComputerVisionAPI | ||
{ | ||
get | ||
{ | ||
return new Tuple<string, string, string>[] | ||
{ | ||
new Tuple<string, string, string>("ComputerVisionAPI", "AnalyzeImage", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "AnalyzeImageByDomain", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "AnalyzeImageByDomainInStream", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "AnalyzeImageInStream", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "DescribeImage", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "DescribeImageInStream", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "GenerateThumbnail", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "GenerateThumbnailInStream", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "GetTextOperationResult", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "ListModels", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "RecognizePrintedText", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "RecognizePrintedTextInStream", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "RecognizeText", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "RecognizeTextInStream", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "TagImage", "1.0"), | ||
new Tuple<string, string, string>("ComputerVisionAPI", "TagImageInStream", "1.0"), | ||
}.AsEnumerable(); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...puterVision/ComputerVision/Microsoft.Azure.CognitiveServices.Vision.ComputerVision.csproj
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,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<!-- Please do not move/edit code below this line --> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('AzSdk.reference.props'))" /> | ||
<!-- Please do not move/edit code above this line --> | ||
|
||
<PropertyGroup> | ||
<PackageId>Microsoft.Azure.CognitiveServices.Vision.ComputerVision</PackageId> | ||
<Description>This client library provides access to the Microsoft Cognitive Services ComputerVision APIs.</Description> | ||
<VersionPrefix>1.0.2-preview</VersionPrefix> | ||
<AssemblyName>Microsoft.Azure.CognitiveServices.Vision.ComputerVision</AssemblyName> | ||
<PackageTags>Microsoft Cognitive Services;Cognitive Services;Cognitive Services SDK;REST HTTP client;Computer Vision;Computer Vision API;Computer Vision SDK;Vision;netcore451511</PackageTags> | ||
<PackageReleaseNotes>This is a preview release of the Cognitive Services Computer Vision SDK.</PackageReleaseNotes> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net452;netstandard1.4</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<!-- Please do not move/edit code below this line --> | ||
<Import Condition=" Exists('$([MSBuild]::GetPathOfFileAbove(AzSdk.RP.props))') " Project="$([MSBuild]::GetPathOfFileAbove('AzSdk.RP.props'))" /> | ||
<!-- Please do not move/edit code above this line --> | ||
</Project> |
7 changes: 7 additions & 0 deletions
7
src/SDKs/CognitiveServices/dataPlane/Vision/ComputerVision/ComputerVision/generate.cmd
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,7 @@ | ||
:: | ||
:: Microsoft Azure SDK for Net - Generate library code | ||
:: Copyright (C) Microsoft Corporation. All Rights Reserved. | ||
:: | ||
|
||
@echo off | ||
call %~dp0..\..\..\..\..\..\..\tools\generate.cmd cognitiveservices/data-plane/ComputerVision %* |
28 changes: 28 additions & 0 deletions
28
src/SDKs/CognitiveServices/dataPlane/Vision/Face/Face.Tests/BaseTests.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,28 @@ | ||
using Microsoft.Azure.CognitiveServices.Vision.Face; | ||
using System.Net.Http; | ||
using Face = Microsoft.Azure.CognitiveServices.Vision.Face.Models; | ||
|
||
namespace FaceSDK.Tests | ||
{ | ||
public abstract class BaseTests | ||
{ | ||
public static bool IsTestTenant = false; | ||
private static readonly string FaceSubscriptionKey; | ||
|
||
static BaseTests() | ||
{ | ||
// Retrieve the configuration information. | ||
FaceSubscriptionKey = ""; | ||
} | ||
|
||
protected IFaceAPI GetFaceClient(DelegatingHandler handler) | ||
{ | ||
IFaceAPI client = new FaceAPI(new ApiKeyServiceClientCredentials(FaceSubscriptionKey), handlers: handler) | ||
{ | ||
AzureRegion = Face.AzureRegions.Westus | ||
}; | ||
|
||
return client; | ||
} | ||
} | ||
} |
Oops, something went wrong.