Skip to content

Commit

Permalink
Regen from new swagger and address some API changes (#8772)
Browse files Browse the repository at this point in the history
* Regenate code from new swagger and address autogen API changes
  • Loading branch information
sima-zhu authored Mar 6, 2020
1 parent 2a12804 commit 53ce134
Show file tree
Hide file tree
Showing 97 changed files with 1,433 additions and 1,080 deletions.
1 change: 1 addition & 0 deletions sdk/search/azure-search/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
<configuration>
<argLine>
--add-exports com.azure.core/com.azure.core.implementation.http=ALL-UNNAMED
--add-opens com.azure.core/com.azure.core.util=ALL-UNNAMED
--add-opens com.azure.search/com.azure.search=ALL-UNNAMED
--add-opens com.azure.search/com.azure.search.models=ALL-UNNAMED
--add-opens com.azure.search/com.azure.search.implementation=ALL-UNNAMED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ static Throwable exceptionMapper(Throwable throwable) {
/**
* Drop fields that shouldn't be in the returned object
*
* @param document document object
* @param searchDocument document object
*/
static void cleanupDocument(Document document) {
document.remove(ODATA_CONTEXT);
static void cleanupDocument(SearchDocument searchDocument) {
searchDocument.remove(ODATA_CONTEXT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
* <p>
* If the schema is known, user can convert the properties to a specific object type
*/
public final class Document extends HashMap<String, Object> {
public final class SearchDocument extends HashMap<String, Object> {
private static final long serialVersionUID = 1L;

/**
* Default empty constructor
*/
public Document() {
public SearchDocument() {
super();
}

Expand All @@ -28,7 +28,7 @@ public Document() {
*
* @param propertyMap the map whose mappings are to be placed in this map
*/
public Document(Map<? extends String, ?> propertyMap) {
public SearchDocument(Map<? extends String, ?> propertyMap) {
super(propertyMap);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.serializer.JacksonAdapter;
import com.azure.core.util.serializer.SerializerAdapter;
import com.azure.search.SearchServiceUrlParser.SearchServiceUrlParts;
import com.azure.search.implementation.SearchIndexRestClientBuilder;
import com.azure.search.implementation.SearchIndexRestClientImpl;
import com.azure.search.implementation.SerializationUtil;
Expand Down Expand Up @@ -95,16 +94,14 @@ public final class SearchIndexAsyncClient {
SearchIndexAsyncClient(String endpoint, String indexName, SearchServiceVersion serviceVersion,
HttpPipeline httpPipeline) {

SearchServiceUrlParts parts = SearchServiceUrlParser.parseServiceUrlParts(endpoint);
this.endpoint = endpoint;
this.indexName = indexName;
this.serviceVersion = serviceVersion;
this.httpPipeline = httpPipeline;

restClient = new SearchIndexRestClientBuilder()
.searchServiceName(parts.serviceName)
.endpoint(endpoint)
.indexName(indexName)
.searchDnsSuffix(parts.dnsSuffix)
.apiVersion(serviceVersion.getVersion())
.pipeline(httpPipeline)
.serializer(SERIALIZER)
Expand Down Expand Up @@ -439,7 +436,7 @@ private Mono<SearchPagedResponse> search(SearchRequest request, RequestOptions r
* @return the document object
* @see <a href="https://docs.microsoft.com/rest/api/searchservice/Lookup-Document">Lookup document</a>
*/
public Mono<Document> getDocument(String key) {
public Mono<SearchDocument> getDocument(String key) {
return getDocumentWithResponse(key, null, null).map(Response::getValue);
}

Expand All @@ -457,18 +454,18 @@ public Mono<Document> getDocument(String key) {
* @return a response containing the document object
* @see <a href="https://docs.microsoft.com/rest/api/searchservice/Lookup-Document">Lookup document</a>
*/
public Mono<Response<Document>> getDocumentWithResponse(String key, List<String> selectedFields,
public Mono<Response<SearchDocument>> getDocumentWithResponse(String key, List<String> selectedFields,
RequestOptions requestOptions) {
return withContext(context -> getDocumentWithResponse(key, selectedFields, requestOptions, context));
}

Mono<Response<Document>> getDocumentWithResponse(String key, List<String> selectedFields,
Mono<Response<SearchDocument>> getDocumentWithResponse(String key, List<String> selectedFields,
RequestOptions requestOptions, Context context) {
try {
return restClient.documents()
.getWithRestResponseAsync(key, selectedFields, requestOptions, context)
.map(res -> {
Document doc = res.getValue();
SearchDocument doc = new SearchDocument(res.getValue());
DocumentResponseConversions.cleanupDocument(doc);
return new SimpleResponse<>(res, doc);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public SearchPagedIterable search(String searchText, SearchOptions searchOptions
* @return document object
* @see <a href="https://docs.microsoft.com/rest/api/searchservice/Lookup-Document">Lookup document</a>
*/
public Document getDocument(String key) {
public SearchDocument getDocument(String key) {
return getDocumentWithResponse(key, null, null, Context.NONE).getValue();
}

Expand All @@ -333,7 +333,7 @@ public Document getDocument(String key) {
* @return response containing a document object
* @see <a href="https://docs.microsoft.com/rest/api/searchservice/Lookup-Document">Lookup document</a>
*/
public Response<Document> getDocumentWithResponse(String key, List<String> selectedFields,
public Response<SearchDocument> getDocumentWithResponse(String key, List<String> selectedFields,
RequestOptions requestOptions, Context context) {
return asyncClient.getDocumentWithResponse(key, selectedFields, requestOptions, context).block();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@

import com.azure.core.annotation.ServiceClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.MatchConditions;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.search.SearchServiceUrlParser.SearchServiceUrlParts;
import com.azure.search.implementation.SearchServiceRestClientBuilder;
import com.azure.search.implementation.SearchServiceRestClientImpl;
import com.azure.search.models.AccessCondition;
import com.azure.search.models.AnalyzeRequest;
import com.azure.search.models.DataSource;
import com.azure.search.models.GetIndexStatisticsResult;
Expand Down Expand Up @@ -66,14 +65,12 @@ public final class SearchServiceAsyncClient {
private final HttpPipeline httpPipeline;

SearchServiceAsyncClient(String endpoint, SearchServiceVersion serviceVersion, HttpPipeline httpPipeline) {
SearchServiceUrlParts parts = SearchServiceUrlParser.parseServiceUrlParts(endpoint);
this.endpoint = endpoint;
this.serviceVersion = serviceVersion;
this.httpPipeline = httpPipeline;

this.restClient = new SearchServiceRestClientBuilder()
.searchServiceName(parts.serviceName)
.searchDnsSuffix(parts.dnsSuffix)
.endpoint(endpoint)
.apiVersion(serviceVersion.getVersion())
.pipeline(httpPipeline)
.build();
Expand Down Expand Up @@ -138,13 +135,13 @@ public Mono<DataSource> createOrUpdateDataSource(DataSource dataSource) {
* @return a data source response.
*/
public Mono<Response<DataSource>> createOrUpdateDataSourceWithResponse(DataSource dataSource,
AccessCondition accessCondition, RequestOptions requestOptions) {
MatchConditions accessCondition, RequestOptions requestOptions) {
return withContext(context ->
createOrUpdateDataSourceWithResponse(dataSource, accessCondition, requestOptions, context));
}

Mono<Response<DataSource>> createOrUpdateDataSourceWithResponse(DataSource dataSource,
AccessCondition accessCondition, RequestOptions requestOptions, Context context) {
MatchConditions accessCondition, RequestOptions requestOptions, Context context) {
try {
return restClient
.dataSources()
Expand Down Expand Up @@ -291,13 +288,13 @@ public Mono<Void> deleteDataSource(String dataSourceName) {
* help with debugging
* @return a mono response
*/
public Mono<Response<Void>> deleteDataSourceWithResponse(String dataSourceName, AccessCondition accessCondition,
public Mono<Response<Void>> deleteDataSourceWithResponse(String dataSourceName, MatchConditions accessCondition,
RequestOptions requestOptions) {
return withContext(context ->
deleteDataSourceWithResponse(dataSourceName, accessCondition, requestOptions, context));
}

Mono<Response<Void>> deleteDataSourceWithResponse(String dataSourceName, AccessCondition accessCondition,
Mono<Response<Void>> deleteDataSourceWithResponse(String dataSourceName, MatchConditions accessCondition,
RequestOptions requestOptions, Context context) {
try {
return restClient.dataSources()
Expand Down Expand Up @@ -363,13 +360,13 @@ public Mono<Indexer> createOrUpdateIndexer(Indexer indexer) {
* help with debugging
* @return a response containing the created Indexer.
*/
public Mono<Response<Indexer>> createOrUpdateIndexerWithResponse(Indexer indexer, AccessCondition accessCondition,
public Mono<Response<Indexer>> createOrUpdateIndexerWithResponse(Indexer indexer, MatchConditions accessCondition,
RequestOptions requestOptions) {
return withContext(context ->
createOrUpdateIndexerWithResponse(indexer, accessCondition, requestOptions, context));
}

Mono<Response<Indexer>> createOrUpdateIndexerWithResponse(Indexer indexer, AccessCondition accessCondition,
Mono<Response<Indexer>> createOrUpdateIndexerWithResponse(Indexer indexer, MatchConditions accessCondition,
RequestOptions requestOptions, Context context) {
try {
return restClient.indexers()
Expand Down Expand Up @@ -478,7 +475,7 @@ public Mono<Void> deleteIndexer(String indexerName) {
* help with debugging
* @return a response signalling completion.
*/
public Mono<Response<Void>> deleteIndexerWithResponse(String indexerName, AccessCondition accessCondition,
public Mono<Response<Void>> deleteIndexerWithResponse(String indexerName, MatchConditions accessCondition,
RequestOptions requestOptions) {
return withContext(context -> deleteIndexerWithResponse(indexerName, accessCondition, requestOptions, context));
}
Expand All @@ -494,7 +491,7 @@ public Mono<Response<Void>> deleteIndexerWithResponse(String indexerName, Access
* @param context the context
* @return a response signalling completion.
*/
Mono<Response<Void>> deleteIndexerWithResponse(String indexerName, AccessCondition accessCondition,
Mono<Response<Void>> deleteIndexerWithResponse(String indexerName, MatchConditions accessCondition,
RequestOptions requestOptions, Context context) {
try {
return restClient.indexers()
Expand Down Expand Up @@ -773,13 +770,13 @@ public Mono<Index> createOrUpdateIndex(Index index) {
* @return a response containing the index that was created or updated
*/
public Mono<Response<Index>> createOrUpdateIndexWithResponse(Index index, boolean allowIndexDowntime,
AccessCondition accessCondition, RequestOptions requestOptions) {
MatchConditions accessCondition, RequestOptions requestOptions) {
return withContext(context ->
createOrUpdateIndexWithResponse(index, allowIndexDowntime, accessCondition, requestOptions, context));
}

Mono<Response<Index>> createOrUpdateIndexWithResponse(Index index, boolean allowIndexDowntime,
AccessCondition accessCondition, RequestOptions requestOptions, Context context) {
MatchConditions accessCondition, RequestOptions requestOptions, Context context) {
try {
return restClient.indexes()
.createOrUpdateWithRestResponseAsync(index.getName(), index, allowIndexDowntime, requestOptions,
Expand Down Expand Up @@ -810,12 +807,12 @@ public Mono<Void> deleteIndex(String indexName) {
* help with debugging
* @return a response signalling completion.
*/
public Mono<Response<Void>> deleteIndexWithResponse(String indexName, AccessCondition accessCondition,
public Mono<Response<Void>> deleteIndexWithResponse(String indexName, MatchConditions accessCondition,
RequestOptions requestOptions) {
return withContext(context -> deleteIndexWithResponse(indexName, accessCondition, requestOptions, context));
}

Mono<Response<Void>> deleteIndexWithResponse(String indexName, AccessCondition accessCondition,
Mono<Response<Void>> deleteIndexWithResponse(String indexName, MatchConditions accessCondition,
RequestOptions requestOptions, Context context) {
try {
return restClient.indexes()
Expand Down Expand Up @@ -1014,12 +1011,12 @@ public Mono<Skillset> createOrUpdateSkillset(Skillset skillset) {
* @return a response containing the skillset that was created or updated.
*/
public Mono<Response<Skillset>> createOrUpdateSkillsetWithResponse(Skillset skillset,
AccessCondition accessCondition, RequestOptions requestOptions) {
MatchConditions accessCondition, RequestOptions requestOptions) {
return withContext(context ->
createOrUpdateSkillsetWithResponse(skillset, accessCondition, requestOptions, context));
}

Mono<Response<Skillset>> createOrUpdateSkillsetWithResponse(Skillset skillset, AccessCondition accessCondition,
Mono<Response<Skillset>> createOrUpdateSkillsetWithResponse(Skillset skillset, MatchConditions accessCondition,
RequestOptions requestOptions, Context context) {
try {
return restClient.skillsets()
Expand Down Expand Up @@ -1051,13 +1048,13 @@ public Mono<Void> deleteSkillset(String skillsetName) {
* help with debugging
* @return a response signalling completion.
*/
public Mono<Response<Void>> deleteSkillsetWithResponse(String skillsetName, AccessCondition accessCondition,
public Mono<Response<Void>> deleteSkillsetWithResponse(String skillsetName, MatchConditions accessCondition,
RequestOptions requestOptions) {
return withContext(context ->
deleteSkillsetWithResponse(skillsetName, accessCondition, requestOptions, context));
}

Mono<Response<Void>> deleteSkillsetWithResponse(String skillsetName, AccessCondition accessCondition,
Mono<Response<Void>> deleteSkillsetWithResponse(String skillsetName, MatchConditions accessCondition,
RequestOptions requestOptions, Context context) {
try {
return restClient.skillsets()
Expand Down Expand Up @@ -1204,13 +1201,13 @@ public Mono<SynonymMap> createOrUpdateSynonymMap(SynonymMap synonymMap) {
* @return a response containing the synonym map that was created or updated.
*/
public Mono<Response<SynonymMap>> createOrUpdateSynonymMapWithResponse(SynonymMap synonymMap,
AccessCondition accessCondition, RequestOptions requestOptions) {
MatchConditions accessCondition, RequestOptions requestOptions) {
return withContext(context ->
createOrUpdateSynonymMapWithResponse(synonymMap, accessCondition, requestOptions, context));
}

Mono<Response<SynonymMap>> createOrUpdateSynonymMapWithResponse(SynonymMap synonymMap,
AccessCondition accessCondition, RequestOptions requestOptions, Context context) {
MatchConditions accessCondition, RequestOptions requestOptions, Context context) {
try {
return restClient.synonymMaps()
.createOrUpdateWithRestResponseAsync(synonymMap.getName(), synonymMap, requestOptions, accessCondition,
Expand Down Expand Up @@ -1241,13 +1238,13 @@ public Mono<Void> deleteSynonymMap(String synonymMapName) {
* help with debugging
* @return a response signalling completion.
*/
public Mono<Response<Void>> deleteSynonymMapWithResponse(String synonymMapName, AccessCondition accessCondition,
public Mono<Response<Void>> deleteSynonymMapWithResponse(String synonymMapName, MatchConditions accessCondition,
RequestOptions requestOptions) {
return withContext(context ->
deleteSynonymMapWithResponse(synonymMapName, accessCondition, requestOptions, context));
}

Mono<Response<Void>> deleteSynonymMapWithResponse(String synonymMapName, AccessCondition accessCondition,
Mono<Response<Void>> deleteSynonymMapWithResponse(String synonymMapName, MatchConditions accessCondition,
RequestOptions requestOptions, Context context) {
try {
return restClient.synonymMaps()
Expand Down
Loading

0 comments on commit 53ce134

Please sign in to comment.