-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Dabarger/local search api #4962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
shahabhijeet
merged 6 commits into
Azure:psSdkJson6
from
davidbargeron:dabarger/local_search_api
Oct 31, 2018
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5cafc32
Add C# client SDK for Bing Local Search API.
2c6dc14
added generate.cmd
6b54294
update ErrorResponse.cs limited to "Errors" field only.
d7f59dc
update BingLocalSearch.Tests project to build a class library rather …
648c118
regenerated from the checked-in Swagger spec. Disabled tests. Added g…
8211626
deleted <ItemGroup> lines 25-28, added release notes.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/SDKs/CognitiveServices/dataPlane/Search/BingLocalSearch/AzSdk.RP.props
This file contains hidden or 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 @@ | ||
| <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!--This file and it's contents are updated at build time moving or editing might result in build failure. Take due deligence while editing this file--> | ||
| <PropertyGroup> | ||
| <AzureApiTag /> | ||
| <PackageTags>$(PackageTags);$(CommonTags);$(AzureApiTag);</PackageTags> | ||
| </PropertyGroup> | ||
| </Project> |
18 changes: 18 additions & 0 deletions
18
...vices/dataPlane/Search/BingLocalSearch/BingLocalSearch.Tests/BingLocalSearch.Tests.csproj
This file contains hidden or 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,18 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>netcoreapp2.1</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.Azure.Test.HttpRecorder" Version="1.13.1" /> | ||
| <PackageReference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework" Version="1.7.5" /> | ||
| <PackageReference Include="xunit" Version="2.4.1" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\BingLocalSearch\BingLocalSearch.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
33 changes: 33 additions & 0 deletions
33
...nitiveServices/dataPlane/Search/BingLocalSearch/BingLocalSearch.Tests/LocalSearchTests.cs
This file contains hidden or 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 Microsoft.Azure.Test.HttpRecorder; | ||
| using Microsoft.Azure.CognitiveServices.Search.LocalSearch; | ||
| using Microsoft.Azure.CognitiveServices.Search.LocalSearch.Models; | ||
| using Microsoft.Rest.ClientRuntime.Azure.TestFramework; | ||
| using System.Linq; | ||
| using Xunit; | ||
|
|
||
| namespace SearchSDK.Tests | ||
| { | ||
| public class LocalSearchTests | ||
| { | ||
| private static string SubscriptionKey = "fake"; | ||
|
|
||
| [Fact] | ||
| public void LocalSearch() | ||
| { | ||
| using (MockContext context = MockContext.Start(this.GetType().FullName)) | ||
| { | ||
| HttpMockServer.Initialize(this.GetType().FullName, "LocalSearch"); | ||
|
|
||
| ILocalSearchClient client = new LocalSearchClient(new ApiKeyServiceClientCredentials(SubscriptionKey), HttpMockServer.CreateInstance()); | ||
|
|
||
| var resp = client.Local.Search(query: "restaurants"); | ||
|
|
||
| Assert.NotNull(resp); | ||
| Assert.NotNull(resp.QueryContext); | ||
| Assert.NotNull(resp.Places); | ||
| Assert.NotNull(resp.Places.Value); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
31 changes: 31 additions & 0 deletions
31
src/SDKs/CognitiveServices/dataPlane/Search/BingLocalSearch/BingLocalSearch.sln
This file contains hidden or 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,31 @@ | ||
| | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio 15 | ||
| VisualStudioVersion = 15.0.28010.2019 | ||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BingLocalSearch.Tests", "BingLocalSearch.Tests\BingLocalSearch.Tests.csproj", "{0C8C39DB-5EF8-473C-904D-C05068B725A0}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BingLocalSearch", "BingLocalSearch\BingLocalSearch.csproj", "{E9CFAA11-ADCB-4CE6-8478-ECC4753E7E8F}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Release|Any CPU = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {0C8C39DB-5EF8-473C-904D-C05068B725A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {0C8C39DB-5EF8-473C-904D-C05068B725A0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {0C8C39DB-5EF8-473C-904D-C05068B725A0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {0C8C39DB-5EF8-473C-904D-C05068B725A0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {E9CFAA11-ADCB-4CE6-8478-ECC4753E7E8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {E9CFAA11-ADCB-4CE6-8478-ECC4753E7E8F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {E9CFAA11-ADCB-4CE6-8478-ECC4753E7E8F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {E9CFAA11-ADCB-4CE6-8478-ECC4753E7E8F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
| EndGlobalSection | ||
| GlobalSection(ExtensibilityGlobals) = postSolution | ||
| SolutionGuid = {8D427FAB-986B-4B80-8831-4C6B4FCD87F0} | ||
| EndGlobalSection | ||
| EndGlobal |
93 changes: 93 additions & 0 deletions
93
...CognitiveServices/dataPlane/Search/BingLocalSearch/BingLocalSearch/BingLocalSearch.csproj
This file contains hidden or 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,93 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
|
davidbargeron marked this conversation as resolved.
Outdated
|
||
| <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
| <PropertyGroup> | ||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
| <ProjectGuid>{E9CFAA11-ADCB-4CE6-8478-ECC4753E7E8F}</ProjectGuid> | ||
| <OutputType>Library</OutputType> | ||
| <AppDesignerFolder>Properties</AppDesignerFolder> | ||
| <RootNamespace>BingLocalSearch</RootNamespace> | ||
| <AssemblyName>BingLocalSearch</AssemblyName> | ||
| <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> | ||
| <FileAlignment>512</FileAlignment> | ||
| <Deterministic>true</Deterministic> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
| <DebugSymbols>true</DebugSymbols> | ||
| <DebugType>full</DebugType> | ||
| <Optimize>false</Optimize> | ||
| <OutputPath>bin\Debug\</OutputPath> | ||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
| <ErrorReport>prompt</ErrorReport> | ||
| <WarningLevel>4</WarningLevel> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
| <DebugType>pdbonly</DebugType> | ||
| <Optimize>true</Optimize> | ||
| <OutputPath>bin\Release\</OutputPath> | ||
| <DefineConstants>TRACE</DefineConstants> | ||
| <ErrorReport>prompt</ErrorReport> | ||
| <WarningLevel>4</WarningLevel> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
| <HintPath>..\packages\Microsoft.Rest.ClientRuntime.2.3.17\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath> | ||
| </Reference> | ||
| <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | ||
| <HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath> | ||
| </Reference> | ||
| <Reference Include="System" /> | ||
| <Reference Include="System.Core" /> | ||
| <Reference Include="System.Net" /> | ||
| <Reference Include="System.Net.Http.WebRequest" /> | ||
| <Reference Include="System.Runtime" /> | ||
| <Reference Include="System.Runtime.Serialization" /> | ||
| <Reference Include="System.Xml.Linq" /> | ||
| <Reference Include="System.Data.DataSetExtensions" /> | ||
| <Reference Include="Microsoft.CSharp" /> | ||
| <Reference Include="System.Data" /> | ||
| <Reference Include="System.Net.Http" /> | ||
| <Reference Include="System.Xml" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <Compile Include="Customizations\ApiKeyServiceClientCredentials.cs" /> | ||
| <Compile Include="Generated\LocalSearch\ILocal.cs" /> | ||
| <Compile Include="Generated\LocalSearch\ILocalSearchClient.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Local.cs" /> | ||
| <Compile Include="Generated\LocalSearch\LocalExtensions.cs" /> | ||
| <Compile Include="Generated\LocalSearch\LocalSearchClient.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\Action.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\Answer.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\CreativeWork.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\EntitiesEntityPresentationInfo.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\EntityScenario.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\EntityType.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\Error.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\ErrorCode.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\ErrorResponse.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\ErrorResponseException.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\ErrorSubCode.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\GeoCoordinates.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\Identifiable.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\Intangible.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\Place.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\Places.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\PostalAddress.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\QueryContext.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\Response.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\ResponseBase.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\ResponseFormat.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\SafeSearch.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\SearchAction.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\SearchResponse.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\SearchResultsAnswer.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\StructuredValue.cs" /> | ||
| <Compile Include="Generated\LocalSearch\Models\Thing.cs" /> | ||
| <Compile Include="Properties\AssemblyInfo.cs" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <None Include="packages.config" /> | ||
| </ItemGroup> | ||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
| </Project> | ||
43 changes: 43 additions & 0 deletions
43
...e/Search/BingLocalSearch/BingLocalSearch/Customizations/ApiKeyServiceClientCredentials.cs
This file contains hidden or 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,43 @@ | ||
| namespace Microsoft.Azure.CognitiveServices.Search.LocalSearch | ||
| { | ||
| 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) | ||
| { | ||
| if (string.IsNullOrWhiteSpace(subscriptionKey)) | ||
| throw new ArgumentNullException("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); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.