Skip to content

Commit

Permalink
[Azure Search] Adding missing documentation and test coverage
Browse files Browse the repository at this point in the history
[Azure Search] Adding missing documentation and test coverage
  • Loading branch information
dsgouda committed Jul 31, 2018
2 parents 1c28561 + 50989ce commit 3e28be5
Show file tree
Hide file tree
Showing 28 changed files with 1,172 additions and 748 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected static T Lookup(string name)
/// Compares the ExtensibleEnum for equality with another ExtensibleEnum.
/// </summary>
/// <param name="other">The ExtensibleEnum with which to compare.</param>
/// <returns>true if the ExtensibleEnum objects are equal; false otherwise.</returns>
/// <returns><c>true</c> if the ExtensibleEnum objects are equal; otherwise, <c>false</c>.</returns>
public bool Equals(T other)
{
if (object.ReferenceEquals(other, null))
Expand All @@ -81,13 +81,20 @@ public bool Equals(T other)
return this._name == other._name;
}

/// <inheritdoc />
/// <summary>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj)
{
return this.Equals(obj as T);
}

/// <inheritdoc />
/// <summary>
/// Serves as the default hash function.
/// </summary>
/// <returns>A hash code for the current object.</returns>
public override int GetHashCode()
{
return _name.GetHashCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ namespace Microsoft.Azure.Search
/// Credentials used to authenticate to an Azure Search service.
/// <see href="https://docs.microsoft.com/rest/api/searchservice/"/>
/// </summary>
/// <remarks>
/// See <see href="https://docs.microsoft.com/azure/search/search-security-api-keys"/> for more information about API keys in Azure Search.
/// </remarks>
public class SearchCredentials : ServiceClientCredentials
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Description>Common types needed by the Azure Search .NET libraries. This is not the package you are looking for; It is only meant to be used as a dependency.</Description>
<AssemblyTitle>Microsoft Azure Search Common Library</AssemblyTitle>
<AssemblyName>Microsoft.Azure.Search.Common</AssemblyName>
<VersionPrefix>5.0.1</VersionPrefix>
<Version>5.0.2</Version>
<PackageReleaseNotes>See the Microsoft.Azure.Search package for detailed release notes on the entire Azure Search .NET SDK.</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Reflection;

[assembly: AssemblyVersion("5.0.0.0")]
[assembly: AssemblyFileVersion("5.0.1.0")]
[assembly: AssemblyFileVersion("5.0.2.0")]

[assembly: AssemblyTitle("Microsoft Azure Search Common Library")]
[assembly: AssemblyDescription("Common types needed by the Azure Search .NET libraries. This is not the assembly you are looking for; It is only meant to be used as a dependency.")]
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ namespace Microsoft.Azure.Search
public partial interface ISearchIndexClient
{
/// <summary>
/// Gets the credentials used to authenticate to an Azure Search service.
/// Gets the credentials used to authenticate to an Azure Search service. This can be either a query API key or an admin API key.
/// </summary>
/// <remarks>
/// See <see href="https://docs.microsoft.com/azure/search/search-security-api-keys"/> for more information about API keys in Azure Search.
/// </remarks>
SearchCredentials SearchCredentials { get; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,25 @@ public SearchIndexClient(
Initialize(searchServiceName, indexName, credentials);
}

/// <inheritdoc />
/// <summary>
/// Gets the credentials used to authenticate to an Azure Search service. This can be either a query API key or an admin API key.
/// </summary>
/// <remarks>
/// See <see href="https://docs.microsoft.com/azure/search/search-security-api-keys"/> for more information about API keys in Azure Search.
/// </remarks>
public SearchCredentials SearchCredentials => (SearchCredentials)Credentials;

/// <inheritdoc />
/// <summary>
/// Indicates whether the index client should use HTTP GET for making Search and Suggest requests to the
/// Azure Search REST API. The default is <c>false</c>, which indicates that HTTP POST will be used.
/// </summary>
public bool UseHttpGetForQueries { get; set; }

/// <inheritdoc />
/// <summary>
/// Changes the BaseUri of this client to target a different index in the same Azure Search service. This method is NOT thread-safe; You
/// must guarantee that no other threads are using the client before calling it.
/// </summary>
/// <param name="newIndexName">The name of the index to which all subsequent requests should be sent.</param>
[Obsolete("This method is deprecated. Please set the IndexName property instead.")]
public void TargetDifferentIndex(string newIndexName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Description>Use this package if you're developing a .NET application using Azure Search, and you only need to query or update documents in your indexes. If you also need to create or update indexes, synonym maps, or other service-level resources, use the Microsoft.Azure.Search package instead.</Description>
<AssemblyTitle>Microsoft Azure Search Data Library</AssemblyTitle>
<AssemblyName>Microsoft.Azure.Search.Data</AssemblyName>
<VersionPrefix>5.0.1</VersionPrefix>
<Version>5.0.2</Version>
<PackageReleaseNotes>See the Microsoft.Azure.Search package for detailed release notes on the entire Azure Search .NET SDK.</PackageReleaseNotes>
</PropertyGroup>

Expand All @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Spatial" Version="7.2.0" />
<PackageReference Include="Microsoft.Azure.Search.Common" Version="[5.0.1, 6.0.0)" />
<PackageReference Include="Microsoft.Azure.Search.Common" Version="[5.0.2, 6.0.0)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Azure.Search.Common\Microsoft.Azure.Search.Common.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Runtime.CompilerServices;

[assembly: AssemblyVersion("5.0.0.0")]
[assembly: AssemblyFileVersion("5.0.1.0")]
[assembly: AssemblyFileVersion("5.0.2.0")]

[assembly: AssemblyTitle("Microsoft Azure Search Data Library")]
[assembly: AssemblyDescription("Use this assembly if you're developing a .NET application using Azure Search, and you only need to query or update documents in your indexes. If you also need to create or update indexes, synonym maps, or other service-level resources, use the Microsoft.Azure.Search assembly instead.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,76 @@ namespace Microsoft.Azure.Search

internal partial class DataSourcesOperations
{
/// <inheritdoc />
/// <summary>
/// Creates a new Azure Search datasource or updates a datasource if it already
/// exists.
/// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Data-Source" />
/// </summary>
/// <param name='dataSource'>
/// The definition of the datasource to create or update.
/// </param>
/// <param name='searchRequestOptions'>
/// Additional parameters for the operation.
/// </param>
/// <param name='accessCondition'>
/// Additional parameters for the operation.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code.
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response.
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null.
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null.
/// </exception>
/// <returns>
/// A response object containing the response body and response headers.
/// </returns>
public Task<AzureOperationResponse<DataSource>> CreateOrUpdateWithHttpMessagesAsync(DataSource dataSource, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), AccessCondition accessCondition = default(AccessCondition), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
return CreateOrUpdateWithHttpMessagesAsync(dataSource?.Name, dataSource, searchRequestOptions, accessCondition, customHeaders, cancellationToken);
}

/// <inheritdoc />
/// <summary>
/// Determines whether or not the given data source exists in the Azure Search service.
/// </summary>
/// <param name="dataSourceName">
/// The name of the data source.
/// </param>
/// <param name='searchRequestOptions'>
/// Additional parameters for the operation
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code.
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response.
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null.
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null.
/// </exception>
/// <returns>
/// A response with the value <c>true</c> if the data source exists; <c>false</c> otherwise.
/// </returns>
public Task<AzureOperationResponse<bool>> ExistsWithHttpMessagesAsync(
string dataSourceName,
SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ namespace Microsoft.Azure.Search
public static partial class DataSourcesOperationsExtensions
{
/// <summary>
/// Creates a new Azure Search datasource or updates a datasource if it
/// already exists.
/// Creates a new Azure Search datasource or updates a datasource if it already
/// exists.
/// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Data-Source" />
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -26,19 +27,23 @@ public static partial class DataSourcesOperationsExtensions
/// The definition of the datasource to create or update.
/// </param>
/// <param name='searchRequestOptions'>
/// Additional parameters for the operation
/// Additional parameters for the operation.
/// </param>
/// <param name='accessCondition'>
/// Additional parameters for the operation
/// Additional parameters for the operation.
/// </param>
/// <returns>
/// The datasource that was created or updated.
/// </returns>
public static DataSource CreateOrUpdate(this IDataSourcesOperations operations, DataSource dataSource, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), AccessCondition accessCondition = default(AccessCondition))
{
return operations.CreateOrUpdateAsync(dataSource, searchRequestOptions, accessCondition).GetAwaiter().GetResult();
}

/// <summary>
/// Creates a new Azure Search datasource or updates a datasource if it
/// already exists.
/// Creates a new Azure Search datasource or updates a datasource if it already
/// exists.
/// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Data-Source" />
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
Expand All @@ -55,6 +60,9 @@ public static partial class DataSourcesOperationsExtensions
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <returns>
/// The datasource that was created or updated.
/// </returns>
public static async Task<DataSource> CreateOrUpdateAsync(this IDataSourcesOperations operations, DataSource dataSource, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), AccessCondition accessCondition = default(AccessCondition), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(dataSource, searchRequestOptions, accessCondition, null, cancellationToken).ConfigureAwait(false))
Expand All @@ -73,7 +81,7 @@ public static partial class DataSourcesOperationsExtensions
/// The name of the data source.
/// </param>
/// <param name='searchRequestOptions'>
/// Additional parameters for the operation
/// Additional parameters for the operation.
/// </param>
/// <returns>
/// <c>true</c> if the data source exists; <c>false</c> otherwise.
Expand All @@ -96,7 +104,7 @@ public static bool Exists(
/// The name of the data source.
/// </param>
/// <param name='searchRequestOptions'>
/// Additional parameters for the operation
/// Additional parameters for the operation.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,40 @@ namespace Microsoft.Azure.Search
public partial interface IDataSourcesOperations
{
/// <summary>
/// Creates a new Azure Search datasource or updates a datasource if
/// it already exists.
/// Creates a new Azure Search datasource or updates a datasource if it already
/// exists.
/// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Data-Source" />
/// </summary>
/// <param name='dataSource'>
/// The definition of the datasource to create or update.
/// </param>
/// <param name='searchRequestOptions'>
/// Additional parameters for the operation
/// Additional parameters for the operation.
/// </param>
/// <param name='accessCondition'>
/// Additional parameters for the operation
/// Additional parameters for the operation.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code.
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response.
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null.
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null.
/// </exception>
/// <returns>
/// A response object containing the response body and response headers.
/// </returns>
Task<AzureOperationResponse<DataSource>> CreateOrUpdateWithHttpMessagesAsync(DataSource dataSource, SearchRequestOptions searchRequestOptions = default(SearchRequestOptions), AccessCondition accessCondition = default(AccessCondition), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
Expand All @@ -40,14 +56,26 @@ public partial interface IDataSourcesOperations
/// The name of the data source.
/// </param>
/// <param name='searchRequestOptions'>
/// Additional parameters for the operation
/// Additional parameters for the operation.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="CloudException">
/// Thrown when the operation returned an invalid status code.
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response.
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null.
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null.
/// </exception>
/// <returns>
/// A response with the value <c>true</c> if the data source exists; <c>false</c> otherwise.
/// </returns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ namespace Microsoft.Azure.Search
public partial interface ISearchServiceClient
{
/// <summary>
/// Gets the credentials used to authenticate to an Azure Search service.
/// Gets the credentials used to authenticate to an Azure Search service. This can be either a query API key or an admin API key.
/// </summary>
/// <remarks>
/// See <see href="https://docs.microsoft.com/azure/search/search-security-api-keys"/> for more information about API keys in Azure Search.
/// </remarks>
SearchCredentials SearchCredentials { get; }
}
}
Loading

0 comments on commit 3e28be5

Please sign in to comment.