Skip to content

Commit

Permalink
Autorest generate 2312 (Azure#349)
Browse files Browse the repository at this point in the history
* Autorest generated code

* Update autrest config based on swagger spec changes Azure/azure-rest-api-specs#7936
  • Loading branch information
navalev authored and rabee333 committed Dec 23, 2019
1 parent 12820d1 commit 16c0bbb
Show file tree
Hide file tree
Showing 34 changed files with 160 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package com.azure.search;

import com.azure.core.exception.AzureException;
import com.azure.search.models.DocumentIndexResult;
import com.azure.search.models.IndexDocumentsResult;
import com.azure.search.models.IndexingResult;

import java.util.ArrayList;
Expand All @@ -22,11 +22,11 @@ public class IndexBatchException extends AzureException {
private final ArrayList<IndexingResult> results;

/**
* Constructs an {@code IndexBatchException} from the given {@link DocumentIndexResult}.
* Constructs an {@code IndexBatchException} from the given {@link IndexDocumentsResult}.
*
* @param result The DocumentIndexResult returned from the service.
*/
IndexBatchException(DocumentIndexResult result) {
IndexBatchException(IndexDocumentsResult result) {
super(createMessage(result));
this.results = new ArrayList<>(result.getResults());
}
Expand All @@ -38,7 +38,7 @@ public List<IndexingResult> getIndexingResults() {
return this.results;
}

private static String createMessage(DocumentIndexResult result) {
private static String createMessage(IndexDocumentsResult result) {
long failedResultCount = result.getResults().stream()
.filter(r -> !r.isSucceeded())
.count();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import com.azure.search.models.AutocompleteItem;
import com.azure.search.models.AutocompleteOptions;
import com.azure.search.models.AutocompleteRequest;
import com.azure.search.models.DocumentIndexResult;
import com.azure.search.models.IndexAction;
import com.azure.search.implementation.models.IndexActionType;
import com.azure.search.models.IndexBatch;
import com.azure.search.models.IndexDocumentsResult;
import com.azure.search.models.RequestOptions;
import com.azure.search.models.SearchOptions;
import com.azure.search.models.SearchRequest;
Expand Down Expand Up @@ -139,7 +139,7 @@ HttpPipeline getHttpPipeline() {
* @param documents collection of documents to upload to the target Index.
* @return document index result.
*/
public Mono<DocumentIndexResult> uploadDocuments(Iterable<?> documents) {
public Mono<IndexDocumentsResult> uploadDocuments(Iterable<?> documents) {
return this.uploadDocumentsWithResponse(documents)
.map(Response::getValue);
}
Expand All @@ -150,12 +150,12 @@ public Mono<DocumentIndexResult> uploadDocuments(Iterable<?> documents) {
* @param documents collection of documents to upload to the target Index.
* @return response containing the document index result.
*/
public Mono<Response<DocumentIndexResult>> uploadDocumentsWithResponse(Iterable<?> documents) {
public Mono<Response<IndexDocumentsResult>> uploadDocumentsWithResponse(Iterable<?> documents) {
return withContext(context -> uploadDocumentsWithResponse(documents, context));
}

@SuppressWarnings("unchecked")
Mono<Response<DocumentIndexResult>> uploadDocumentsWithResponse(Iterable<?> documents, Context context) {
Mono<Response<IndexDocumentsResult>> uploadDocumentsWithResponse(Iterable<?> documents, Context context) {
IndexBatch<?> batch = buildIndexBatch(documents, IndexActionType.UPLOAD);
return this.indexWithResponse(batch, context);
}
Expand All @@ -166,7 +166,7 @@ Mono<Response<DocumentIndexResult>> uploadDocumentsWithResponse(Iterable<?> docu
* @param documents collection of documents to be merged
* @return document index result
*/
public Mono<DocumentIndexResult> mergeDocuments(Iterable<?> documents) {
public Mono<IndexDocumentsResult> mergeDocuments(Iterable<?> documents) {
return this.mergeDocumentsWithResponse(documents)
.map(Response::getValue);
}
Expand All @@ -177,12 +177,12 @@ public Mono<DocumentIndexResult> mergeDocuments(Iterable<?> documents) {
* @param documents collection of documents to be merged
* @return response containing the document index result.
*/
public Mono<Response<DocumentIndexResult>> mergeDocumentsWithResponse(Iterable<?> documents) {
public Mono<Response<IndexDocumentsResult>> mergeDocumentsWithResponse(Iterable<?> documents) {
return withContext(context -> mergeDocumentsWithResponse(documents, context));
}

@SuppressWarnings("unchecked")
Mono<Response<DocumentIndexResult>> mergeDocumentsWithResponse(Iterable<?> documents, Context context) {
Mono<Response<IndexDocumentsResult>> mergeDocumentsWithResponse(Iterable<?> documents, Context context) {
IndexBatch<?> batch = buildIndexBatch(documents, IndexActionType.MERGE);
return this.indexWithResponse(batch, context);
}
Expand All @@ -194,7 +194,7 @@ Mono<Response<DocumentIndexResult>> mergeDocumentsWithResponse(Iterable<?> docum
* @param documents collection of documents to be merged, if exists, otherwise uploaded
* @return document index result
*/
public Mono<DocumentIndexResult> mergeOrUploadDocuments(Iterable<?> documents) {
public Mono<IndexDocumentsResult> mergeOrUploadDocuments(Iterable<?> documents) {
return this.mergeOrUploadDocumentsWithResponse(documents)
.map(Response::getValue);
}
Expand All @@ -206,12 +206,12 @@ public Mono<DocumentIndexResult> mergeOrUploadDocuments(Iterable<?> documents) {
* @param documents collection of documents to be merged, if exists, otherwise uploaded
* @return response containing the document index result.
*/
public Mono<Response<DocumentIndexResult>> mergeOrUploadDocumentsWithResponse(Iterable<?> documents) {
public Mono<Response<IndexDocumentsResult>> mergeOrUploadDocumentsWithResponse(Iterable<?> documents) {
return withContext(context -> mergeOrUploadDocumentsWithResponse(documents, context));
}

@SuppressWarnings("unchecked")
Mono<Response<DocumentIndexResult>> mergeOrUploadDocumentsWithResponse(Iterable<?> documents, Context context) {
Mono<Response<IndexDocumentsResult>> mergeOrUploadDocumentsWithResponse(Iterable<?> documents, Context context) {
IndexBatch<?> batch = buildIndexBatch(documents, IndexActionType.MERGE_OR_UPLOAD);
return this.indexWithResponse(batch, context);
}
Expand All @@ -222,7 +222,7 @@ Mono<Response<DocumentIndexResult>> mergeOrUploadDocumentsWithResponse(Iterable<
* @param documents collection of documents to delete from the target Index.
* @return document index result.
*/
public Mono<DocumentIndexResult> deleteDocuments(Iterable<?> documents) {
public Mono<IndexDocumentsResult> deleteDocuments(Iterable<?> documents) {
return this.deleteDocumentsWithResponse(documents)
.map(Response::getValue);
}
Expand All @@ -233,12 +233,12 @@ public Mono<DocumentIndexResult> deleteDocuments(Iterable<?> documents) {
* @param documents collection of documents to delete from the target Index.
* @return response containing the document index result.
*/
public Mono<Response<DocumentIndexResult>> deleteDocumentsWithResponse(Iterable<?> documents) {
public Mono<Response<IndexDocumentsResult>> deleteDocumentsWithResponse(Iterable<?> documents) {
return withContext(context -> deleteDocumentsWithResponse(documents, context));
}

@SuppressWarnings("unchecked")
Mono<Response<DocumentIndexResult>> deleteDocumentsWithResponse(Iterable<?> documents, Context context) {
Mono<Response<IndexDocumentsResult>> deleteDocumentsWithResponse(Iterable<?> documents, Context context) {
IndexBatch<?> batch = buildIndexBatch(documents, IndexActionType.DELETE);
return this.indexWithResponse(batch, context);
}
Expand Down Expand Up @@ -447,7 +447,7 @@ PagedFluxBase<SuggestResult, SuggestPagedResponse> suggest(String searchText,
* @param batch batch of documents to send to the index with the requested action
* @return document index result
*/
public Mono<DocumentIndexResult> index(IndexBatch<?> batch) {
public Mono<IndexDocumentsResult> index(IndexBatch<?> batch) {
return this.indexWithResponse(batch)
.map(Response::getValue);
}
Expand All @@ -458,11 +458,11 @@ public Mono<DocumentIndexResult> index(IndexBatch<?> batch) {
* @param batch batch of documents to send to the index with the requested action
* @return a response containing the document index result
*/
public Mono<Response<DocumentIndexResult>> indexWithResponse(IndexBatch<?> batch) {
public Mono<Response<IndexDocumentsResult>> indexWithResponse(IndexBatch<?> batch) {
return withContext(context -> indexWithResponse(batch, context));
}

Mono<Response<DocumentIndexResult>> indexWithResponse(IndexBatch<?> batch, Context context) {
Mono<Response<IndexDocumentsResult>> indexWithResponse(IndexBatch<?> batch, Context context) {
return restClient.documents()
.indexWithRestResponseAsync(batch, context)
.handle((res, sink) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import com.azure.core.util.Context;
import com.azure.search.models.AutocompleteItem;
import com.azure.search.models.AutocompleteOptions;
import com.azure.search.models.DocumentIndexResult;
import com.azure.search.models.IndexBatch;
import com.azure.search.models.IndexDocumentsResult;
import com.azure.search.models.RequestOptions;
import com.azure.search.models.SearchOptions;
import com.azure.search.models.SearchResult;
Expand Down Expand Up @@ -63,7 +63,7 @@ HttpPipeline getHttpPipeline() {
* @param documents collection of documents to upload to the target Index.
* @return document index result.
*/
public DocumentIndexResult uploadDocuments(Iterable<?> documents) {
public IndexDocumentsResult uploadDocuments(Iterable<?> documents) {
return this.uploadDocumentsWithResponse(documents, Context.NONE).getValue();
}

Expand All @@ -74,7 +74,7 @@ public DocumentIndexResult uploadDocuments(Iterable<?> documents) {
* @param context additional context that is passed through the Http pipeline during the service call
* @return response containing the document index result.
*/
public Response<DocumentIndexResult> uploadDocumentsWithResponse(Iterable<?> documents, Context context) {
public Response<IndexDocumentsResult> uploadDocumentsWithResponse(Iterable<?> documents, Context context) {
return asyncClient.uploadDocumentsWithResponse(documents, context).block();
}

Expand All @@ -84,7 +84,7 @@ public Response<DocumentIndexResult> uploadDocumentsWithResponse(Iterable<?> doc
* @param documents collection of documents to be merged
* @return document index result
*/
public DocumentIndexResult mergeDocuments(Iterable<?> documents) {
public IndexDocumentsResult mergeDocuments(Iterable<?> documents) {
return this.mergeDocumentsWithResponse(documents, Context.NONE).getValue();
}

Expand All @@ -95,7 +95,7 @@ public DocumentIndexResult mergeDocuments(Iterable<?> documents) {
* @param context additional context that is passed through the Http pipeline during the service call
* @return response containing the document index result.
*/
public Response<DocumentIndexResult> mergeDocumentsWithResponse(Iterable<?> documents, Context context) {
public Response<IndexDocumentsResult> mergeDocumentsWithResponse(Iterable<?> documents, Context context) {
return asyncClient.mergeDocumentsWithResponse(documents, context).block();
}

Expand All @@ -106,7 +106,7 @@ public Response<DocumentIndexResult> mergeDocumentsWithResponse(Iterable<?> docu
* @param documents collection of documents to be merged, if exists, otherwise uploaded
* @return document index result
*/
public DocumentIndexResult mergeOrUploadDocuments(Iterable<?> documents) {
public IndexDocumentsResult mergeOrUploadDocuments(Iterable<?> documents) {
return this.mergeOrUploadDocumentsWithResponse(documents, Context.NONE).getValue();
}

Expand All @@ -118,7 +118,7 @@ public DocumentIndexResult mergeOrUploadDocuments(Iterable<?> documents) {
* @param context additional context that is passed through the Http pipeline during the service call
* @return response containing a document index result
*/
public Response<DocumentIndexResult> mergeOrUploadDocumentsWithResponse(Iterable<?> documents, Context context) {
public Response<IndexDocumentsResult> mergeOrUploadDocumentsWithResponse(Iterable<?> documents, Context context) {
return asyncClient.mergeOrUploadDocumentsWithResponse(documents, context).block();
}

Expand All @@ -128,7 +128,7 @@ public Response<DocumentIndexResult> mergeOrUploadDocumentsWithResponse(Iterable
* @param documents collection of documents to delete from the target Index.
* @return document index result.
*/
public DocumentIndexResult deleteDocuments(Iterable<?> documents) {
public IndexDocumentsResult deleteDocuments(Iterable<?> documents) {
return this.deleteDocumentsWithResponse(documents, Context.NONE).getValue();
}

Expand All @@ -139,7 +139,7 @@ public DocumentIndexResult deleteDocuments(Iterable<?> documents) {
* @param context additional context that is passed through the Http pipeline during the service call
* @return response containing a document index result.
*/
public Response<DocumentIndexResult> deleteDocumentsWithResponse(Iterable<?> documents, Context context) {
public Response<IndexDocumentsResult> deleteDocumentsWithResponse(Iterable<?> documents, Context context) {
return asyncClient.deleteDocumentsWithResponse(documents, context).block();
}

Expand Down Expand Up @@ -304,7 +304,7 @@ public PagedIterableBase<SuggestResult, SuggestPagedResponse> suggest(String sea
* @param batch batch of documents to send to the index with the requested action
* @return document index result
*/
public DocumentIndexResult index(IndexBatch<?> batch) {
public IndexDocumentsResult index(IndexBatch<?> batch) {
return this.indexWithResponse(batch, Context.NONE).getValue();
}

Expand All @@ -315,8 +315,8 @@ public DocumentIndexResult index(IndexBatch<?> batch) {
* @param context additional context that is passed through the Http pipeline during the service call
* @return a response containing a document index result
*/
public Response<DocumentIndexResult> indexWithResponse(IndexBatch<?> batch, Context context) {
Mono<Response<DocumentIndexResult>> results = asyncClient.indexWithResponse(batch, context);
public Response<IndexDocumentsResult> indexWithResponse(IndexBatch<?> batch, Context context) {
Mono<Response<IndexDocumentsResult>> results = asyncClient.indexWithResponse(batch, context);
return results.block();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import com.azure.core.http.rest.Page;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.search.models.DocumentSearchResult;
import com.azure.search.models.FacetResult;
import com.azure.search.models.SearchDocumentsResult;
import com.azure.search.models.SearchRequest;
import com.azure.search.models.SearchResult;

Expand Down Expand Up @@ -40,7 +40,7 @@ public class SearchPagedResponse extends PagedResponseBase<String, SearchResult>
*
* @param documentSearchResponse an http response with the results
*/
public SearchPagedResponse(SimpleResponse<DocumentSearchResult> documentSearchResponse) {
public SearchPagedResponse(SimpleResponse<SearchDocumentsResult> documentSearchResponse) {
super(documentSearchResponse.getRequest(),
documentSearchResponse.getStatusCode(),
documentSearchResponse.getHeaders(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import com.azure.search.models.AccessCondition;
import com.azure.search.models.AnalyzeRequest;
import com.azure.search.models.DataSource;
import com.azure.search.models.GetIndexStatisticsResult;
import com.azure.search.models.Index;
import com.azure.search.models.IndexGetStatisticsResult;
import com.azure.search.models.Indexer;
import com.azure.search.models.IndexerExecutionInfo;
import com.azure.search.models.RequestOptions;
Expand Down Expand Up @@ -759,7 +759,7 @@ Mono<Response<Boolean>> indexExistsWithResponse(String indexName,
* @param indexName the name of the index for which to retrieve statistics
* @return the index statistics result.
*/
public Mono<IndexGetStatisticsResult> getIndexStatistics(String indexName) {
public Mono<GetIndexStatisticsResult> getIndexStatistics(String indexName) {
return this.getIndexStatisticsWithResponse(indexName, null)
.map(Response::getValue);
}
Expand All @@ -772,12 +772,12 @@ public Mono<IndexGetStatisticsResult> getIndexStatistics(String indexName) {
* Contains the tracking ID sent with the request to help with debugging
* @return a response containing the index statistics result.
*/
public Mono<Response<IndexGetStatisticsResult>> getIndexStatisticsWithResponse(String indexName,
public Mono<Response<GetIndexStatisticsResult>> getIndexStatisticsWithResponse(String indexName,
RequestOptions requestOptions) {
return withContext(context -> this.getIndexStatisticsWithResponse(indexName, requestOptions, context));
}

Mono<Response<IndexGetStatisticsResult>> getIndexStatisticsWithResponse(String indexName,
Mono<Response<GetIndexStatisticsResult>> getIndexStatisticsWithResponse(String indexName,
RequestOptions requestOptions,
Context context) {
return restClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import com.azure.search.models.AccessCondition;
import com.azure.search.models.AnalyzeRequest;
import com.azure.search.models.DataSource;
import com.azure.search.models.GetIndexStatisticsResult;
import com.azure.search.models.Index;
import com.azure.search.models.IndexGetStatisticsResult;
import com.azure.search.models.Indexer;
import com.azure.search.models.IndexerExecutionInfo;
import com.azure.search.models.RequestOptions;
Expand Down Expand Up @@ -531,7 +531,7 @@ public Response<Boolean> indexExistsWithResponse(String indexName, RequestOption
* @param indexName the name of the index for which to retrieve statistics
* @return the index statistics result.
*/
public IndexGetStatisticsResult getIndexStatistics(String indexName) {
public GetIndexStatisticsResult getIndexStatistics(String indexName) {
return asyncClient.getIndexStatistics(indexName).block();
}

Expand All @@ -544,7 +544,7 @@ public IndexGetStatisticsResult getIndexStatistics(String indexName) {
* @param context additional context that is passed through the HTTP pipeline during the service call
* @return a response containing the index statistics result.
*/
public Response<IndexGetStatisticsResult> getIndexStatisticsWithResponse(String indexName,
public Response<GetIndexStatisticsResult> getIndexStatisticsWithResponse(String indexName,
RequestOptions requestOptions,
Context context) {
return asyncClient.getIndexStatisticsWithResponse(indexName, requestOptions, context).block();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.azure.core.http.rest.Page;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.search.models.DocumentSuggestResult;
import com.azure.search.models.SuggestDocumentsResult;
import com.azure.search.models.SuggestResult;

import java.util.stream.Collectors;
Expand Down Expand Up @@ -37,7 +37,7 @@ public Double getCoverage() {
*
* @param documentSearchResponse an http response with the results
*/
public SuggestPagedResponse(SimpleResponse<DocumentSuggestResult> documentSearchResponse) {
public SuggestPagedResponse(SimpleResponse<SuggestDocumentsResult> documentSearchResponse) {
super(documentSearchResponse.getRequest(),
documentSearchResponse.getStatusCode(),
documentSearchResponse.getHeaders(),
Expand Down
Loading

0 comments on commit 16c0bbb

Please sign in to comment.