diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Alterations.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Alterations.java new file mode 100644 index 000000000000..aa6537b5fd99 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Alterations.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker; + +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.AlterationsDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.WordAlterationsDTO; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Alterations. + */ +public interface Alterations { + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WordAlterationsDTO object if successful. + */ + WordAlterationsDTO get(); + + /** + * Download alterations from runtime. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getAsync(final ServiceCallback serviceCallback); + + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WordAlterationsDTO object + */ + Observable getAsync(); + + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WordAlterationsDTO object + */ + Observable> getWithServiceResponseAsync(); + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void replace(List wordAlterations); + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture replaceAsync(List wordAlterations, final ServiceCallback serviceCallback); + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable replaceAsync(List wordAlterations); + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> replaceWithServiceResponseAsync(List wordAlterations); + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Endpoints.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Endpoints.java new file mode 100644 index 000000000000..63e7da5e119d --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Endpoints.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker; + +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.EndpointKeysDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Endpoints. + */ +public interface Endpoints { + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EndpointKeysDTO object if successful. + */ + EndpointKeysDTO getKeys(); + + /** + * Gets endpoint keys for an endpoint. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getKeysAsync(final ServiceCallback serviceCallback); + + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + Observable getKeysAsync(); + + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + Observable> getKeysWithServiceResponseAsync(); + + /** + * Re-generates an endpoint key. + * + * @param keyType Type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EndpointKeysDTO object if successful. + */ + EndpointKeysDTO refreshKeys(String keyType); + + /** + * Re-generates an endpoint key. + * + * @param keyType Type of Key + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture refreshKeysAsync(String keyType, final ServiceCallback serviceCallback); + + /** + * Re-generates an endpoint key. + * + * @param keyType Type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + Observable refreshKeysAsync(String keyType); + + /** + * Re-generates an endpoint key. + * + * @param keyType Type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + Observable> refreshKeysWithServiceResponseAsync(String keyType); + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Knowledgebases.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Knowledgebases.java new file mode 100644 index 000000000000..bb65dc951999 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Knowledgebases.java @@ -0,0 +1,351 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker; + +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.CreateKbDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.EnvironmentType; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.KnowledgebaseDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.KnowledgebasesDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.KnowledgebaseUpdateHeaders; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.Operation; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.QnADocumentsDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.QnADTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.UpdateKbOperationDTO; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Knowledgebases. + */ +public interface Knowledgebases { + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KnowledgebasesDTO object if successful. + */ + KnowledgebasesDTO listAll(); + + /** + * Gets all knowledgebases for a user. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture listAllAsync(final ServiceCallback serviceCallback); + + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebasesDTO object + */ + Observable listAllAsync(); + + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebasesDTO object + */ + Observable> listAllWithServiceResponseAsync(); + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KnowledgebaseDTO object if successful. + */ + KnowledgebaseDTO getDetails(String kbId); + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getDetailsAsync(String kbId, final ServiceCallback serviceCallback); + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebaseDTO object + */ + Observable getDetailsAsync(String kbId); + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebaseDTO object + */ + Observable> getDetailsWithServiceResponseAsync(String kbId); + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void delete(String kbId); + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteAsync(String kbId, final ServiceCallback serviceCallback); + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable deleteAsync(String kbId); + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> deleteWithServiceResponseAsync(String kbId); + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void publish(String kbId); + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture publishAsync(String kbId, final ServiceCallback serviceCallback); + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable publishAsync(String kbId); + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> publishWithServiceResponseAsync(String kbId); + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void replace(String kbId, List qnAList); + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture replaceAsync(String kbId, List qnAList, final ServiceCallback serviceCallback); + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable replaceAsync(String kbId, List qnAList); + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> replaceWithServiceResponseAsync(String kbId, List qnAList); + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + Operation update(String kbId, UpdateKbOperationDTO updateKb); + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateAsync(String kbId, UpdateKbOperationDTO updateKb, final ServiceCallback serviceCallback); + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable updateAsync(String kbId, UpdateKbOperationDTO updateKb); + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable> updateWithServiceResponseAsync(String kbId, UpdateKbOperationDTO updateKb); + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + Operation create(CreateKbDTO createKbPayload); + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture createAsync(CreateKbDTO createKbPayload, final ServiceCallback serviceCallback); + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable createAsync(CreateKbDTO createKbPayload); + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable> createWithServiceResponseAsync(CreateKbDTO createKbPayload); + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the QnADocumentsDTO object if successful. + */ + QnADocumentsDTO download(String kbId, EnvironmentType environment); + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture downloadAsync(String kbId, EnvironmentType environment, final ServiceCallback serviceCallback); + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QnADocumentsDTO object + */ + Observable downloadAsync(String kbId, EnvironmentType environment); + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QnADocumentsDTO object + */ + Observable> downloadWithServiceResponseAsync(String kbId, EnvironmentType environment); + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Operations.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Operations.java new file mode 100644 index 000000000000..9a1b1589e10c --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/Operations.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker; + +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.Operation; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.OperationsGetDetailsHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public interface Operations { + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + Operation getDetails(String operationId); + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getDetailsAsync(String operationId, final ServiceCallback serviceCallback); + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable getDetailsAsync(String operationId); + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable> getDetailsWithServiceResponseAsync(String operationId); + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/QnAMakerClient.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/QnAMakerClient.java new file mode 100644 index 000000000000..5193e7c74162 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/QnAMakerClient.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker; + +import com.microsoft.azure.AzureClient; +import com.microsoft.rest.RestClient; + +/** + * The interface for QnAMakerClient class. + */ +public interface QnAMakerClient { + /** + * Gets the REST client. + * + * @return the {@link RestClient} object. + */ + RestClient restClient(); + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + AzureClient getAzureClient(); + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + String userAgent(); + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).. + * + * @return the endpoint value. + */ + String endpoint(); + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).. + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + QnAMakerClient withEndpoint(String endpoint); + + /** + * Gets The preferred language for the response.. + * + * @return the acceptLanguage value. + */ + String acceptLanguage(); + + /** + * Sets The preferred language for the response.. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + QnAMakerClient withAcceptLanguage(String acceptLanguage); + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @return the longRunningOperationRetryTimeout value. + */ + int longRunningOperationRetryTimeout(); + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + QnAMakerClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @return the generateClientRequestId value. + */ + boolean generateClientRequestId(); + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + QnAMakerClient withGenerateClientRequestId(boolean generateClientRequestId); + + /** + * Gets the Endpoints object to access its operations. + * @return the Endpoints object. + */ + Endpoints endpoints(); + + /** + * Gets the Alterations object to access its operations. + * @return the Alterations object. + */ + Alterations alterations(); + + /** + * Gets the Knowledgebases object to access its operations. + * @return the Knowledgebases object. + */ + Knowledgebases knowledgebases(); + + /** + * Gets the Operations object to access its operations. + * @return the Operations object. + */ + Operations operations(); + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/AlterationsImpl.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/AlterationsImpl.java new file mode 100644 index 000000000000..befd34464d85 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/AlterationsImpl.java @@ -0,0 +1,219 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Alterations; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.AlterationsDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.WordAlterationsDTO; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PUT; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Alterations. + */ +public class AlterationsImpl implements Alterations { + /** The Retrofit service to perform REST calls. */ + private AlterationsService service; + /** The service client containing this operation class. */ + private QnAMakerClientImpl client; + + /** + * Initializes an instance of AlterationsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AlterationsImpl(Retrofit retrofit, QnAMakerClientImpl client) { + this.service = retrofit.create(AlterationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Alterations to be + * used by Retrofit to perform actually REST calls. + */ + interface AlterationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Alterations get" }) + @GET("alterations") + Observable> get(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Alterations replace" }) + @PUT("alterations") + Observable> replace(@Header("accept-language") String acceptLanguage, @Body WordAlterationsDTO wordAlterations, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WordAlterationsDTO object if successful. + */ + public WordAlterationsDTO get() { + return getWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Download alterations from runtime. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(), serviceCallback); + } + + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WordAlterationsDTO object + */ + public Observable getAsync() { + return getWithServiceResponseAsync().map(new Func1, WordAlterationsDTO>() { + @Override + public WordAlterationsDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WordAlterationsDTO object + */ + public Observable> getWithServiceResponseAsync() { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.get(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void replace(List wordAlterations) { + replaceWithServiceResponseAsync(wordAlterations).toBlocking().single().body(); + } + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture replaceAsync(List wordAlterations, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(replaceWithServiceResponseAsync(wordAlterations), serviceCallback); + } + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable replaceAsync(List wordAlterations) { + return replaceWithServiceResponseAsync(wordAlterations).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> replaceWithServiceResponseAsync(List wordAlterations) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (wordAlterations == null) { + throw new IllegalArgumentException("Parameter wordAlterations is required and cannot be null."); + } + Validator.validate(wordAlterations); + WordAlterationsDTO wordAlterations1 = new WordAlterationsDTO(); + wordAlterations1.withWordAlterations(wordAlterations); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.replace(this.client.acceptLanguage(), wordAlterations1, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = replaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse replaceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/EndpointsImpl.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/EndpointsImpl.java new file mode 100644 index 000000000000..81450d499d77 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/EndpointsImpl.java @@ -0,0 +1,214 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Endpoints; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.EndpointKeysDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Endpoints. + */ +public class EndpointsImpl implements Endpoints { + /** The Retrofit service to perform REST calls. */ + private EndpointsService service; + /** The service client containing this operation class. */ + private QnAMakerClientImpl client; + + /** + * Initializes an instance of EndpointsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EndpointsImpl(Retrofit retrofit, QnAMakerClientImpl client) { + this.service = retrofit.create(EndpointsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Endpoints to be + * used by Retrofit to perform actually REST calls. + */ + interface EndpointsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Endpoints getKeys" }) + @GET("endpointkeys") + Observable> getKeys(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Endpoints refreshKeys" }) + @PATCH("endpointkeys/{keyType}") + Observable> refreshKeys(@Path("keyType") String keyType, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EndpointKeysDTO object if successful. + */ + public EndpointKeysDTO getKeys() { + return getKeysWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets endpoint keys for an endpoint. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getKeysAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getKeysWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + public Observable getKeysAsync() { + return getKeysWithServiceResponseAsync().map(new Func1, EndpointKeysDTO>() { + @Override + public EndpointKeysDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + public Observable> getKeysWithServiceResponseAsync() { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getKeys(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Re-generates an endpoint key. + * + * @param keyType Type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EndpointKeysDTO object if successful. + */ + public EndpointKeysDTO refreshKeys(String keyType) { + return refreshKeysWithServiceResponseAsync(keyType).toBlocking().single().body(); + } + + /** + * Re-generates an endpoint key. + * + * @param keyType Type of Key + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture refreshKeysAsync(String keyType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(refreshKeysWithServiceResponseAsync(keyType), serviceCallback); + } + + /** + * Re-generates an endpoint key. + * + * @param keyType Type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + public Observable refreshKeysAsync(String keyType) { + return refreshKeysWithServiceResponseAsync(keyType).map(new Func1, EndpointKeysDTO>() { + @Override + public EndpointKeysDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Re-generates an endpoint key. + * + * @param keyType Type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + public Observable> refreshKeysWithServiceResponseAsync(String keyType) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (keyType == null) { + throw new IllegalArgumentException("Parameter keyType is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.refreshKeys(keyType, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = refreshKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse refreshKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/KnowledgebasesImpl.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/KnowledgebasesImpl.java new file mode 100644 index 000000000000..d69791cf0a56 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/KnowledgebasesImpl.java @@ -0,0 +1,739 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Knowledgebases; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.CreateKbDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.EnvironmentType; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.KnowledgebaseDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.KnowledgebasesDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.KnowledgebaseUpdateHeaders; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.Operation; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.QnADocumentsDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.QnADTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.ReplaceKbDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.UpdateKbOperationDTO; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Knowledgebases. + */ +public class KnowledgebasesImpl implements Knowledgebases { + /** The Retrofit service to perform REST calls. */ + private KnowledgebasesService service; + /** The service client containing this operation class. */ + private QnAMakerClientImpl client; + + /** + * Initializes an instance of KnowledgebasesImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public KnowledgebasesImpl(Retrofit retrofit, QnAMakerClientImpl client) { + this.service = retrofit.create(KnowledgebasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Knowledgebases to be + * used by Retrofit to perform actually REST calls. + */ + interface KnowledgebasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Knowledgebases listAll" }) + @GET("knowledgebases") + Observable> listAll(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Knowledgebases getDetails" }) + @GET("knowledgebases/{kbId}") + Observable> getDetails(@Path("kbId") String kbId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Knowledgebases delete" }) + @HTTP(path = "knowledgebases/{kbId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("kbId") String kbId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Knowledgebases publish" }) + @POST("knowledgebases/{kbId}") + Observable> publish(@Path("kbId") String kbId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Knowledgebases replace" }) + @PUT("knowledgebases/{kbId}") + Observable> replace(@Path("kbId") String kbId, @Header("accept-language") String acceptLanguage, @Body ReplaceKbDTO replaceKb, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Knowledgebases update" }) + @PATCH("knowledgebases/{kbId}") + Observable> update(@Path("kbId") String kbId, @Body UpdateKbOperationDTO updateKb, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Knowledgebases create" }) + @POST("knowledgebases/create") + Observable> create(@Body CreateKbDTO createKbPayload, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Knowledgebases download" }) + @GET("knowledgebases/{kbId}/{environment}/qna") + Observable> download(@Path("kbId") String kbId, @Path("environment") EnvironmentType environment, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KnowledgebasesDTO object if successful. + */ + public KnowledgebasesDTO listAll() { + return listAllWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets all knowledgebases for a user. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAllAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listAllWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebasesDTO object + */ + public Observable listAllAsync() { + return listAllWithServiceResponseAsync().map(new Func1, KnowledgebasesDTO>() { + @Override + public KnowledgebasesDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebasesDTO object + */ + public Observable> listAllWithServiceResponseAsync() { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.listAll(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listAllDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listAllDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KnowledgebaseDTO object if successful. + */ + public KnowledgebaseDTO getDetails(String kbId) { + return getDetailsWithServiceResponseAsync(kbId).toBlocking().single().body(); + } + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getDetailsAsync(String kbId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getDetailsWithServiceResponseAsync(kbId), serviceCallback); + } + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebaseDTO object + */ + public Observable getDetailsAsync(String kbId) { + return getDetailsWithServiceResponseAsync(kbId).map(new Func1, KnowledgebaseDTO>() { + @Override + public KnowledgebaseDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebaseDTO object + */ + public Observable> getDetailsWithServiceResponseAsync(String kbId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getDetails(kbId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDetailsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDetailsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String kbId) { + deleteWithServiceResponseAsync(kbId).toBlocking().single().body(); + } + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String kbId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(kbId), serviceCallback); + } + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String kbId) { + return deleteWithServiceResponseAsync(kbId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String kbId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.delete(kbId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void publish(String kbId) { + publishWithServiceResponseAsync(kbId).toBlocking().single().body(); + } + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture publishAsync(String kbId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(publishWithServiceResponseAsync(kbId), serviceCallback); + } + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable publishAsync(String kbId) { + return publishWithServiceResponseAsync(kbId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> publishWithServiceResponseAsync(String kbId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.publish(kbId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = publishDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse publishDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void replace(String kbId, List qnAList) { + replaceWithServiceResponseAsync(kbId, qnAList).toBlocking().single().body(); + } + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture replaceAsync(String kbId, List qnAList, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(replaceWithServiceResponseAsync(kbId, qnAList), serviceCallback); + } + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable replaceAsync(String kbId, List qnAList) { + return replaceWithServiceResponseAsync(kbId, qnAList).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> replaceWithServiceResponseAsync(String kbId, List qnAList) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + if (qnAList == null) { + throw new IllegalArgumentException("Parameter qnAList is required and cannot be null."); + } + Validator.validate(qnAList); + ReplaceKbDTO replaceKb = new ReplaceKbDTO(); + replaceKb.withQnAList(qnAList); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.replace(kbId, this.client.acceptLanguage(), replaceKb, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = replaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse replaceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + public Operation update(String kbId, UpdateKbOperationDTO updateKb) { + return updateWithServiceResponseAsync(kbId, updateKb).toBlocking().single().body(); + } + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String kbId, UpdateKbOperationDTO updateKb, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(kbId, updateKb), serviceCallback); + } + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable updateAsync(String kbId, UpdateKbOperationDTO updateKb) { + return updateWithServiceResponseAsync(kbId, updateKb).map(new Func1, Operation>() { + @Override + public Operation call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable> updateWithServiceResponseAsync(String kbId, UpdateKbOperationDTO updateKb) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + if (updateKb == null) { + throw new IllegalArgumentException("Parameter updateKb is required and cannot be null."); + } + Validator.validate(updateKb); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.update(kbId, updateKb, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, KnowledgebaseUpdateHeaders.class); + } + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + public Operation create(CreateKbDTO createKbPayload) { + return createWithServiceResponseAsync(createKbPayload).toBlocking().single().body(); + } + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(CreateKbDTO createKbPayload, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(createKbPayload), serviceCallback); + } + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable createAsync(CreateKbDTO createKbPayload) { + return createWithServiceResponseAsync(createKbPayload).map(new Func1, Operation>() { + @Override + public Operation call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable> createWithServiceResponseAsync(CreateKbDTO createKbPayload) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (createKbPayload == null) { + throw new IllegalArgumentException("Parameter createKbPayload is required and cannot be null."); + } + Validator.validate(createKbPayload); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.create(createKbPayload, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the QnADocumentsDTO object if successful. + */ + public QnADocumentsDTO download(String kbId, EnvironmentType environment) { + return downloadWithServiceResponseAsync(kbId, environment).toBlocking().single().body(); + } + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture downloadAsync(String kbId, EnvironmentType environment, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(downloadWithServiceResponseAsync(kbId, environment), serviceCallback); + } + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QnADocumentsDTO object + */ + public Observable downloadAsync(String kbId, EnvironmentType environment) { + return downloadWithServiceResponseAsync(kbId, environment).map(new Func1, QnADocumentsDTO>() { + @Override + public QnADocumentsDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QnADocumentsDTO object + */ + public Observable> downloadWithServiceResponseAsync(String kbId, EnvironmentType environment) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + if (environment == null) { + throw new IllegalArgumentException("Parameter environment is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.download(kbId, environment, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = downloadDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse downloadDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/OperationsImpl.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/OperationsImpl.java new file mode 100644 index 000000000000..9c857f89375a --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/OperationsImpl.java @@ -0,0 +1,140 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.implementation; + +import retrofit2.Retrofit; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Operations; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.Operation; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.OperationsGetDetailsHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsImpl implements Operations { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private QnAMakerClientImpl client; + + /** + * Initializes an instance of OperationsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsImpl(Retrofit retrofit, QnAMakerClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Operations getDetails" }) + @GET("operations/{operationId}") + Observable> getDetails(@Path("operationId") String operationId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + public Operation getDetails(String operationId) { + return getDetailsWithServiceResponseAsync(operationId).toBlocking().single().body(); + } + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getDetailsAsync(String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getDetailsWithServiceResponseAsync(operationId), serviceCallback); + } + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable getDetailsAsync(String operationId) { + return getDetailsWithServiceResponseAsync(operationId).map(new Func1, Operation>() { + @Override + public Operation call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable> getDetailsWithServiceResponseAsync(String operationId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getDetails(operationId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getDetailsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getDetailsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, OperationsGetDetailsHeaders.class); + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/QnAMakerClientImpl.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/QnAMakerClientImpl.java new file mode 100644 index 000000000000..fb33122927ec --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/QnAMakerClientImpl.java @@ -0,0 +1,230 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Alterations; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Endpoints; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Knowledgebases; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.Operations; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.QnAMakerClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the QnAMakerClientImpl class. + */ +public class QnAMakerClientImpl extends AzureServiceClient implements QnAMakerClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). */ + private String endpoint; + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + public QnAMakerClientImpl withEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public QnAMakerClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public QnAMakerClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public QnAMakerClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The Endpoints object to access its operations. + */ + private Endpoints endpoints; + + /** + * Gets the Endpoints object to access its operations. + * @return the Endpoints object. + */ + public Endpoints endpoints() { + return this.endpoints; + } + + /** + * The Alterations object to access its operations. + */ + private Alterations alterations; + + /** + * Gets the Alterations object to access its operations. + * @return the Alterations object. + */ + public Alterations alterations() { + return this.alterations; + } + + /** + * The Knowledgebases object to access its operations. + */ + private Knowledgebases knowledgebases; + + /** + * Gets the Knowledgebases object to access its operations. + * @return the Knowledgebases object. + */ + public Knowledgebases knowledgebases() { + return this.knowledgebases; + } + + /** + * The Operations object to access its operations. + */ + private Operations operations; + + /** + * Gets the Operations object to access its operations. + * @return the Operations object. + */ + public Operations operations() { + return this.operations; + } + + /** + * Initializes an instance of QnAMakerClient client. + * + * @param credentials the management credentials for Azure + */ + public QnAMakerClientImpl(ServiceClientCredentials credentials) { + this("https://{Endpoint}/qnamaker/v4.0", credentials); + } + + /** + * Initializes an instance of QnAMakerClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + private QnAMakerClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of QnAMakerClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public QnAMakerClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.endpoints = new EndpointsImpl(restClient().retrofit(), this); + this.alterations = new AlterationsImpl(restClient().retrofit(), this); + this.knowledgebases = new KnowledgebasesImpl(restClient().retrofit(), this); + this.operations = new OperationsImpl(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "QnAMakerClient", "4.0"); + } +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/package-info.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/package-info.java new file mode 100644 index 000000000000..9a1079b4bf85 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for QnAMakerClient. + * An API for QnAMaker Service. + */ +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.implementation; diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/AlterationsDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/AlterationsDTO.java new file mode 100644 index 000000000000..dd00520cc82f --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/AlterationsDTO.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Collection of words that are synonyms. + */ +public class AlterationsDTO { + /** + * Words that are synonymous with each other. + */ + @JsonProperty(value = "alterations", required = true) + private List alterations; + + /** + * Get words that are synonymous with each other. + * + * @return the alterations value + */ + public List alterations() { + return this.alterations; + } + + /** + * Set words that are synonymous with each other. + * + * @param alterations the alterations value to set + * @return the AlterationsDTO object itself. + */ + public AlterationsDTO withAlterations(List alterations) { + this.alterations = alterations; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/CreateKbDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/CreateKbDTO.java new file mode 100644 index 000000000000..50b7606b3ba3 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/CreateKbDTO.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Post body schema for CreateKb operation. + */ +public class CreateKbDTO { + /** + * Friendly name for the knowledgebase. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are + * assigned by the service and should be omitted. + */ + @JsonProperty(value = "qnaList") + private List qnaList; + + /** + * List of URLs to be used for extracting Q-A. + */ + @JsonProperty(value = "urls") + private List urls; + + /** + * List of files from which to Extract Q-A. + */ + @JsonProperty(value = "files") + private List files; + + /** + * Get friendly name for the knowledgebase. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set friendly name for the knowledgebase. + * + * @param name the name value to set + * @return the CreateKbDTO object itself. + */ + public CreateKbDTO withName(String name) { + this.name = name; + return this; + } + + /** + * Get list of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * + * @return the qnaList value + */ + public List qnaList() { + return this.qnaList; + } + + /** + * Set list of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * + * @param qnaList the qnaList value to set + * @return the CreateKbDTO object itself. + */ + public CreateKbDTO withQnaList(List qnaList) { + this.qnaList = qnaList; + return this; + } + + /** + * Get list of URLs to be used for extracting Q-A. + * + * @return the urls value + */ + public List urls() { + return this.urls; + } + + /** + * Set list of URLs to be used for extracting Q-A. + * + * @param urls the urls value to set + * @return the CreateKbDTO object itself. + */ + public CreateKbDTO withUrls(List urls) { + this.urls = urls; + return this; + } + + /** + * Get list of files from which to Extract Q-A. + * + * @return the files value + */ + public List files() { + return this.files; + } + + /** + * Set list of files from which to Extract Q-A. + * + * @param files the files value to set + * @return the CreateKbDTO object itself. + */ + public CreateKbDTO withFiles(List files) { + this.files = files; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/CreateKbInputDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/CreateKbInputDTO.java new file mode 100644 index 000000000000..edcf49be3007 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/CreateKbInputDTO.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Input to create KB. + */ +public class CreateKbInputDTO { + /** + * List of QNA to be added to the index. Ids are generated by the service + * and should be omitted. + */ + @JsonProperty(value = "qnaList") + private List qnaList; + + /** + * List of URLs to be added to knowledgebase. + */ + @JsonProperty(value = "urls") + private List urls; + + /** + * List of files to be added to knowledgebase. + */ + @JsonProperty(value = "files") + private List files; + + /** + * Get list of QNA to be added to the index. Ids are generated by the service and should be omitted. + * + * @return the qnaList value + */ + public List qnaList() { + return this.qnaList; + } + + /** + * Set list of QNA to be added to the index. Ids are generated by the service and should be omitted. + * + * @param qnaList the qnaList value to set + * @return the CreateKbInputDTO object itself. + */ + public CreateKbInputDTO withQnaList(List qnaList) { + this.qnaList = qnaList; + return this; + } + + /** + * Get list of URLs to be added to knowledgebase. + * + * @return the urls value + */ + public List urls() { + return this.urls; + } + + /** + * Set list of URLs to be added to knowledgebase. + * + * @param urls the urls value to set + * @return the CreateKbInputDTO object itself. + */ + public CreateKbInputDTO withUrls(List urls) { + this.urls = urls; + return this; + } + + /** + * Get list of files to be added to knowledgebase. + * + * @return the files value + */ + public List files() { + return this.files; + } + + /** + * Set list of files to be added to knowledgebase. + * + * @param files the files value to set + * @return the CreateKbInputDTO object itself. + */ + public CreateKbInputDTO withFiles(List files) { + this.files = files; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/DeleteKbContentsDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/DeleteKbContentsDTO.java new file mode 100644 index 000000000000..f0a5ae0be690 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/DeleteKbContentsDTO.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PATCH body schema of Delete Operation in UpdateKb. + */ +public class DeleteKbContentsDTO { + /** + * List of Qna Ids to be deleted. + */ + @JsonProperty(value = "ids") + private List ids; + + /** + * List of sources to be deleted from knowledgebase. + */ + @JsonProperty(value = "sources") + private List sources; + + /** + * Get list of Qna Ids to be deleted. + * + * @return the ids value + */ + public List ids() { + return this.ids; + } + + /** + * Set list of Qna Ids to be deleted. + * + * @param ids the ids value to set + * @return the DeleteKbContentsDTO object itself. + */ + public DeleteKbContentsDTO withIds(List ids) { + this.ids = ids; + return this; + } + + /** + * Get list of sources to be deleted from knowledgebase. + * + * @return the sources value + */ + public List sources() { + return this.sources; + } + + /** + * Set list of sources to be deleted from knowledgebase. + * + * @param sources the sources value to set + * @return the DeleteKbContentsDTO object itself. + */ + public DeleteKbContentsDTO withSources(List sources) { + this.sources = sources; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/EndpointKeysDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/EndpointKeysDTO.java new file mode 100644 index 000000000000..4e3c147e5030 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/EndpointKeysDTO.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Schema for EndpointKeys generate/refresh operations. + */ +public class EndpointKeysDTO { + /** + * Primary Access Key. + */ + @JsonProperty(value = "primaryEndpointKey") + private String primaryEndpointKey; + + /** + * Secondary Access Key. + */ + @JsonProperty(value = "secondaryEndpointKey") + private String secondaryEndpointKey; + + /** + * Current version of runtime. + */ + @JsonProperty(value = "installedVersion") + private String installedVersion; + + /** + * Latest version of runtime. + */ + @JsonProperty(value = "lastStableVersion") + private String lastStableVersion; + + /** + * Get primary Access Key. + * + * @return the primaryEndpointKey value + */ + public String primaryEndpointKey() { + return this.primaryEndpointKey; + } + + /** + * Set primary Access Key. + * + * @param primaryEndpointKey the primaryEndpointKey value to set + * @return the EndpointKeysDTO object itself. + */ + public EndpointKeysDTO withPrimaryEndpointKey(String primaryEndpointKey) { + this.primaryEndpointKey = primaryEndpointKey; + return this; + } + + /** + * Get secondary Access Key. + * + * @return the secondaryEndpointKey value + */ + public String secondaryEndpointKey() { + return this.secondaryEndpointKey; + } + + /** + * Set secondary Access Key. + * + * @param secondaryEndpointKey the secondaryEndpointKey value to set + * @return the EndpointKeysDTO object itself. + */ + public EndpointKeysDTO withSecondaryEndpointKey(String secondaryEndpointKey) { + this.secondaryEndpointKey = secondaryEndpointKey; + return this; + } + + /** + * Get current version of runtime. + * + * @return the installedVersion value + */ + public String installedVersion() { + return this.installedVersion; + } + + /** + * Set current version of runtime. + * + * @param installedVersion the installedVersion value to set + * @return the EndpointKeysDTO object itself. + */ + public EndpointKeysDTO withInstalledVersion(String installedVersion) { + this.installedVersion = installedVersion; + return this; + } + + /** + * Get latest version of runtime. + * + * @return the lastStableVersion value + */ + public String lastStableVersion() { + return this.lastStableVersion; + } + + /** + * Set latest version of runtime. + * + * @param lastStableVersion the lastStableVersion value to set + * @return the EndpointKeysDTO object itself. + */ + public EndpointKeysDTO withLastStableVersion(String lastStableVersion) { + this.lastStableVersion = lastStableVersion; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/EnvironmentType.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/EnvironmentType.java new file mode 100644 index 000000000000..b91dfa272601 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/EnvironmentType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for EnvironmentType. + */ +public final class EnvironmentType extends ExpandableStringEnum { + /** Static value Prod for EnvironmentType. */ + public static final EnvironmentType PROD = fromString("Prod"); + + /** Static value Test for EnvironmentType. */ + public static final EnvironmentType TEST = fromString("Test"); + + /** + * Creates or finds a EnvironmentType from its string representation. + * @param name a name to look for + * @return the corresponding EnvironmentType + */ + @JsonCreator + public static EnvironmentType fromString(String name) { + return fromString(name, EnvironmentType.class); + } + + /** + * @return known EnvironmentType values + */ + public static Collection values() { + return values(EnvironmentType.class); + } +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/Error.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/Error.java new file mode 100644 index 000000000000..480921c65c4f --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/Error.java @@ -0,0 +1,155 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The error object. As per Microsoft One API guidelines - + * https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + */ +public class Error { + /** + * One of a server-defined set of error codes. Possible values include: + * 'BadArgument', 'Forbidden', 'NotFound', 'KbNotFound', 'Unauthorized', + * 'Unspecified', 'EndpointKeysError', 'QuotaExceeded', 'QnaRuntimeError', + * 'SKULimitExceeded', 'OperationNotFound', 'ServiceError', + * 'ValidationFailure', 'ExtractionFailure'. + */ + @JsonProperty(value = "code", required = true) + private ErrorCodeType code; + + /** + * A human-readable representation of the error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * The target of the error. + */ + @JsonProperty(value = "target") + private String target; + + /** + * An array of details about specific errors that led to this reported + * error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * An object containing more specific information than the current object + * about the error. + */ + @JsonProperty(value = "innerError") + private InnerErrorModel innerError; + + /** + * Get one of a server-defined set of error codes. Possible values include: 'BadArgument', 'Forbidden', 'NotFound', 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', 'OperationNotFound', 'ServiceError', 'ValidationFailure', 'ExtractionFailure'. + * + * @return the code value + */ + public ErrorCodeType code() { + return this.code; + } + + /** + * Set one of a server-defined set of error codes. Possible values include: 'BadArgument', 'Forbidden', 'NotFound', 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', 'OperationNotFound', 'ServiceError', 'ValidationFailure', 'ExtractionFailure'. + * + * @param code the code value to set + * @return the Error object itself. + */ + public Error withCode(ErrorCodeType code) { + this.code = code; + return this; + } + + /** + * Get a human-readable representation of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set a human-readable representation of the error. + * + * @param message the message value to set + * @return the Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the target of the error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set the target of the error. + * + * @param target the target value to set + * @return the Error object itself. + */ + public Error withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get an array of details about specific errors that led to this reported error. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set an array of details about specific errors that led to this reported error. + * + * @param details the details value to set + * @return the Error object itself. + */ + public Error withDetails(List details) { + this.details = details; + return this; + } + + /** + * Get an object containing more specific information than the current object about the error. + * + * @return the innerError value + */ + public InnerErrorModel innerError() { + return this.innerError; + } + + /** + * Set an object containing more specific information than the current object about the error. + * + * @param innerError the innerError value to set + * @return the Error object itself. + */ + public Error withInnerError(InnerErrorModel innerError) { + this.innerError = innerError; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorCodeType.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorCodeType.java new file mode 100644 index 000000000000..3839c9bd3520 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorCodeType.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ErrorCodeType. + */ +public final class ErrorCodeType extends ExpandableStringEnum { + /** Static value BadArgument for ErrorCodeType. */ + public static final ErrorCodeType BAD_ARGUMENT = fromString("BadArgument"); + + /** Static value Forbidden for ErrorCodeType. */ + public static final ErrorCodeType FORBIDDEN = fromString("Forbidden"); + + /** Static value NotFound for ErrorCodeType. */ + public static final ErrorCodeType NOT_FOUND = fromString("NotFound"); + + /** Static value KbNotFound for ErrorCodeType. */ + public static final ErrorCodeType KB_NOT_FOUND = fromString("KbNotFound"); + + /** Static value Unauthorized for ErrorCodeType. */ + public static final ErrorCodeType UNAUTHORIZED = fromString("Unauthorized"); + + /** Static value Unspecified for ErrorCodeType. */ + public static final ErrorCodeType UNSPECIFIED = fromString("Unspecified"); + + /** Static value EndpointKeysError for ErrorCodeType. */ + public static final ErrorCodeType ENDPOINT_KEYS_ERROR = fromString("EndpointKeysError"); + + /** Static value QuotaExceeded for ErrorCodeType. */ + public static final ErrorCodeType QUOTA_EXCEEDED = fromString("QuotaExceeded"); + + /** Static value QnaRuntimeError for ErrorCodeType. */ + public static final ErrorCodeType QNA_RUNTIME_ERROR = fromString("QnaRuntimeError"); + + /** Static value SKULimitExceeded for ErrorCodeType. */ + public static final ErrorCodeType SKULIMIT_EXCEEDED = fromString("SKULimitExceeded"); + + /** Static value OperationNotFound for ErrorCodeType. */ + public static final ErrorCodeType OPERATION_NOT_FOUND = fromString("OperationNotFound"); + + /** Static value ServiceError for ErrorCodeType. */ + public static final ErrorCodeType SERVICE_ERROR = fromString("ServiceError"); + + /** Static value ValidationFailure for ErrorCodeType. */ + public static final ErrorCodeType VALIDATION_FAILURE = fromString("ValidationFailure"); + + /** Static value ExtractionFailure for ErrorCodeType. */ + public static final ErrorCodeType EXTRACTION_FAILURE = fromString("ExtractionFailure"); + + /** + * Creates or finds a ErrorCodeType from its string representation. + * @param name a name to look for + * @return the corresponding ErrorCodeType + */ + @JsonCreator + public static ErrorCodeType fromString(String name) { + return fromString(name, ErrorCodeType.class); + } + + /** + * @return known ErrorCodeType values + */ + public static Collection values() { + return values(ErrorCodeType.class); + } +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorResponse.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorResponse.java new file mode 100644 index 000000000000..f93cf592b1df --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response. As per Microsoft One API guidelines - + * https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + */ +public class ErrorResponse { + /** + * The error object. + */ + @JsonProperty(value = "error") + private ErrorResponseError error; + + /** + * Get the error object. + * + * @return the error value + */ + public ErrorResponseError error() { + return this.error; + } + + /** + * Set the error object. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorResponseError error) { + this.error = error; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorResponseError.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorResponseError.java new file mode 100644 index 000000000000..51f079a897bd --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorResponseError.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + + +/** + * The error object. + */ +public class ErrorResponseError extends Error { +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorResponseException.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorResponseException.java new file mode 100644 index 000000000000..b477eb7c6914 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/FileDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/FileDTO.java new file mode 100644 index 000000000000..dbc84608cebc --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/FileDTO.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * DTO to hold details of uploaded files. + */ +public class FileDTO { + /** + * File name. Supported file types are ".tsv", ".pdf", ".txt", ".docx", + * ".xlsx". + */ + @JsonProperty(value = "fileName", required = true) + private String fileName; + + /** + * Public URI of the file. + */ + @JsonProperty(value = "fileUri", required = true) + private String fileUri; + + /** + * Get file name. Supported file types are ".tsv", ".pdf", ".txt", ".docx", ".xlsx". + * + * @return the fileName value + */ + public String fileName() { + return this.fileName; + } + + /** + * Set file name. Supported file types are ".tsv", ".pdf", ".txt", ".docx", ".xlsx". + * + * @param fileName the fileName value to set + * @return the FileDTO object itself. + */ + public FileDTO withFileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get public URI of the file. + * + * @return the fileUri value + */ + public String fileUri() { + return this.fileUri; + } + + /** + * Set public URI of the file. + * + * @param fileUri the fileUri value to set + * @return the FileDTO object itself. + */ + public FileDTO withFileUri(String fileUri) { + this.fileUri = fileUri; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/GetOperationDetailsHeaders.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/GetOperationDetailsHeaders.java new file mode 100644 index 000000000000..f53f47086407 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/GetOperationDetailsHeaders.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get Operation Details operation. + */ +public class GetOperationDetailsHeaders { + /** + * Indicates how long the client should wait before sending a follow up + * request. The header will be present only if the operation is running or + * has not started yet. + */ + @JsonProperty(value = "RetryAfter") + private Integer retryAfter; + + /** + * Get indicates how long the client should wait before sending a follow up request. The header will be present only if the operation is running or has not started yet. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set indicates how long the client should wait before sending a follow up request. The header will be present only if the operation is running or has not started yet. + * + * @param retryAfter the retryAfter value to set + * @return the GetOperationDetailsHeaders object itself. + */ + public GetOperationDetailsHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/InnerErrorModel.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/InnerErrorModel.java new file mode 100644 index 000000000000..ef29855608f3 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/InnerErrorModel.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object containing more specific information about the error. As per + * Microsoft One API guidelines - + * https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + */ +public class InnerErrorModel { + /** + * A more specific error code than was provided by the containing error. + */ + @JsonProperty(value = "code") + private String code; + + /** + * An object containing more specific information than the current object + * about the error. + */ + @JsonProperty(value = "innerError") + private InnerErrorModel innerError; + + /** + * Get a more specific error code than was provided by the containing error. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set a more specific error code than was provided by the containing error. + * + * @param code the code value to set + * @return the InnerErrorModel object itself. + */ + public InnerErrorModel withCode(String code) { + this.code = code; + return this; + } + + /** + * Get an object containing more specific information than the current object about the error. + * + * @return the innerError value + */ + public InnerErrorModel innerError() { + return this.innerError; + } + + /** + * Set an object containing more specific information than the current object about the error. + * + * @param innerError the innerError value to set + * @return the InnerErrorModel object itself. + */ + public InnerErrorModel withInnerError(InnerErrorModel innerError) { + this.innerError = innerError; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebaseDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebaseDTO.java new file mode 100644 index 000000000000..73975f27cb97 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebaseDTO.java @@ -0,0 +1,254 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response schema for CreateKb operation. + */ +public class KnowledgebaseDTO { + /** + * Unique id that identifies a knowledgebase. + */ + @JsonProperty(value = "id") + private String id; + + /** + * URL host name at which the knowledgebase is hosted. + */ + @JsonProperty(value = "hostName") + private String hostName; + + /** + * Time stamp at which the knowledgebase was last accessed (UTC). + */ + @JsonProperty(value = "lastAccessedTimestamp") + private String lastAccessedTimestamp; + + /** + * Time stamp at which the knowledgebase was last modified (UTC). + */ + @JsonProperty(value = "lastChangedTimestamp") + private String lastChangedTimestamp; + + /** + * Time stamp at which the knowledgebase was last published (UTC). + */ + @JsonProperty(value = "lastPublishedTimestamp") + private String lastPublishedTimestamp; + + /** + * Friendly name of the knowledgebase. + */ + @JsonProperty(value = "name") + private String name; + + /** + * User who created / owns the knowledgebase. + */ + @JsonProperty(value = "userId") + private String userId; + + /** + * URL sources from which Q-A were extracted and added to the + * knowledgebase. + */ + @JsonProperty(value = "urls") + private List urls; + + /** + * Custom sources from which Q-A were extracted or explicitly added to the + * knowledgebase. + */ + @JsonProperty(value = "sources") + private List sources; + + /** + * Get unique id that identifies a knowledgebase. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set unique id that identifies a knowledgebase. + * + * @param id the id value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withId(String id) { + this.id = id; + return this; + } + + /** + * Get uRL host name at which the knowledgebase is hosted. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Set uRL host name at which the knowledgebase is hosted. + * + * @param hostName the hostName value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withHostName(String hostName) { + this.hostName = hostName; + return this; + } + + /** + * Get time stamp at which the knowledgebase was last accessed (UTC). + * + * @return the lastAccessedTimestamp value + */ + public String lastAccessedTimestamp() { + return this.lastAccessedTimestamp; + } + + /** + * Set time stamp at which the knowledgebase was last accessed (UTC). + * + * @param lastAccessedTimestamp the lastAccessedTimestamp value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withLastAccessedTimestamp(String lastAccessedTimestamp) { + this.lastAccessedTimestamp = lastAccessedTimestamp; + return this; + } + + /** + * Get time stamp at which the knowledgebase was last modified (UTC). + * + * @return the lastChangedTimestamp value + */ + public String lastChangedTimestamp() { + return this.lastChangedTimestamp; + } + + /** + * Set time stamp at which the knowledgebase was last modified (UTC). + * + * @param lastChangedTimestamp the lastChangedTimestamp value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withLastChangedTimestamp(String lastChangedTimestamp) { + this.lastChangedTimestamp = lastChangedTimestamp; + return this; + } + + /** + * Get time stamp at which the knowledgebase was last published (UTC). + * + * @return the lastPublishedTimestamp value + */ + public String lastPublishedTimestamp() { + return this.lastPublishedTimestamp; + } + + /** + * Set time stamp at which the knowledgebase was last published (UTC). + * + * @param lastPublishedTimestamp the lastPublishedTimestamp value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withLastPublishedTimestamp(String lastPublishedTimestamp) { + this.lastPublishedTimestamp = lastPublishedTimestamp; + return this; + } + + /** + * Get friendly name of the knowledgebase. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set friendly name of the knowledgebase. + * + * @param name the name value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withName(String name) { + this.name = name; + return this; + } + + /** + * Get user who created / owns the knowledgebase. + * + * @return the userId value + */ + public String userId() { + return this.userId; + } + + /** + * Set user who created / owns the knowledgebase. + * + * @param userId the userId value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withUserId(String userId) { + this.userId = userId; + return this; + } + + /** + * Get uRL sources from which Q-A were extracted and added to the knowledgebase. + * + * @return the urls value + */ + public List urls() { + return this.urls; + } + + /** + * Set uRL sources from which Q-A were extracted and added to the knowledgebase. + * + * @param urls the urls value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withUrls(List urls) { + this.urls = urls; + return this; + } + + /** + * Get custom sources from which Q-A were extracted or explicitly added to the knowledgebase. + * + * @return the sources value + */ + public List sources() { + return this.sources; + } + + /** + * Set custom sources from which Q-A were extracted or explicitly added to the knowledgebase. + * + * @param sources the sources value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withSources(List sources) { + this.sources = sources; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebaseEnvironmentType.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebaseEnvironmentType.java new file mode 100644 index 000000000000..f086be715c4f --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebaseEnvironmentType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for KnowledgebaseEnvironmentType. + */ +public final class KnowledgebaseEnvironmentType extends ExpandableStringEnum { + /** Static value Prod for KnowledgebaseEnvironmentType. */ + public static final KnowledgebaseEnvironmentType PROD = fromString("Prod"); + + /** Static value Test for KnowledgebaseEnvironmentType. */ + public static final KnowledgebaseEnvironmentType TEST = fromString("Test"); + + /** + * Creates or finds a KnowledgebaseEnvironmentType from its string representation. + * @param name a name to look for + * @return the corresponding KnowledgebaseEnvironmentType + */ + @JsonCreator + public static KnowledgebaseEnvironmentType fromString(String name) { + return fromString(name, KnowledgebaseEnvironmentType.class); + } + + /** + * @return known KnowledgebaseEnvironmentType values + */ + public static Collection values() { + return values(KnowledgebaseEnvironmentType.class); + } +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebaseUpdateHeaders.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebaseUpdateHeaders.java new file mode 100644 index 000000000000..ffe84ecd8bdf --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebaseUpdateHeaders.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Update operation. + */ +public class KnowledgebaseUpdateHeaders { + /** + * Relative URI to the target location of the asynchronous operation. + * Client should poll this resource to get status of the operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get relative URI to the target location of the asynchronous operation. Client should poll this resource to get status of the operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set relative URI to the target location of the asynchronous operation. Client should poll this resource to get status of the operation. + * + * @param location the location value to set + * @return the KnowledgebaseUpdateHeaders object itself. + */ + public KnowledgebaseUpdateHeaders withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebasesDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebasesDTO.java new file mode 100644 index 000000000000..632cd9227938 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/KnowledgebasesDTO.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Collection of knowledgebases owned by a user. + */ +public class KnowledgebasesDTO { + /** + * Collection of knowledgebase records. + */ + @JsonProperty(value = "knowledgebases") + private List knowledgebases; + + /** + * Get collection of knowledgebase records. + * + * @return the knowledgebases value + */ + public List knowledgebases() { + return this.knowledgebases; + } + + /** + * Set collection of knowledgebase records. + * + * @param knowledgebases the knowledgebases value to set + * @return the KnowledgebasesDTO object itself. + */ + public KnowledgebasesDTO withKnowledgebases(List knowledgebases) { + this.knowledgebases = knowledgebases; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/MetadataDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/MetadataDTO.java new file mode 100644 index 000000000000..95f3fbed221c --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/MetadataDTO.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Name - value pair of metadata. + */ +public class MetadataDTO { + /** + * Metadata name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Metadata value. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get metadata name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set metadata name. + * + * @param name the name value to set + * @return the MetadataDTO object itself. + */ + public MetadataDTO withName(String name) { + this.name = name; + return this; + } + + /** + * Get metadata value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set metadata value. + * + * @param value the value value to set + * @return the MetadataDTO object itself. + */ + public MetadataDTO withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/Operation.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/Operation.java new file mode 100644 index 000000000000..2ff799db68ae --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/Operation.java @@ -0,0 +1,200 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Record to track long running operation. + */ +public class Operation { + /** + * Operation state. Possible values include: 'Failed', 'NotStarted', + * 'Running', 'Succeeded'. + */ + @JsonProperty(value = "operationState") + private OperationStateType operationState; + + /** + * Timestamp when the operation was created. + */ + @JsonProperty(value = "createdTimestamp") + private String createdTimestamp; + + /** + * Timestamp when the current state was entered. + */ + @JsonProperty(value = "lastActionTimestamp") + private String lastActionTimestamp; + + /** + * Relative URI to the target resource location for completed resources. + */ + @JsonProperty(value = "resourceLocation") + private String resourceLocation; + + /** + * User Id. + */ + @JsonProperty(value = "userId") + private String userId; + + /** + * Operation Id. + */ + @JsonProperty(value = "operationId") + private String operationId; + + /** + * Error details in case of failures. + */ + @JsonProperty(value = "errorResponse") + private ErrorResponse errorResponse; + + /** + * Get operation state. Possible values include: 'Failed', 'NotStarted', 'Running', 'Succeeded'. + * + * @return the operationState value + */ + public OperationStateType operationState() { + return this.operationState; + } + + /** + * Set operation state. Possible values include: 'Failed', 'NotStarted', 'Running', 'Succeeded'. + * + * @param operationState the operationState value to set + * @return the Operation object itself. + */ + public Operation withOperationState(OperationStateType operationState) { + this.operationState = operationState; + return this; + } + + /** + * Get timestamp when the operation was created. + * + * @return the createdTimestamp value + */ + public String createdTimestamp() { + return this.createdTimestamp; + } + + /** + * Set timestamp when the operation was created. + * + * @param createdTimestamp the createdTimestamp value to set + * @return the Operation object itself. + */ + public Operation withCreatedTimestamp(String createdTimestamp) { + this.createdTimestamp = createdTimestamp; + return this; + } + + /** + * Get timestamp when the current state was entered. + * + * @return the lastActionTimestamp value + */ + public String lastActionTimestamp() { + return this.lastActionTimestamp; + } + + /** + * Set timestamp when the current state was entered. + * + * @param lastActionTimestamp the lastActionTimestamp value to set + * @return the Operation object itself. + */ + public Operation withLastActionTimestamp(String lastActionTimestamp) { + this.lastActionTimestamp = lastActionTimestamp; + return this; + } + + /** + * Get relative URI to the target resource location for completed resources. + * + * @return the resourceLocation value + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Set relative URI to the target resource location for completed resources. + * + * @param resourceLocation the resourceLocation value to set + * @return the Operation object itself. + */ + public Operation withResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + return this; + } + + /** + * Get user Id. + * + * @return the userId value + */ + public String userId() { + return this.userId; + } + + /** + * Set user Id. + * + * @param userId the userId value to set + * @return the Operation object itself. + */ + public Operation withUserId(String userId) { + this.userId = userId; + return this; + } + + /** + * Get operation Id. + * + * @return the operationId value + */ + public String operationId() { + return this.operationId; + } + + /** + * Set operation Id. + * + * @param operationId the operationId value to set + * @return the Operation object itself. + */ + public Operation withOperationId(String operationId) { + this.operationId = operationId; + return this; + } + + /** + * Get error details in case of failures. + * + * @return the errorResponse value + */ + public ErrorResponse errorResponse() { + return this.errorResponse; + } + + /** + * Set error details in case of failures. + * + * @param errorResponse the errorResponse value to set + * @return the Operation object itself. + */ + public Operation withErrorResponse(ErrorResponse errorResponse) { + this.errorResponse = errorResponse; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/OperationState.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/OperationState.java new file mode 100644 index 000000000000..ab9a59536f6a --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/OperationState.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for OperationState. + */ +public enum OperationState { + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value NotStarted. */ + NOT_STARTED("NotStarted"), + + /** Enum value Running. */ + RUNNING("Running"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"); + + /** The actual serialized value for a OperationState instance. */ + private String value; + + OperationState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OperationState instance. + * + * @param value the serialized value to parse. + * @return the parsed OperationState object, or null if unable to parse. + */ + @JsonCreator + public static OperationState fromString(String value) { + OperationState[] items = OperationState.values(); + for (OperationState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/OperationStateType.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/OperationStateType.java new file mode 100644 index 000000000000..029fb5fd35a2 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/OperationStateType.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OperationStateType. + */ +public final class OperationStateType extends ExpandableStringEnum { + /** Static value Failed for OperationStateType. */ + public static final OperationStateType FAILED = fromString("Failed"); + + /** Static value NotStarted for OperationStateType. */ + public static final OperationStateType NOT_STARTED = fromString("NotStarted"); + + /** Static value Running for OperationStateType. */ + public static final OperationStateType RUNNING = fromString("Running"); + + /** Static value Succeeded for OperationStateType. */ + public static final OperationStateType SUCCEEDED = fromString("Succeeded"); + + /** + * Creates or finds a OperationStateType from its string representation. + * @param name a name to look for + * @return the corresponding OperationStateType + */ + @JsonCreator + public static OperationStateType fromString(String name) { + return fromString(name, OperationStateType.class); + } + + /** + * @return known OperationStateType values + */ + public static Collection values() { + return values(OperationStateType.class); + } +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/OperationsGetDetailsHeaders.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/OperationsGetDetailsHeaders.java new file mode 100644 index 000000000000..7f9704ad80bf --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/OperationsGetDetailsHeaders.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for GetDetails operation. + */ +public class OperationsGetDetailsHeaders { + /** + * Indicates how long the client should wait before sending a follow up + * request. The header will be present only if the operation is running or + * has not started yet. + */ + @JsonProperty(value = "RetryAfter") + private Integer retryAfter; + + /** + * Get indicates how long the client should wait before sending a follow up request. The header will be present only if the operation is running or has not started yet. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set indicates how long the client should wait before sending a follow up request. The header will be present only if the operation is running or has not started yet. + * + * @param retryAfter the retryAfter value to set + * @return the OperationsGetDetailsHeaders object itself. + */ + public OperationsGetDetailsHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/QnADTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/QnADTO.java new file mode 100644 index 000000000000..48b36a07fa80 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/QnADTO.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Q-A object. + */ +public class QnADTO { + /** + * Unique id for the Q-A. + */ + @JsonProperty(value = "id") + private Integer id; + + /** + * Answer text. + */ + @JsonProperty(value = "answer", required = true) + private String answer; + + /** + * Source from which Q-A was indexed. eg. + * https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + */ + @JsonProperty(value = "source") + private String source; + + /** + * List of questions associated with the answer. + */ + @JsonProperty(value = "questions", required = true) + private List questions; + + /** + * List of metadata associated with the answer. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Get unique id for the Q-A. + * + * @return the id value + */ + public Integer id() { + return this.id; + } + + /** + * Set unique id for the Q-A. + * + * @param id the id value to set + * @return the QnADTO object itself. + */ + public QnADTO withId(Integer id) { + this.id = id; + return this; + } + + /** + * Get answer text. + * + * @return the answer value + */ + public String answer() { + return this.answer; + } + + /** + * Set answer text. + * + * @param answer the answer value to set + * @return the QnADTO object itself. + */ + public QnADTO withAnswer(String answer) { + this.answer = answer; + return this; + } + + /** + * Get source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + * + * @return the source value + */ + public String source() { + return this.source; + } + + /** + * Set source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + * + * @param source the source value to set + * @return the QnADTO object itself. + */ + public QnADTO withSource(String source) { + this.source = source; + return this; + } + + /** + * Get list of questions associated with the answer. + * + * @return the questions value + */ + public List questions() { + return this.questions; + } + + /** + * Set list of questions associated with the answer. + * + * @param questions the questions value to set + * @return the QnADTO object itself. + */ + public QnADTO withQuestions(List questions) { + this.questions = questions; + return this; + } + + /** + * Get list of metadata associated with the answer. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set list of metadata associated with the answer. + * + * @param metadata the metadata value to set + * @return the QnADTO object itself. + */ + public QnADTO withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/QnADocumentsDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/QnADocumentsDTO.java new file mode 100644 index 000000000000..4804bbcdf093 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/QnADocumentsDTO.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * List of QnADTO. + */ +public class QnADocumentsDTO { + /** + * List of answers. + */ + @JsonProperty(value = "qnaDocuments") + private List qnaDocuments; + + /** + * Get list of answers. + * + * @return the qnaDocuments value + */ + public List qnaDocuments() { + return this.qnaDocuments; + } + + /** + * Set list of answers. + * + * @param qnaDocuments the qnaDocuments value to set + * @return the QnADocumentsDTO object itself. + */ + public QnADocumentsDTO withQnaDocuments(List qnaDocuments) { + this.qnaDocuments = qnaDocuments; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ReplaceKbDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ReplaceKbDTO.java new file mode 100644 index 000000000000..7309341288cf --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ReplaceKbDTO.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Post body schema for Replace KB operation. + */ +public class ReplaceKbDTO { + /** + * List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are + * assigned by the service and should be omitted. + */ + @JsonProperty(value = "qnAList", required = true) + private List qnAList; + + /** + * Get list of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * + * @return the qnAList value + */ + public List qnAList() { + return this.qnAList; + } + + /** + * Set list of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * + * @param qnAList the qnAList value to set + * @return the ReplaceKbDTO object itself. + */ + public ReplaceKbDTO withQnAList(List qnAList) { + this.qnAList = qnAList; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbContentsDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbContentsDTO.java new file mode 100644 index 000000000000..567ab9028fbe --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbContentsDTO.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PATCH body schema for Update operation in Update Kb. + */ +public class UpdateKbContentsDTO { + /** + * Friendly name for the knowledgebase. + */ + @JsonProperty(value = "name") + private String name; + + /** + * List of Q-A (UpdateQnaDTO) to be added to the knowledgebase. + */ + @JsonProperty(value = "qnaList") + private List qnaList; + + /** + * List of existing URLs to be refreshed. The content will be extracted + * again and re-indexed. + */ + @JsonProperty(value = "urls") + private List urls; + + /** + * Get friendly name for the knowledgebase. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set friendly name for the knowledgebase. + * + * @param name the name value to set + * @return the UpdateKbContentsDTO object itself. + */ + public UpdateKbContentsDTO withName(String name) { + this.name = name; + return this; + } + + /** + * Get list of Q-A (UpdateQnaDTO) to be added to the knowledgebase. + * + * @return the qnaList value + */ + public List qnaList() { + return this.qnaList; + } + + /** + * Set list of Q-A (UpdateQnaDTO) to be added to the knowledgebase. + * + * @param qnaList the qnaList value to set + * @return the UpdateKbContentsDTO object itself. + */ + public UpdateKbContentsDTO withQnaList(List qnaList) { + this.qnaList = qnaList; + return this; + } + + /** + * Get list of existing URLs to be refreshed. The content will be extracted again and re-indexed. + * + * @return the urls value + */ + public List urls() { + return this.urls; + } + + /** + * Set list of existing URLs to be refreshed. The content will be extracted again and re-indexed. + * + * @param urls the urls value to set + * @return the UpdateKbContentsDTO object itself. + */ + public UpdateKbContentsDTO withUrls(List urls) { + this.urls = urls; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTO.java new file mode 100644 index 000000000000..76a2ea1903fd --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTO.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains list of QnAs to be updated. + */ +public class UpdateKbOperationDTO { + /** + * An instance of CreateKbInputDTO for add operation. + */ + @JsonProperty(value = "add") + private UpdateKbOperationDTOAdd add; + + /** + * An instance of DeleteKbContentsDTO for delete Operation. + */ + @JsonProperty(value = "delete") + private UpdateKbOperationDTODelete delete; + + /** + * An instance of UpdateKbContentsDTO for Update Operation. + */ + @JsonProperty(value = "update") + private UpdateKbOperationDTOUpdate update; + + /** + * Get an instance of CreateKbInputDTO for add operation. + * + * @return the add value + */ + public UpdateKbOperationDTOAdd add() { + return this.add; + } + + /** + * Set an instance of CreateKbInputDTO for add operation. + * + * @param add the add value to set + * @return the UpdateKbOperationDTO object itself. + */ + public UpdateKbOperationDTO withAdd(UpdateKbOperationDTOAdd add) { + this.add = add; + return this; + } + + /** + * Get an instance of DeleteKbContentsDTO for delete Operation. + * + * @return the delete value + */ + public UpdateKbOperationDTODelete delete() { + return this.delete; + } + + /** + * Set an instance of DeleteKbContentsDTO for delete Operation. + * + * @param delete the delete value to set + * @return the UpdateKbOperationDTO object itself. + */ + public UpdateKbOperationDTO withDelete(UpdateKbOperationDTODelete delete) { + this.delete = delete; + return this; + } + + /** + * Get an instance of UpdateKbContentsDTO for Update Operation. + * + * @return the update value + */ + public UpdateKbOperationDTOUpdate update() { + return this.update; + } + + /** + * Set an instance of UpdateKbContentsDTO for Update Operation. + * + * @param update the update value to set + * @return the UpdateKbOperationDTO object itself. + */ + public UpdateKbOperationDTO withUpdate(UpdateKbOperationDTOUpdate update) { + this.update = update; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTOAdd.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTOAdd.java new file mode 100644 index 000000000000..f1357e231d71 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTOAdd.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + + +/** + * An instance of CreateKbInputDTO for add operation. + */ +public class UpdateKbOperationDTOAdd extends CreateKbInputDTO { +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTODelete.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTODelete.java new file mode 100644 index 000000000000..81ca8cf69407 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTODelete.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + + +/** + * An instance of DeleteKbContentsDTO for delete Operation. + */ +public class UpdateKbOperationDTODelete extends DeleteKbContentsDTO { +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTOUpdate.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTOUpdate.java new file mode 100644 index 000000000000..c75ec4e3603a --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKbOperationDTOUpdate.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + + +/** + * An instance of UpdateKbContentsDTO for Update Operation. + */ +public class UpdateKbOperationDTOUpdate extends UpdateKbContentsDTO { +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKnowledgebaseHeaders.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKnowledgebaseHeaders.java new file mode 100644 index 000000000000..94471ea57027 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateKnowledgebaseHeaders.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Update Knowledgebase operation. + */ +public class UpdateKnowledgebaseHeaders { + /** + * Relative URI to the target location of the asynchronous operation. + * Client should poll this resource to get status of the operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get relative URI to the target location of the asynchronous operation. Client should poll this resource to get status of the operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set relative URI to the target location of the asynchronous operation. Client should poll this resource to get status of the operation. + * + * @param location the location value to set + * @return the UpdateKnowledgebaseHeaders object itself. + */ + public UpdateKnowledgebaseHeaders withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateMetadataDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateMetadataDTO.java new file mode 100644 index 000000000000..71ff072ae728 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateMetadataDTO.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PATCH Body schema to represent list of Metadata to be updated. + */ +public class UpdateMetadataDTO { + /** + * List of Metadata associated with answer to be deleted. + */ + @JsonProperty(value = "delete") + private List delete; + + /** + * List of Metadat associated with answer to be added. + */ + @JsonProperty(value = "add") + private List add; + + /** + * Get list of Metadata associated with answer to be deleted. + * + * @return the delete value + */ + public List delete() { + return this.delete; + } + + /** + * Set list of Metadata associated with answer to be deleted. + * + * @param delete the delete value to set + * @return the UpdateMetadataDTO object itself. + */ + public UpdateMetadataDTO withDelete(List delete) { + this.delete = delete; + return this; + } + + /** + * Get list of Metadat associated with answer to be added. + * + * @return the add value + */ + public List add() { + return this.add; + } + + /** + * Set list of Metadat associated with answer to be added. + * + * @param add the add value to set + * @return the UpdateMetadataDTO object itself. + */ + public UpdateMetadataDTO withAdd(List add) { + this.add = add; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTO.java new file mode 100644 index 000000000000..39b403f8cf77 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTO.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PATCH Body schema for Update Qna List. + */ +public class UpdateQnaDTO { + /** + * Unique id for the Q-A. + */ + @JsonProperty(value = "id") + private Integer id; + + /** + * Answer text. + */ + @JsonProperty(value = "answer") + private String answer; + + /** + * Source from which Q-A was indexed. eg. + * https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + */ + @JsonProperty(value = "source") + private String source; + + /** + * List of questions associated with the answer. + */ + @JsonProperty(value = "questions") + private UpdateQnaDTOQuestions questions; + + /** + * List of metadata associated with the answer to be updated. + */ + @JsonProperty(value = "metadata") + private UpdateQnaDTOMetadata metadata; + + /** + * Get unique id for the Q-A. + * + * @return the id value + */ + public Integer id() { + return this.id; + } + + /** + * Set unique id for the Q-A. + * + * @param id the id value to set + * @return the UpdateQnaDTO object itself. + */ + public UpdateQnaDTO withId(Integer id) { + this.id = id; + return this; + } + + /** + * Get answer text. + * + * @return the answer value + */ + public String answer() { + return this.answer; + } + + /** + * Set answer text. + * + * @param answer the answer value to set + * @return the UpdateQnaDTO object itself. + */ + public UpdateQnaDTO withAnswer(String answer) { + this.answer = answer; + return this; + } + + /** + * Get source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + * + * @return the source value + */ + public String source() { + return this.source; + } + + /** + * Set source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + * + * @param source the source value to set + * @return the UpdateQnaDTO object itself. + */ + public UpdateQnaDTO withSource(String source) { + this.source = source; + return this; + } + + /** + * Get list of questions associated with the answer. + * + * @return the questions value + */ + public UpdateQnaDTOQuestions questions() { + return this.questions; + } + + /** + * Set list of questions associated with the answer. + * + * @param questions the questions value to set + * @return the UpdateQnaDTO object itself. + */ + public UpdateQnaDTO withQuestions(UpdateQnaDTOQuestions questions) { + this.questions = questions; + return this; + } + + /** + * Get list of metadata associated with the answer to be updated. + * + * @return the metadata value + */ + public UpdateQnaDTOMetadata metadata() { + return this.metadata; + } + + /** + * Set list of metadata associated with the answer to be updated. + * + * @param metadata the metadata value to set + * @return the UpdateQnaDTO object itself. + */ + public UpdateQnaDTO withMetadata(UpdateQnaDTOMetadata metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTOMetadata.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTOMetadata.java new file mode 100644 index 000000000000..b020a8b9b56b --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTOMetadata.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + + +/** + * List of metadata associated with the answer to be updated. + */ +public class UpdateQnaDTOMetadata extends UpdateMetadataDTO { +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTOQuestions.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTOQuestions.java new file mode 100644 index 000000000000..244283242559 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTOQuestions.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + + +/** + * List of questions associated with the answer. + */ +public class UpdateQnaDTOQuestions extends UpdateQuestionsDTO { +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQuestionsDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQuestionsDTO.java new file mode 100644 index 000000000000..989dad68f41b --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQuestionsDTO.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PATCH Body schema for Update Kb which contains list of questions to be added + * and deleted. + */ +public class UpdateQuestionsDTO { + /** + * List of questions to be added. + */ + @JsonProperty(value = "add") + private List add; + + /** + * List of questions to be deleted. + */ + @JsonProperty(value = "delete") + private List delete; + + /** + * Get list of questions to be added. + * + * @return the add value + */ + public List add() { + return this.add; + } + + /** + * Set list of questions to be added. + * + * @param add the add value to set + * @return the UpdateQuestionsDTO object itself. + */ + public UpdateQuestionsDTO withAdd(List add) { + this.add = add; + return this; + } + + /** + * Get list of questions to be deleted. + * + * @return the delete value + */ + public List delete() { + return this.delete; + } + + /** + * Set list of questions to be deleted. + * + * @param delete the delete value to set + * @return the UpdateQuestionsDTO object itself. + */ + public UpdateQuestionsDTO withDelete(List delete) { + this.delete = delete; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/WordAlterationsDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/WordAlterationsDTO.java new file mode 100644 index 000000000000..6fefb42c1cf3 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/WordAlterationsDTO.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Collection of word alterations. + */ +public class WordAlterationsDTO { + /** + * Collection of word alterations. + */ + @JsonProperty(value = "wordAlterations", required = true) + private List wordAlterations; + + /** + * Get collection of word alterations. + * + * @return the wordAlterations value + */ + public List wordAlterations() { + return this.wordAlterations; + } + + /** + * Set collection of word alterations. + * + * @param wordAlterations the wordAlterations value to set + * @return the WordAlterationsDTO object itself. + */ + public WordAlterationsDTO withWordAlterations(List wordAlterations) { + this.wordAlterations = wordAlterations; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/package-info.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/package-info.java new file mode 100644 index 000000000000..e6a75733fa37 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the models classes for QnAMakerClient. + * An API for QnAMaker Service. + */ +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models; diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/package-info.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/package-info.java new file mode 100644 index 000000000000..3fb934d575e8 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for QnAMakerClient. + * An API for QnAMaker Service. + */ +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker; diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/QnAMakerClient.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/QnAMakerClient.java new file mode 100644 index 000000000000..f305920e83f8 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/QnAMakerClient.java @@ -0,0 +1,621 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.cognitiveservices.qnamaker.models.AlterationsDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.CreateKbDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.EndpointKeysDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.qnamaker.models.GetOperationDetailsHeaders; +import com.microsoft.azure.cognitiveservices.qnamaker.models.KnowledgebaseDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.KnowledgebasesDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.Operation; +import com.microsoft.azure.cognitiveservices.qnamaker.models.QnADocumentsDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.QnADTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.UpdateKbOperationDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.UpdateKnowledgebaseHeaders; +import com.microsoft.azure.cognitiveservices.qnamaker.models.WordAlterationsDTO; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import rx.Observable; + +/** + * The interface for QnAMakerClient class. + */ +public interface QnAMakerClient { + /** + * Gets the REST client. + * + * @return the {@link RestClient} object. + */ + RestClient restClient(); + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + AzureClient getAzureClient(); + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + String userAgent(); + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).. + * + * @return the endpoint value. + */ + String endpoint(); + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).. + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + QnAMakerClient withEndpoint(String endpoint); + + /** + * Gets The preferred language for the response.. + * + * @return the acceptLanguage value. + */ + String acceptLanguage(); + + /** + * Sets The preferred language for the response.. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + QnAMakerClient withAcceptLanguage(String acceptLanguage); + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @return the longRunningOperationRetryTimeout value. + */ + int longRunningOperationRetryTimeout(); + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + QnAMakerClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @return the generateClientRequestId value. + */ + boolean generateClientRequestId(); + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + QnAMakerClient withGenerateClientRequestId(boolean generateClientRequestId); + + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EndpointKeysDTO object if successful. + */ + EndpointKeysDTO getEndpointKeys(); + + /** + * Gets endpoint keys for an endpoint. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getEndpointKeysAsync(final ServiceCallback serviceCallback); + + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + Observable getEndpointKeysAsync(); + + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + Observable> getEndpointKeysWithServiceResponseAsync(); + + /** + * Re-generates an endpoint key. + * + * @param keyType type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EndpointKeysDTO object if successful. + */ + EndpointKeysDTO refreshEndpointKeys(String keyType); + + /** + * Re-generates an endpoint key. + * + * @param keyType type of Key + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture refreshEndpointKeysAsync(String keyType, final ServiceCallback serviceCallback); + + /** + * Re-generates an endpoint key. + * + * @param keyType type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + Observable refreshEndpointKeysAsync(String keyType); + + /** + * Re-generates an endpoint key. + * + * @param keyType type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + Observable> refreshEndpointKeysWithServiceResponseAsync(String keyType); + + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WordAlterationsDTO object if successful. + */ + WordAlterationsDTO downloadAlterations(); + + /** + * Download alterations from runtime. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture downloadAlterationsAsync(final ServiceCallback serviceCallback); + + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WordAlterationsDTO object + */ + Observable downloadAlterationsAsync(); + + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WordAlterationsDTO object + */ + Observable> downloadAlterationsWithServiceResponseAsync(); + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void replaceAlterations(List wordAlterations); + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture replaceAlterationsAsync(List wordAlterations, final ServiceCallback serviceCallback); + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable replaceAlterationsAsync(List wordAlterations); + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> replaceAlterationsWithServiceResponseAsync(List wordAlterations); + + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KnowledgebasesDTO object if successful. + */ + KnowledgebasesDTO getKnowledgebasesForUser(); + + /** + * Gets all knowledgebases for a user. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getKnowledgebasesForUserAsync(final ServiceCallback serviceCallback); + + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebasesDTO object + */ + Observable getKnowledgebasesForUserAsync(); + + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebasesDTO object + */ + Observable> getKnowledgebasesForUserWithServiceResponseAsync(); + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + Operation getOperationDetails(String operationId); + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getOperationDetailsAsync(String operationId, final ServiceCallback serviceCallback); + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable getOperationDetailsAsync(String operationId); + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable> getOperationDetailsWithServiceResponseAsync(String operationId); + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KnowledgebaseDTO object if successful. + */ + KnowledgebaseDTO getKnowledgebaseDetails(String kbId); + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture getKnowledgebaseDetailsAsync(String kbId, final ServiceCallback serviceCallback); + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebaseDTO object + */ + Observable getKnowledgebaseDetailsAsync(String kbId); + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebaseDTO object + */ + Observable> getKnowledgebaseDetailsWithServiceResponseAsync(String kbId); + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void deleteKnowledgebase(String kbId); + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture deleteKnowledgebaseAsync(String kbId, final ServiceCallback serviceCallback); + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable deleteKnowledgebaseAsync(String kbId); + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> deleteKnowledgebaseWithServiceResponseAsync(String kbId); + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void publishKnowledgebase(String kbId); + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture publishKnowledgebaseAsync(String kbId, final ServiceCallback serviceCallback); + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable publishKnowledgebaseAsync(String kbId); + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> publishKnowledgebaseWithServiceResponseAsync(String kbId); + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void replaceKnowledgebase(String kbId, List qnAList); + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture replaceKnowledgebaseAsync(String kbId, List qnAList, final ServiceCallback serviceCallback); + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable replaceKnowledgebaseAsync(String kbId, List qnAList); + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> replaceKnowledgebaseWithServiceResponseAsync(String kbId, List qnAList); + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + Operation updateKnowledgebase(String kbId, UpdateKbOperationDTO updateKb); + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture updateKnowledgebaseAsync(String kbId, UpdateKbOperationDTO updateKb, final ServiceCallback serviceCallback); + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable updateKnowledgebaseAsync(String kbId, UpdateKbOperationDTO updateKb); + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable> updateKnowledgebaseWithServiceResponseAsync(String kbId, UpdateKbOperationDTO updateKb); + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + Operation createKnowledgebase(CreateKbDTO createKbPayload); + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture createKnowledgebaseAsync(CreateKbDTO createKbPayload, final ServiceCallback serviceCallback); + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable createKnowledgebaseAsync(CreateKbDTO createKbPayload); + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + Observable> createKnowledgebaseWithServiceResponseAsync(CreateKbDTO createKbPayload); + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the QnADocumentsDTO object if successful. + */ + QnADocumentsDTO downloadKnowledgebase(String kbId, String environment); + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture downloadKnowledgebaseAsync(String kbId, String environment, final ServiceCallback serviceCallback); + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QnADocumentsDTO object + */ + Observable downloadKnowledgebaseAsync(String kbId, String environment); + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QnADocumentsDTO object + */ + Observable> downloadKnowledgebaseWithServiceResponseAsync(String kbId, String environment); + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/implementation/QnAMakerClientImpl.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/implementation/QnAMakerClientImpl.java new file mode 100644 index 000000000000..090624f908cd --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/implementation/QnAMakerClientImpl.java @@ -0,0 +1,1278 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.implementation; + +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.cognitiveservices.qnamaker.models.AlterationsDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.CreateKbDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.EndpointKeysDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.qnamaker.models.GetOperationDetailsHeaders; +import com.microsoft.azure.cognitiveservices.qnamaker.models.KnowledgebaseDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.KnowledgebasesDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.Operation; +import com.microsoft.azure.cognitiveservices.qnamaker.models.QnADocumentsDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.QnADTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.ReplaceKbDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.UpdateKbOperationDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.models.UpdateKnowledgebaseHeaders; +import com.microsoft.azure.cognitiveservices.qnamaker.models.WordAlterationsDTO; +import com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * Initializes a new instance of the QnAMakerClientImpl class. + */ +public class QnAMakerClientImpl extends AzureServiceClient implements QnAMakerClient { + /** The Retrofit service to perform REST calls. */ + private QnAMakerClientService service; + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). */ + private String endpoint; + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + public QnAMakerClientImpl withEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public QnAMakerClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public QnAMakerClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public QnAMakerClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * Initializes an instance of QnAMakerClient client. + * + * @param credentials the management credentials for Azure + */ + public QnAMakerClientImpl(ServiceClientCredentials credentials) { + this("https://{Endpoint}/qnamaker/v4.0", credentials); + } + + /** + * Initializes an instance of QnAMakerClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + private QnAMakerClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of QnAMakerClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public QnAMakerClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.azureClient = new AzureClient(this); + initializeService(); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "QnAMakerClient", "4.0"); + } + + private void initializeService() { + service = restClient().retrofit().create(QnAMakerClientService.class); + } + + /** + * The interface defining all the services for QnAMakerClient to be + * used by Retrofit to perform actually REST calls. + */ + interface QnAMakerClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient getEndpointKeys" }) + @GET("endpointkeys") + Observable> getEndpointKeys(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient refreshEndpointKeys" }) + @PATCH("endpointkeys/{keyType}") + Observable> refreshEndpointKeys(@Path("keyType") String keyType, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient downloadAlterations" }) + @GET("alterations") + Observable> downloadAlterations(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient replaceAlterations" }) + @PUT("alterations") + Observable> replaceAlterations(@Header("accept-language") String acceptLanguage, @Body WordAlterationsDTO wordAlterations, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient getKnowledgebasesForUser" }) + @GET("knowledgebases") + Observable> getKnowledgebasesForUser(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient getOperationDetails" }) + @GET("operations/{operationId}") + Observable> getOperationDetails(@Path("operationId") String operationId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient getKnowledgebaseDetails" }) + @GET("knowledgebases/{kbId}") + Observable> getKnowledgebaseDetails(@Path("kbId") String kbId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient deleteKnowledgebase" }) + @HTTP(path = "knowledgebases/{kbId}", method = "DELETE", hasBody = true) + Observable> deleteKnowledgebase(@Path("kbId") String kbId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient publishKnowledgebase" }) + @POST("knowledgebases/{kbId}") + Observable> publishKnowledgebase(@Path("kbId") String kbId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient replaceKnowledgebase" }) + @PUT("knowledgebases/{kbId}") + Observable> replaceKnowledgebase(@Path("kbId") String kbId, @Header("accept-language") String acceptLanguage, @Body ReplaceKbDTO replaceKb, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient updateKnowledgebase" }) + @PATCH("knowledgebases/{kbId}") + Observable> updateKnowledgebase(@Path("kbId") String kbId, @Body UpdateKbOperationDTO updateKb, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient createKnowledgebase" }) + @POST("knowledgebases/create") + Observable> createKnowledgebase(@Body CreateKbDTO createKbPayload, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.qnamaker.QnAMakerClient downloadKnowledgebase" }) + @GET("knowledgebases/{kbId}/{environment}/qna") + Observable> downloadKnowledgebase(@Path("kbId") String kbId, @Path("environment") String environment, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EndpointKeysDTO object if successful. + */ + public EndpointKeysDTO getEndpointKeys() { + return getEndpointKeysWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets endpoint keys for an endpoint. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getEndpointKeysAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getEndpointKeysWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + public Observable getEndpointKeysAsync() { + return getEndpointKeysWithServiceResponseAsync().map(new Func1, EndpointKeysDTO>() { + @Override + public EndpointKeysDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets endpoint keys for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + public Observable> getEndpointKeysWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.getEndpointKeys(this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getEndpointKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getEndpointKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Re-generates an endpoint key. + * + * @param keyType type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EndpointKeysDTO object if successful. + */ + public EndpointKeysDTO refreshEndpointKeys(String keyType) { + return refreshEndpointKeysWithServiceResponseAsync(keyType).toBlocking().single().body(); + } + + /** + * Re-generates an endpoint key. + * + * @param keyType type of Key + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture refreshEndpointKeysAsync(String keyType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(refreshEndpointKeysWithServiceResponseAsync(keyType), serviceCallback); + } + + /** + * Re-generates an endpoint key. + * + * @param keyType type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + public Observable refreshEndpointKeysAsync(String keyType) { + return refreshEndpointKeysWithServiceResponseAsync(keyType).map(new Func1, EndpointKeysDTO>() { + @Override + public EndpointKeysDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Re-generates an endpoint key. + * + * @param keyType type of Key + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointKeysDTO object + */ + public Observable> refreshEndpointKeysWithServiceResponseAsync(String keyType) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (keyType == null) { + throw new IllegalArgumentException("Parameter keyType is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.refreshEndpointKeys(keyType, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = refreshEndpointKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse refreshEndpointKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WordAlterationsDTO object if successful. + */ + public WordAlterationsDTO downloadAlterations() { + return downloadAlterationsWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Download alterations from runtime. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture downloadAlterationsAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(downloadAlterationsWithServiceResponseAsync(), serviceCallback); + } + + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WordAlterationsDTO object + */ + public Observable downloadAlterationsAsync() { + return downloadAlterationsWithServiceResponseAsync().map(new Func1, WordAlterationsDTO>() { + @Override + public WordAlterationsDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Download alterations from runtime. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WordAlterationsDTO object + */ + public Observable> downloadAlterationsWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.downloadAlterations(this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = downloadAlterationsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse downloadAlterationsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void replaceAlterations(List wordAlterations) { + replaceAlterationsWithServiceResponseAsync(wordAlterations).toBlocking().single().body(); + } + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture replaceAlterationsAsync(List wordAlterations, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(replaceAlterationsWithServiceResponseAsync(wordAlterations), serviceCallback); + } + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable replaceAlterationsAsync(List wordAlterations) { + return replaceAlterationsWithServiceResponseAsync(wordAlterations).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Replace alterations data. + * + * @param wordAlterations Collection of word alterations. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> replaceAlterationsWithServiceResponseAsync(List wordAlterations) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (wordAlterations == null) { + throw new IllegalArgumentException("Parameter wordAlterations is required and cannot be null."); + } + Validator.validate(wordAlterations); + WordAlterationsDTO wordAlterations1 = new WordAlterationsDTO(); + wordAlterations1.withWordAlterations(wordAlterations); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.replaceAlterations(this.acceptLanguage(), wordAlterations1, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = replaceAlterationsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse replaceAlterationsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KnowledgebasesDTO object if successful. + */ + public KnowledgebasesDTO getKnowledgebasesForUser() { + return getKnowledgebasesForUserWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets all knowledgebases for a user. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getKnowledgebasesForUserAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getKnowledgebasesForUserWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebasesDTO object + */ + public Observable getKnowledgebasesForUserAsync() { + return getKnowledgebasesForUserWithServiceResponseAsync().map(new Func1, KnowledgebasesDTO>() { + @Override + public KnowledgebasesDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets all knowledgebases for a user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebasesDTO object + */ + public Observable> getKnowledgebasesForUserWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.getKnowledgebasesForUser(this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getKnowledgebasesForUserDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getKnowledgebasesForUserDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + public Operation getOperationDetails(String operationId) { + return getOperationDetailsWithServiceResponseAsync(operationId).toBlocking().single().body(); + } + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getOperationDetailsAsync(String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(getOperationDetailsWithServiceResponseAsync(operationId), serviceCallback); + } + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable getOperationDetailsAsync(String operationId) { + return getOperationDetailsWithServiceResponseAsync(operationId).map(new Func1, Operation>() { + @Override + public Operation call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets details of a specific long running operation. + * + * @param operationId Operation id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable> getOperationDetailsWithServiceResponseAsync(String operationId) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.getOperationDetails(operationId, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = getOperationDetailsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders getOperationDetailsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, GetOperationDetailsHeaders.class); + } + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the KnowledgebaseDTO object if successful. + */ + public KnowledgebaseDTO getKnowledgebaseDetails(String kbId) { + return getKnowledgebaseDetailsWithServiceResponseAsync(kbId).toBlocking().single().body(); + } + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getKnowledgebaseDetailsAsync(String kbId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getKnowledgebaseDetailsWithServiceResponseAsync(kbId), serviceCallback); + } + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebaseDTO object + */ + public Observable getKnowledgebaseDetailsAsync(String kbId) { + return getKnowledgebaseDetailsWithServiceResponseAsync(kbId).map(new Func1, KnowledgebaseDTO>() { + @Override + public KnowledgebaseDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets details of a specific knowledgebase. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KnowledgebaseDTO object + */ + public Observable> getKnowledgebaseDetailsWithServiceResponseAsync(String kbId) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.getKnowledgebaseDetails(kbId, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getKnowledgebaseDetailsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getKnowledgebaseDetailsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteKnowledgebase(String kbId) { + deleteKnowledgebaseWithServiceResponseAsync(kbId).toBlocking().single().body(); + } + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteKnowledgebaseAsync(String kbId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteKnowledgebaseWithServiceResponseAsync(kbId), serviceCallback); + } + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteKnowledgebaseAsync(String kbId) { + return deleteKnowledgebaseWithServiceResponseAsync(kbId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the knowledgebase and all its data. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteKnowledgebaseWithServiceResponseAsync(String kbId) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.deleteKnowledgebase(kbId, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteKnowledgebaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteKnowledgebaseDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void publishKnowledgebase(String kbId) { + publishKnowledgebaseWithServiceResponseAsync(kbId).toBlocking().single().body(); + } + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture publishKnowledgebaseAsync(String kbId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(publishKnowledgebaseWithServiceResponseAsync(kbId), serviceCallback); + } + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable publishKnowledgebaseAsync(String kbId) { + return publishKnowledgebaseWithServiceResponseAsync(kbId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Publishes all changes in test index of a knowledgebase to its prod index. + * + * @param kbId Knowledgebase id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> publishKnowledgebaseWithServiceResponseAsync(String kbId) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.publishKnowledgebase(kbId, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = publishKnowledgebaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse publishKnowledgebaseDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void replaceKnowledgebase(String kbId, List qnAList) { + replaceKnowledgebaseWithServiceResponseAsync(kbId, qnAList).toBlocking().single().body(); + } + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture replaceKnowledgebaseAsync(String kbId, List qnAList, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(replaceKnowledgebaseWithServiceResponseAsync(kbId, qnAList), serviceCallback); + } + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable replaceKnowledgebaseAsync(String kbId, List qnAList) { + return replaceKnowledgebaseWithServiceResponseAsync(kbId, qnAList).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Replace knowledgebase contents. + * + * @param kbId Knowledgebase id. + * @param qnAList List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> replaceKnowledgebaseWithServiceResponseAsync(String kbId, List qnAList) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + if (qnAList == null) { + throw new IllegalArgumentException("Parameter qnAList is required and cannot be null."); + } + Validator.validate(qnAList); + ReplaceKbDTO replaceKb = new ReplaceKbDTO(); + replaceKb.withQnAList(qnAList); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.replaceKnowledgebase(kbId, this.acceptLanguage(), replaceKb, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = replaceKnowledgebaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse replaceKnowledgebaseDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + public Operation updateKnowledgebase(String kbId, UpdateKbOperationDTO updateKb) { + return updateKnowledgebaseWithServiceResponseAsync(kbId, updateKb).toBlocking().single().body(); + } + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateKnowledgebaseAsync(String kbId, UpdateKbOperationDTO updateKb, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateKnowledgebaseWithServiceResponseAsync(kbId, updateKb), serviceCallback); + } + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable updateKnowledgebaseAsync(String kbId, UpdateKbOperationDTO updateKb) { + return updateKnowledgebaseWithServiceResponseAsync(kbId, updateKb).map(new Func1, Operation>() { + @Override + public Operation call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Asynchronous operation to modify a knowledgebase. + * + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable> updateKnowledgebaseWithServiceResponseAsync(String kbId, UpdateKbOperationDTO updateKb) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + if (updateKb == null) { + throw new IllegalArgumentException("Parameter updateKb is required and cannot be null."); + } + Validator.validate(updateKb); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.updateKnowledgebase(kbId, updateKb, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = updateKnowledgebaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders updateKnowledgebaseDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, UpdateKnowledgebaseHeaders.class); + } + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Operation object if successful. + */ + public Operation createKnowledgebase(CreateKbDTO createKbPayload) { + return createKnowledgebaseWithServiceResponseAsync(createKbPayload).toBlocking().single().body(); + } + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createKnowledgebaseAsync(CreateKbDTO createKbPayload, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createKnowledgebaseWithServiceResponseAsync(createKbPayload), serviceCallback); + } + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable createKnowledgebaseAsync(CreateKbDTO createKbPayload) { + return createKnowledgebaseWithServiceResponseAsync(createKbPayload).map(new Func1, Operation>() { + @Override + public Operation call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Asynchronous operation to create a new knowledgebase. + * + * @param createKbPayload Post body of the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Operation object + */ + public Observable> createKnowledgebaseWithServiceResponseAsync(CreateKbDTO createKbPayload) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (createKbPayload == null) { + throw new IllegalArgumentException("Parameter createKbPayload is required and cannot be null."); + } + Validator.validate(createKbPayload); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.createKnowledgebase(createKbPayload, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createKnowledgebaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createKnowledgebaseDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the QnADocumentsDTO object if successful. + */ + public QnADocumentsDTO downloadKnowledgebase(String kbId, String environment) { + return downloadKnowledgebaseWithServiceResponseAsync(kbId, environment).toBlocking().single().body(); + } + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture downloadKnowledgebaseAsync(String kbId, String environment, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(downloadKnowledgebaseWithServiceResponseAsync(kbId, environment), serviceCallback); + } + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QnADocumentsDTO object + */ + public Observable downloadKnowledgebaseAsync(String kbId, String environment) { + return downloadKnowledgebaseWithServiceResponseAsync(kbId, environment).map(new Func1, QnADocumentsDTO>() { + @Override + public QnADocumentsDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Download the knowledgebase. + * + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: 'Prod', 'Test' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QnADocumentsDTO object + */ + public Observable> downloadKnowledgebaseWithServiceResponseAsync(String kbId, String environment) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (kbId == null) { + throw new IllegalArgumentException("Parameter kbId is required and cannot be null."); + } + if (environment == null) { + throw new IllegalArgumentException("Parameter environment is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.downloadKnowledgebase(kbId, environment, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = downloadKnowledgebaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse downloadKnowledgebaseDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/implementation/package-info.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/implementation/package-info.java new file mode 100644 index 000000000000..c94908207eae --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for QnAMakerClient. + * An API for QnAMaker Service. + */ +package com.microsoft.azure.cognitiveservices.qnamaker.implementation; diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/AlterationsDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/AlterationsDTO.java new file mode 100644 index 000000000000..f5d44800287e --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/AlterationsDTO.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Collection of words that are synonyms. + */ +public class AlterationsDTO { + /** + * Words that are synonymous with each other. + */ + @JsonProperty(value = "alterations", required = true) + private List alterations; + + /** + * Get words that are synonymous with each other. + * + * @return the alterations value + */ + public List alterations() { + return this.alterations; + } + + /** + * Set words that are synonymous with each other. + * + * @param alterations the alterations value to set + * @return the AlterationsDTO object itself. + */ + public AlterationsDTO withAlterations(List alterations) { + this.alterations = alterations; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/CreateKbDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/CreateKbDTO.java new file mode 100644 index 000000000000..3f57b08cc4e6 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/CreateKbDTO.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Post body schema for CreateKb operation. + */ +public class CreateKbDTO { + /** + * Friendly name for the knowledgebase. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are + * assigned by the service and should be omitted. + */ + @JsonProperty(value = "qnaList") + private List qnaList; + + /** + * List of URLs to be used for extracting Q-A. + */ + @JsonProperty(value = "urls") + private List urls; + + /** + * List of files from which to Extract Q-A. + */ + @JsonProperty(value = "files") + private List files; + + /** + * Get friendly name for the knowledgebase. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set friendly name for the knowledgebase. + * + * @param name the name value to set + * @return the CreateKbDTO object itself. + */ + public CreateKbDTO withName(String name) { + this.name = name; + return this; + } + + /** + * Get list of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * + * @return the qnaList value + */ + public List qnaList() { + return this.qnaList; + } + + /** + * Set list of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * + * @param qnaList the qnaList value to set + * @return the CreateKbDTO object itself. + */ + public CreateKbDTO withQnaList(List qnaList) { + this.qnaList = qnaList; + return this; + } + + /** + * Get list of URLs to be used for extracting Q-A. + * + * @return the urls value + */ + public List urls() { + return this.urls; + } + + /** + * Set list of URLs to be used for extracting Q-A. + * + * @param urls the urls value to set + * @return the CreateKbDTO object itself. + */ + public CreateKbDTO withUrls(List urls) { + this.urls = urls; + return this; + } + + /** + * Get list of files from which to Extract Q-A. + * + * @return the files value + */ + public List files() { + return this.files; + } + + /** + * Set list of files from which to Extract Q-A. + * + * @param files the files value to set + * @return the CreateKbDTO object itself. + */ + public CreateKbDTO withFiles(List files) { + this.files = files; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/CreateKbInputDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/CreateKbInputDTO.java new file mode 100644 index 000000000000..1e16a7fd3d85 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/CreateKbInputDTO.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Input to create KB. + */ +public class CreateKbInputDTO { + /** + * list of QNA to be added to the index. Ids are generated by the service + * and should be omitted. + */ + @JsonProperty(value = "qnaList") + private List qnaList; + + /** + * List of URLs to be added to knowledgebase. + */ + @JsonProperty(value = "urls") + private List urls; + + /** + * List of files to be added to knowledgebase. + */ + @JsonProperty(value = "files") + private List files; + + /** + * Get list of QNA to be added to the index. Ids are generated by the service and should be omitted. + * + * @return the qnaList value + */ + public List qnaList() { + return this.qnaList; + } + + /** + * Set list of QNA to be added to the index. Ids are generated by the service and should be omitted. + * + * @param qnaList the qnaList value to set + * @return the CreateKbInputDTO object itself. + */ + public CreateKbInputDTO withQnaList(List qnaList) { + this.qnaList = qnaList; + return this; + } + + /** + * Get list of URLs to be added to knowledgebase. + * + * @return the urls value + */ + public List urls() { + return this.urls; + } + + /** + * Set list of URLs to be added to knowledgebase. + * + * @param urls the urls value to set + * @return the CreateKbInputDTO object itself. + */ + public CreateKbInputDTO withUrls(List urls) { + this.urls = urls; + return this; + } + + /** + * Get list of files to be added to knowledgebase. + * + * @return the files value + */ + public List files() { + return this.files; + } + + /** + * Set list of files to be added to knowledgebase. + * + * @param files the files value to set + * @return the CreateKbInputDTO object itself. + */ + public CreateKbInputDTO withFiles(List files) { + this.files = files; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/DeleteKbContentsDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/DeleteKbContentsDTO.java new file mode 100644 index 000000000000..dc60635e4a81 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/DeleteKbContentsDTO.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PATCH body schema of Delete Operation in UpdateKb. + */ +public class DeleteKbContentsDTO { + /** + * List of Qna Ids to be deleted. + */ + @JsonProperty(value = "ids") + private List ids; + + /** + * List of sources to be deleted from knowledgebase. + */ + @JsonProperty(value = "sources") + private List sources; + + /** + * Get list of Qna Ids to be deleted. + * + * @return the ids value + */ + public List ids() { + return this.ids; + } + + /** + * Set list of Qna Ids to be deleted. + * + * @param ids the ids value to set + * @return the DeleteKbContentsDTO object itself. + */ + public DeleteKbContentsDTO withIds(List ids) { + this.ids = ids; + return this; + } + + /** + * Get list of sources to be deleted from knowledgebase. + * + * @return the sources value + */ + public List sources() { + return this.sources; + } + + /** + * Set list of sources to be deleted from knowledgebase. + * + * @param sources the sources value to set + * @return the DeleteKbContentsDTO object itself. + */ + public DeleteKbContentsDTO withSources(List sources) { + this.sources = sources; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/EndpointKeysDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/EndpointKeysDTO.java new file mode 100644 index 000000000000..914474f3dea3 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/EndpointKeysDTO.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Schema for EndpointKeys generate/refresh operations. + */ +public class EndpointKeysDTO { + /** + * Primary Access Key. + */ + @JsonProperty(value = "primaryEndpointKey") + private String primaryEndpointKey; + + /** + * Secondary Access Key. + */ + @JsonProperty(value = "secondaryEndpointKey") + private String secondaryEndpointKey; + + /** + * Current version of runtime. + */ + @JsonProperty(value = "installedVersion") + private String installedVersion; + + /** + * Latest version of runtime. + */ + @JsonProperty(value = "lastStableVersion") + private String lastStableVersion; + + /** + * Get primary Access Key. + * + * @return the primaryEndpointKey value + */ + public String primaryEndpointKey() { + return this.primaryEndpointKey; + } + + /** + * Set primary Access Key. + * + * @param primaryEndpointKey the primaryEndpointKey value to set + * @return the EndpointKeysDTO object itself. + */ + public EndpointKeysDTO withPrimaryEndpointKey(String primaryEndpointKey) { + this.primaryEndpointKey = primaryEndpointKey; + return this; + } + + /** + * Get secondary Access Key. + * + * @return the secondaryEndpointKey value + */ + public String secondaryEndpointKey() { + return this.secondaryEndpointKey; + } + + /** + * Set secondary Access Key. + * + * @param secondaryEndpointKey the secondaryEndpointKey value to set + * @return the EndpointKeysDTO object itself. + */ + public EndpointKeysDTO withSecondaryEndpointKey(String secondaryEndpointKey) { + this.secondaryEndpointKey = secondaryEndpointKey; + return this; + } + + /** + * Get current version of runtime. + * + * @return the installedVersion value + */ + public String installedVersion() { + return this.installedVersion; + } + + /** + * Set current version of runtime. + * + * @param installedVersion the installedVersion value to set + * @return the EndpointKeysDTO object itself. + */ + public EndpointKeysDTO withInstalledVersion(String installedVersion) { + this.installedVersion = installedVersion; + return this; + } + + /** + * Get latest version of runtime. + * + * @return the lastStableVersion value + */ + public String lastStableVersion() { + return this.lastStableVersion; + } + + /** + * Set latest version of runtime. + * + * @param lastStableVersion the lastStableVersion value to set + * @return the EndpointKeysDTO object itself. + */ + public EndpointKeysDTO withLastStableVersion(String lastStableVersion) { + this.lastStableVersion = lastStableVersion; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/Error.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/Error.java new file mode 100644 index 000000000000..595cb41eb239 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/Error.java @@ -0,0 +1,155 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The error object. As per Microsoft One API guidelines - + * https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + */ +public class Error { + /** + * One of a server-defined set of error codes. Possible values include: + * 'BadArgument', 'Forbidden', 'NotFound', 'KbNotFound', 'Unauthorized', + * 'Unspecified', 'EndpointKeysError', 'QuotaExceeded', 'QnaRuntimeError', + * 'SKULimitExceeded', 'OperationNotFound', 'ServiceError', + * 'ValidationFailure', 'ExtractionFailure'. + */ + @JsonProperty(value = "code", required = true) + private String code; + + /** + * A human-readable representation of the error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * The target of the error. + */ + @JsonProperty(value = "target") + private String target; + + /** + * An array of details about specific errors that led to this reported + * error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * An object containing more specific information than the current object + * about the error. + */ + @JsonProperty(value = "innerError") + private InnerErrorModel innerError; + + /** + * Get one of a server-defined set of error codes. Possible values include: 'BadArgument', 'Forbidden', 'NotFound', 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', 'OperationNotFound', 'ServiceError', 'ValidationFailure', 'ExtractionFailure'. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set one of a server-defined set of error codes. Possible values include: 'BadArgument', 'Forbidden', 'NotFound', 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', 'OperationNotFound', 'ServiceError', 'ValidationFailure', 'ExtractionFailure'. + * + * @param code the code value to set + * @return the Error object itself. + */ + public Error withCode(String code) { + this.code = code; + return this; + } + + /** + * Get a human-readable representation of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set a human-readable representation of the error. + * + * @param message the message value to set + * @return the Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the target of the error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set the target of the error. + * + * @param target the target value to set + * @return the Error object itself. + */ + public Error withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get an array of details about specific errors that led to this reported error. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set an array of details about specific errors that led to this reported error. + * + * @param details the details value to set + * @return the Error object itself. + */ + public Error withDetails(List details) { + this.details = details; + return this; + } + + /** + * Get an object containing more specific information than the current object about the error. + * + * @return the innerError value + */ + public InnerErrorModel innerError() { + return this.innerError; + } + + /** + * Set an object containing more specific information than the current object about the error. + * + * @param innerError the innerError value to set + * @return the Error object itself. + */ + public Error withInnerError(InnerErrorModel innerError) { + this.innerError = innerError; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ErrorResponse.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ErrorResponse.java new file mode 100644 index 000000000000..eb1d4773099a --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response. As per Microsoft One API guidelines - + * https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + */ +public class ErrorResponse { + /** + * The error object. + */ + @JsonProperty(value = "error") + private ErrorResponseError error; + + /** + * Get the error object. + * + * @return the error value + */ + public ErrorResponseError error() { + return this.error; + } + + /** + * Set the error object. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorResponseError error) { + this.error = error; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ErrorResponseError.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ErrorResponseError.java new file mode 100644 index 000000000000..07845e5aa7cb --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ErrorResponseError.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + + +/** + * The error object. + */ +public class ErrorResponseError extends Error { +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ErrorResponseException.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ErrorResponseException.java new file mode 100644 index 000000000000..0257f66154a5 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/FileDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/FileDTO.java new file mode 100644 index 000000000000..14996cd06644 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/FileDTO.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * DTO to hold details of uploaded files. + */ +public class FileDTO { + /** + * File name. Supported file types are ".tsv", ".pdf", ".txt", ".docx", + * ".xlsx". + */ + @JsonProperty(value = "fileName", required = true) + private String fileName; + + /** + * Public URI of the file. + */ + @JsonProperty(value = "fileUri", required = true) + private String fileUri; + + /** + * Get file name. Supported file types are ".tsv", ".pdf", ".txt", ".docx", ".xlsx". + * + * @return the fileName value + */ + public String fileName() { + return this.fileName; + } + + /** + * Set file name. Supported file types are ".tsv", ".pdf", ".txt", ".docx", ".xlsx". + * + * @param fileName the fileName value to set + * @return the FileDTO object itself. + */ + public FileDTO withFileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get public URI of the file. + * + * @return the fileUri value + */ + public String fileUri() { + return this.fileUri; + } + + /** + * Set public URI of the file. + * + * @param fileUri the fileUri value to set + * @return the FileDTO object itself. + */ + public FileDTO withFileUri(String fileUri) { + this.fileUri = fileUri; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/GetOperationDetailsHeaders.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/GetOperationDetailsHeaders.java new file mode 100644 index 000000000000..6d7654ea3da6 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/GetOperationDetailsHeaders.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Get Operation Details operation. + */ +public class GetOperationDetailsHeaders { + /** + * Indicates how long the client should wait before sending a follow up + * request. The header will be present only if the operation is running or + * has not started yet. + */ + @JsonProperty(value = "RetryAfter") + private Integer retryAfter; + + /** + * Get indicates how long the client should wait before sending a follow up request. The header will be present only if the operation is running or has not started yet. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set indicates how long the client should wait before sending a follow up request. The header will be present only if the operation is running or has not started yet. + * + * @param retryAfter the retryAfter value to set + * @return the GetOperationDetailsHeaders object itself. + */ + public GetOperationDetailsHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/InnerErrorModel.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/InnerErrorModel.java new file mode 100644 index 000000000000..a1ecc7a4225b --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/InnerErrorModel.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object containing more specific information about the error. As per + * Microsoft One API guidelines - + * https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + */ +public class InnerErrorModel { + /** + * A more specific error code than was provided by the containing error. + */ + @JsonProperty(value = "code") + private String code; + + /** + * An object containing more specific information than the current object + * about the error. + */ + @JsonProperty(value = "innerError") + private InnerErrorModel innerError; + + /** + * Get a more specific error code than was provided by the containing error. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set a more specific error code than was provided by the containing error. + * + * @param code the code value to set + * @return the InnerErrorModel object itself. + */ + public InnerErrorModel withCode(String code) { + this.code = code; + return this; + } + + /** + * Get an object containing more specific information than the current object about the error. + * + * @return the innerError value + */ + public InnerErrorModel innerError() { + return this.innerError; + } + + /** + * Set an object containing more specific information than the current object about the error. + * + * @param innerError the innerError value to set + * @return the InnerErrorModel object itself. + */ + public InnerErrorModel withInnerError(InnerErrorModel innerError) { + this.innerError = innerError; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/KnowledgebaseDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/KnowledgebaseDTO.java new file mode 100644 index 000000000000..bce0e1603937 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/KnowledgebaseDTO.java @@ -0,0 +1,254 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response schema for CreateKb operation. + */ +public class KnowledgebaseDTO { + /** + * Unique id that identifies a knowledgebase. + */ + @JsonProperty(value = "id") + private String id; + + /** + * URL host name at which the knowledgebase is hosted. + */ + @JsonProperty(value = "hostName") + private String hostName; + + /** + * Time stamp at which the knowledgebase was last accessed (UTC). + */ + @JsonProperty(value = "lastAccessedTimestamp") + private String lastAccessedTimestamp; + + /** + * Time stamp at which the knowledgebase was last modified (UTC). + */ + @JsonProperty(value = "lastChangedTimestamp") + private String lastChangedTimestamp; + + /** + * Time stamp at which the knowledgebase was last published (UTC). + */ + @JsonProperty(value = "lastPublishedTimestamp") + private String lastPublishedTimestamp; + + /** + * Friendly name of the knowledgebase. + */ + @JsonProperty(value = "name") + private String name; + + /** + * User who created / owns the knowledgebase. + */ + @JsonProperty(value = "userId") + private String userId; + + /** + * URL sources from which Q-A were extracted and added to the + * knowledgebase. + */ + @JsonProperty(value = "urls") + private List urls; + + /** + * Custom sources from which Q-A were extracted or explicitly added to the + * knowledgebase. + */ + @JsonProperty(value = "sources") + private List sources; + + /** + * Get unique id that identifies a knowledgebase. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set unique id that identifies a knowledgebase. + * + * @param id the id value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withId(String id) { + this.id = id; + return this; + } + + /** + * Get uRL host name at which the knowledgebase is hosted. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Set uRL host name at which the knowledgebase is hosted. + * + * @param hostName the hostName value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withHostName(String hostName) { + this.hostName = hostName; + return this; + } + + /** + * Get time stamp at which the knowledgebase was last accessed (UTC). + * + * @return the lastAccessedTimestamp value + */ + public String lastAccessedTimestamp() { + return this.lastAccessedTimestamp; + } + + /** + * Set time stamp at which the knowledgebase was last accessed (UTC). + * + * @param lastAccessedTimestamp the lastAccessedTimestamp value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withLastAccessedTimestamp(String lastAccessedTimestamp) { + this.lastAccessedTimestamp = lastAccessedTimestamp; + return this; + } + + /** + * Get time stamp at which the knowledgebase was last modified (UTC). + * + * @return the lastChangedTimestamp value + */ + public String lastChangedTimestamp() { + return this.lastChangedTimestamp; + } + + /** + * Set time stamp at which the knowledgebase was last modified (UTC). + * + * @param lastChangedTimestamp the lastChangedTimestamp value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withLastChangedTimestamp(String lastChangedTimestamp) { + this.lastChangedTimestamp = lastChangedTimestamp; + return this; + } + + /** + * Get time stamp at which the knowledgebase was last published (UTC). + * + * @return the lastPublishedTimestamp value + */ + public String lastPublishedTimestamp() { + return this.lastPublishedTimestamp; + } + + /** + * Set time stamp at which the knowledgebase was last published (UTC). + * + * @param lastPublishedTimestamp the lastPublishedTimestamp value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withLastPublishedTimestamp(String lastPublishedTimestamp) { + this.lastPublishedTimestamp = lastPublishedTimestamp; + return this; + } + + /** + * Get friendly name of the knowledgebase. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set friendly name of the knowledgebase. + * + * @param name the name value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withName(String name) { + this.name = name; + return this; + } + + /** + * Get user who created / owns the knowledgebase. + * + * @return the userId value + */ + public String userId() { + return this.userId; + } + + /** + * Set user who created / owns the knowledgebase. + * + * @param userId the userId value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withUserId(String userId) { + this.userId = userId; + return this; + } + + /** + * Get uRL sources from which Q-A were extracted and added to the knowledgebase. + * + * @return the urls value + */ + public List urls() { + return this.urls; + } + + /** + * Set uRL sources from which Q-A were extracted and added to the knowledgebase. + * + * @param urls the urls value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withUrls(List urls) { + this.urls = urls; + return this; + } + + /** + * Get custom sources from which Q-A were extracted or explicitly added to the knowledgebase. + * + * @return the sources value + */ + public List sources() { + return this.sources; + } + + /** + * Set custom sources from which Q-A were extracted or explicitly added to the knowledgebase. + * + * @param sources the sources value to set + * @return the KnowledgebaseDTO object itself. + */ + public KnowledgebaseDTO withSources(List sources) { + this.sources = sources; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/KnowledgebasesDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/KnowledgebasesDTO.java new file mode 100644 index 000000000000..82a92873ff92 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/KnowledgebasesDTO.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Collection of knowledgebases owned by a user. + */ +public class KnowledgebasesDTO { + /** + * Collection of knowledgebase records. + */ + @JsonProperty(value = "knowledgebases") + private List knowledgebases; + + /** + * Get collection of knowledgebase records. + * + * @return the knowledgebases value + */ + public List knowledgebases() { + return this.knowledgebases; + } + + /** + * Set collection of knowledgebase records. + * + * @param knowledgebases the knowledgebases value to set + * @return the KnowledgebasesDTO object itself. + */ + public KnowledgebasesDTO withKnowledgebases(List knowledgebases) { + this.knowledgebases = knowledgebases; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/MetadataDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/MetadataDTO.java new file mode 100644 index 000000000000..5abfb1460f03 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/MetadataDTO.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Name - value pair of metadata. + */ +public class MetadataDTO { + /** + * Metadata name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Metadata value. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get metadata name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set metadata name. + * + * @param name the name value to set + * @return the MetadataDTO object itself. + */ + public MetadataDTO withName(String name) { + this.name = name; + return this; + } + + /** + * Get metadata value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set metadata value. + * + * @param value the value value to set + * @return the MetadataDTO object itself. + */ + public MetadataDTO withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/Operation.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/Operation.java new file mode 100644 index 000000000000..f22318e38fc1 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/Operation.java @@ -0,0 +1,200 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Record to track long running operation. + */ +public class Operation { + /** + * Operation state. Possible values include: 'Failed', 'NotStarted', + * 'Running', 'Succeeded'. + */ + @JsonProperty(value = "operationState") + private OperationState operationState; + + /** + * Timestamp when the operation was created. + */ + @JsonProperty(value = "createdTimestamp") + private String createdTimestamp; + + /** + * Timestamp when the current state was entered. + */ + @JsonProperty(value = "lastActionTimestamp") + private String lastActionTimestamp; + + /** + * Relative URI to the target resource location for completed resources. + */ + @JsonProperty(value = "resourceLocation") + private String resourceLocation; + + /** + * User Id. + */ + @JsonProperty(value = "userId") + private String userId; + + /** + * Operation Id. + */ + @JsonProperty(value = "operationId") + private String operationId; + + /** + * Error details in case of failures. + */ + @JsonProperty(value = "errorResponse") + private ErrorResponse errorResponse; + + /** + * Get operation state. Possible values include: 'Failed', 'NotStarted', 'Running', 'Succeeded'. + * + * @return the operationState value + */ + public OperationState operationState() { + return this.operationState; + } + + /** + * Set operation state. Possible values include: 'Failed', 'NotStarted', 'Running', 'Succeeded'. + * + * @param operationState the operationState value to set + * @return the Operation object itself. + */ + public Operation withOperationState(OperationState operationState) { + this.operationState = operationState; + return this; + } + + /** + * Get timestamp when the operation was created. + * + * @return the createdTimestamp value + */ + public String createdTimestamp() { + return this.createdTimestamp; + } + + /** + * Set timestamp when the operation was created. + * + * @param createdTimestamp the createdTimestamp value to set + * @return the Operation object itself. + */ + public Operation withCreatedTimestamp(String createdTimestamp) { + this.createdTimestamp = createdTimestamp; + return this; + } + + /** + * Get timestamp when the current state was entered. + * + * @return the lastActionTimestamp value + */ + public String lastActionTimestamp() { + return this.lastActionTimestamp; + } + + /** + * Set timestamp when the current state was entered. + * + * @param lastActionTimestamp the lastActionTimestamp value to set + * @return the Operation object itself. + */ + public Operation withLastActionTimestamp(String lastActionTimestamp) { + this.lastActionTimestamp = lastActionTimestamp; + return this; + } + + /** + * Get relative URI to the target resource location for completed resources. + * + * @return the resourceLocation value + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Set relative URI to the target resource location for completed resources. + * + * @param resourceLocation the resourceLocation value to set + * @return the Operation object itself. + */ + public Operation withResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + return this; + } + + /** + * Get user Id. + * + * @return the userId value + */ + public String userId() { + return this.userId; + } + + /** + * Set user Id. + * + * @param userId the userId value to set + * @return the Operation object itself. + */ + public Operation withUserId(String userId) { + this.userId = userId; + return this; + } + + /** + * Get operation Id. + * + * @return the operationId value + */ + public String operationId() { + return this.operationId; + } + + /** + * Set operation Id. + * + * @param operationId the operationId value to set + * @return the Operation object itself. + */ + public Operation withOperationId(String operationId) { + this.operationId = operationId; + return this; + } + + /** + * Get error details in case of failures. + * + * @return the errorResponse value + */ + public ErrorResponse errorResponse() { + return this.errorResponse; + } + + /** + * Set error details in case of failures. + * + * @param errorResponse the errorResponse value to set + * @return the Operation object itself. + */ + public Operation withErrorResponse(ErrorResponse errorResponse) { + this.errorResponse = errorResponse; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/OperationState.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/OperationState.java new file mode 100644 index 000000000000..b0824c2d0690 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/OperationState.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for OperationState. + */ +public enum OperationState { + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value NotStarted. */ + NOT_STARTED("NotStarted"), + + /** Enum value Running. */ + RUNNING("Running"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"); + + /** The actual serialized value for a OperationState instance. */ + private String value; + + OperationState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OperationState instance. + * + * @param value the serialized value to parse. + * @return the parsed OperationState object, or null if unable to parse. + */ + @JsonCreator + public static OperationState fromString(String value) { + OperationState[] items = OperationState.values(); + for (OperationState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/QnADTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/QnADTO.java new file mode 100644 index 000000000000..d522c5fc9f3b --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/QnADTO.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Q-A object. + */ +public class QnADTO { + /** + * Unique id for the Q-A. + */ + @JsonProperty(value = "id") + private Integer id; + + /** + * Answer text. + */ + @JsonProperty(value = "answer", required = true) + private String answer; + + /** + * Source from which Q-A was indexed. eg. + * https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + */ + @JsonProperty(value = "source") + private String source; + + /** + * List of questions associated with the answer. + */ + @JsonProperty(value = "questions", required = true) + private List questions; + + /** + * List of metadata associated with the answer. + */ + @JsonProperty(value = "metadata") + private List metadata; + + /** + * Get unique id for the Q-A. + * + * @return the id value + */ + public Integer id() { + return this.id; + } + + /** + * Set unique id for the Q-A. + * + * @param id the id value to set + * @return the QnADTO object itself. + */ + public QnADTO withId(Integer id) { + this.id = id; + return this; + } + + /** + * Get answer text. + * + * @return the answer value + */ + public String answer() { + return this.answer; + } + + /** + * Set answer text. + * + * @param answer the answer value to set + * @return the QnADTO object itself. + */ + public QnADTO withAnswer(String answer) { + this.answer = answer; + return this; + } + + /** + * Get source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + * + * @return the source value + */ + public String source() { + return this.source; + } + + /** + * Set source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + * + * @param source the source value to set + * @return the QnADTO object itself. + */ + public QnADTO withSource(String source) { + this.source = source; + return this; + } + + /** + * Get list of questions associated with the answer. + * + * @return the questions value + */ + public List questions() { + return this.questions; + } + + /** + * Set list of questions associated with the answer. + * + * @param questions the questions value to set + * @return the QnADTO object itself. + */ + public QnADTO withQuestions(List questions) { + this.questions = questions; + return this; + } + + /** + * Get list of metadata associated with the answer. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set list of metadata associated with the answer. + * + * @param metadata the metadata value to set + * @return the QnADTO object itself. + */ + public QnADTO withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/QnADocumentsDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/QnADocumentsDTO.java new file mode 100644 index 000000000000..871a34d3d2d4 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/QnADocumentsDTO.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * List of QnADTO. + */ +public class QnADocumentsDTO { + /** + * List of answers. + */ + @JsonProperty(value = "qnaDocuments") + private List qnaDocuments; + + /** + * Get list of answers. + * + * @return the qnaDocuments value + */ + public List qnaDocuments() { + return this.qnaDocuments; + } + + /** + * Set list of answers. + * + * @param qnaDocuments the qnaDocuments value to set + * @return the QnADocumentsDTO object itself. + */ + public QnADocumentsDTO withQnaDocuments(List qnaDocuments) { + this.qnaDocuments = qnaDocuments; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ReplaceKbDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ReplaceKbDTO.java new file mode 100644 index 000000000000..6899cce1c16f --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/ReplaceKbDTO.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Post body schema for Replace KB operation. + */ +public class ReplaceKbDTO { + /** + * List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are + * assigned by the service and should be omitted. + */ + @JsonProperty(value = "qnAList", required = true) + private List qnAList; + + /** + * Get list of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * + * @return the qnAList value + */ + public List qnAList() { + return this.qnAList; + } + + /** + * Set list of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. + * + * @param qnAList the qnAList value to set + * @return the ReplaceKbDTO object itself. + */ + public ReplaceKbDTO withQnAList(List qnAList) { + this.qnAList = qnAList; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbContentsDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbContentsDTO.java new file mode 100644 index 000000000000..3450ad4757b4 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbContentsDTO.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PATCH body schema for Update operation in Update Kb. + */ +public class UpdateKbContentsDTO { + /** + * Friendly name for the knowledgebase. + */ + @JsonProperty(value = "name") + private String name; + + /** + * List of Q-A (UpdateQnaDTO) to be added to the knowledgebase. + */ + @JsonProperty(value = "qnaList") + private List qnaList; + + /** + * List of existing URLs to be refreshed. The content will be extracted + * again and re-indexed. + */ + @JsonProperty(value = "urls") + private List urls; + + /** + * Get friendly name for the knowledgebase. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set friendly name for the knowledgebase. + * + * @param name the name value to set + * @return the UpdateKbContentsDTO object itself. + */ + public UpdateKbContentsDTO withName(String name) { + this.name = name; + return this; + } + + /** + * Get list of Q-A (UpdateQnaDTO) to be added to the knowledgebase. + * + * @return the qnaList value + */ + public List qnaList() { + return this.qnaList; + } + + /** + * Set list of Q-A (UpdateQnaDTO) to be added to the knowledgebase. + * + * @param qnaList the qnaList value to set + * @return the UpdateKbContentsDTO object itself. + */ + public UpdateKbContentsDTO withQnaList(List qnaList) { + this.qnaList = qnaList; + return this; + } + + /** + * Get list of existing URLs to be refreshed. The content will be extracted again and re-indexed. + * + * @return the urls value + */ + public List urls() { + return this.urls; + } + + /** + * Set list of existing URLs to be refreshed. The content will be extracted again and re-indexed. + * + * @param urls the urls value to set + * @return the UpdateKbContentsDTO object itself. + */ + public UpdateKbContentsDTO withUrls(List urls) { + this.urls = urls; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTO.java new file mode 100644 index 000000000000..ecca548ab665 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTO.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains list of QnAs to be updated. + */ +public class UpdateKbOperationDTO { + /** + * An instance of CreateKbInputDTO for add operation. + */ + @JsonProperty(value = "add") + private UpdateKbOperationDTOAdd add; + + /** + * An instance of DeleteKbContentsDTO for delete Operation. + */ + @JsonProperty(value = "delete") + private UpdateKbOperationDTODelete delete; + + /** + * An instance of UpdateKbContentsDTO for Update Operation. + */ + @JsonProperty(value = "update") + private UpdateKbOperationDTOUpdate update; + + /** + * Get an instance of CreateKbInputDTO for add operation. + * + * @return the add value + */ + public UpdateKbOperationDTOAdd add() { + return this.add; + } + + /** + * Set an instance of CreateKbInputDTO for add operation. + * + * @param add the add value to set + * @return the UpdateKbOperationDTO object itself. + */ + public UpdateKbOperationDTO withAdd(UpdateKbOperationDTOAdd add) { + this.add = add; + return this; + } + + /** + * Get an instance of DeleteKbContentsDTO for delete Operation. + * + * @return the delete value + */ + public UpdateKbOperationDTODelete delete() { + return this.delete; + } + + /** + * Set an instance of DeleteKbContentsDTO for delete Operation. + * + * @param delete the delete value to set + * @return the UpdateKbOperationDTO object itself. + */ + public UpdateKbOperationDTO withDelete(UpdateKbOperationDTODelete delete) { + this.delete = delete; + return this; + } + + /** + * Get an instance of UpdateKbContentsDTO for Update Operation. + * + * @return the update value + */ + public UpdateKbOperationDTOUpdate update() { + return this.update; + } + + /** + * Set an instance of UpdateKbContentsDTO for Update Operation. + * + * @param update the update value to set + * @return the UpdateKbOperationDTO object itself. + */ + public UpdateKbOperationDTO withUpdate(UpdateKbOperationDTOUpdate update) { + this.update = update; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTOAdd.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTOAdd.java new file mode 100644 index 000000000000..b78c4cd7b4e7 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTOAdd.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + + +/** + * An instance of CreateKbInputDTO for add operation. + */ +public class UpdateKbOperationDTOAdd extends CreateKbInputDTO { +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTODelete.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTODelete.java new file mode 100644 index 000000000000..884aeb8c3cc6 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTODelete.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + + +/** + * An instance of DeleteKbContentsDTO for delete Operation. + */ +public class UpdateKbOperationDTODelete extends DeleteKbContentsDTO { +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTOUpdate.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTOUpdate.java new file mode 100644 index 000000000000..22536e525f33 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKbOperationDTOUpdate.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + + +/** + * An instance of UpdateKbContentsDTO for Update Operation. + */ +public class UpdateKbOperationDTOUpdate extends UpdateKbContentsDTO { +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKnowledgebaseHeaders.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKnowledgebaseHeaders.java new file mode 100644 index 000000000000..7350060182e3 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateKnowledgebaseHeaders.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Update Knowledgebase operation. + */ +public class UpdateKnowledgebaseHeaders { + /** + * Relative URI to the target location of the asynchronous operation. + * Client should poll this resource to get status of the operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get relative URI to the target location of the asynchronous operation. Client should poll this resource to get status of the operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set relative URI to the target location of the asynchronous operation. Client should poll this resource to get status of the operation. + * + * @param location the location value to set + * @return the UpdateKnowledgebaseHeaders object itself. + */ + public UpdateKnowledgebaseHeaders withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateMetadataDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateMetadataDTO.java new file mode 100644 index 000000000000..f2abeffac6bf --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateMetadataDTO.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PATCH Body schema to represent list of Metadata to be updated. + */ +public class UpdateMetadataDTO { + /** + * List of Metadata associated with answer to be deleted. + */ + @JsonProperty(value = "delete") + private List delete; + + /** + * List of Metadat associated with answer to be added. + */ + @JsonProperty(value = "add") + private List add; + + /** + * Get list of Metadata associated with answer to be deleted. + * + * @return the delete value + */ + public List delete() { + return this.delete; + } + + /** + * Set list of Metadata associated with answer to be deleted. + * + * @param delete the delete value to set + * @return the UpdateMetadataDTO object itself. + */ + public UpdateMetadataDTO withDelete(List delete) { + this.delete = delete; + return this; + } + + /** + * Get list of Metadat associated with answer to be added. + * + * @return the add value + */ + public List add() { + return this.add; + } + + /** + * Set list of Metadat associated with answer to be added. + * + * @param add the add value to set + * @return the UpdateMetadataDTO object itself. + */ + public UpdateMetadataDTO withAdd(List add) { + this.add = add; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQnaDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQnaDTO.java new file mode 100644 index 000000000000..789727196268 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQnaDTO.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PATCH Body schema for Update Qna List. + */ +public class UpdateQnaDTO { + /** + * Unique id for the Q-A. + */ + @JsonProperty(value = "id") + private Integer id; + + /** + * Answer text. + */ + @JsonProperty(value = "answer") + private String answer; + + /** + * Source from which Q-A was indexed. eg. + * https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + */ + @JsonProperty(value = "source") + private String source; + + /** + * List of questions associated with the answer. + */ + @JsonProperty(value = "questions") + private UpdateQnaDTOQuestions questions; + + /** + * List of metadata associated with the answer to be updated. + */ + @JsonProperty(value = "metadata") + private UpdateQnaDTOMetadata metadata; + + /** + * Get unique id for the Q-A. + * + * @return the id value + */ + public Integer id() { + return this.id; + } + + /** + * Set unique id for the Q-A. + * + * @param id the id value to set + * @return the UpdateQnaDTO object itself. + */ + public UpdateQnaDTO withId(Integer id) { + this.id = id; + return this; + } + + /** + * Get answer text. + * + * @return the answer value + */ + public String answer() { + return this.answer; + } + + /** + * Set answer text. + * + * @param answer the answer value to set + * @return the UpdateQnaDTO object itself. + */ + public UpdateQnaDTO withAnswer(String answer) { + this.answer = answer; + return this; + } + + /** + * Get source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + * + * @return the source value + */ + public String source() { + return this.source; + } + + /** + * Set source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs. + * + * @param source the source value to set + * @return the UpdateQnaDTO object itself. + */ + public UpdateQnaDTO withSource(String source) { + this.source = source; + return this; + } + + /** + * Get list of questions associated with the answer. + * + * @return the questions value + */ + public UpdateQnaDTOQuestions questions() { + return this.questions; + } + + /** + * Set list of questions associated with the answer. + * + * @param questions the questions value to set + * @return the UpdateQnaDTO object itself. + */ + public UpdateQnaDTO withQuestions(UpdateQnaDTOQuestions questions) { + this.questions = questions; + return this; + } + + /** + * Get list of metadata associated with the answer to be updated. + * + * @return the metadata value + */ + public UpdateQnaDTOMetadata metadata() { + return this.metadata; + } + + /** + * Set list of metadata associated with the answer to be updated. + * + * @param metadata the metadata value to set + * @return the UpdateQnaDTO object itself. + */ + public UpdateQnaDTO withMetadata(UpdateQnaDTOMetadata metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQnaDTOMetadata.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQnaDTOMetadata.java new file mode 100644 index 000000000000..c2bd40c84148 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQnaDTOMetadata.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + + +/** + * List of metadata associated with the answer to be updated. + */ +public class UpdateQnaDTOMetadata extends UpdateMetadataDTO { +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQnaDTOQuestions.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQnaDTOQuestions.java new file mode 100644 index 000000000000..f1ea7d3b78e8 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQnaDTOQuestions.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + + +/** + * List of questions associated with the answer. + */ +public class UpdateQnaDTOQuestions extends UpdateQuestionsDTO { +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQuestionsDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQuestionsDTO.java new file mode 100644 index 000000000000..b4974792bbb1 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/UpdateQuestionsDTO.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * PATCH Body schema for Update Kb which contains list of questions to be added + * and deleted. + */ +public class UpdateQuestionsDTO { + /** + * List of questions to be added. + */ + @JsonProperty(value = "add") + private List add; + + /** + * List of questions to be deleted. + */ + @JsonProperty(value = "delete") + private List delete; + + /** + * Get list of questions to be added. + * + * @return the add value + */ + public List add() { + return this.add; + } + + /** + * Set list of questions to be added. + * + * @param add the add value to set + * @return the UpdateQuestionsDTO object itself. + */ + public UpdateQuestionsDTO withAdd(List add) { + this.add = add; + return this; + } + + /** + * Get list of questions to be deleted. + * + * @return the delete value + */ + public List delete() { + return this.delete; + } + + /** + * Set list of questions to be deleted. + * + * @param delete the delete value to set + * @return the UpdateQuestionsDTO object itself. + */ + public UpdateQuestionsDTO withDelete(List delete) { + this.delete = delete; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/WordAlterationsDTO.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/WordAlterationsDTO.java new file mode 100644 index 000000000000..14fc097cf650 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/WordAlterationsDTO.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.qnamaker.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Collection of word alterations. + */ +public class WordAlterationsDTO { + /** + * Collection of word alterations. + */ + @JsonProperty(value = "wordAlterations", required = true) + private List wordAlterations; + + /** + * Get collection of word alterations. + * + * @return the wordAlterations value + */ + public List wordAlterations() { + return this.wordAlterations; + } + + /** + * Set collection of word alterations. + * + * @param wordAlterations the wordAlterations value to set + * @return the WordAlterationsDTO object itself. + */ + public WordAlterationsDTO withWordAlterations(List wordAlterations) { + this.wordAlterations = wordAlterations; + return this; + } + +} diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/package-info.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/package-info.java new file mode 100644 index 000000000000..fffed544e80d --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the models classes for QnAMakerClient. + * An API for QnAMaker Service. + */ +package com.microsoft.azure.cognitiveservices.qnamaker.models; diff --git a/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/package-info.java b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/package-info.java new file mode 100644 index 000000000000..82afe96f46e6 --- /dev/null +++ b/cognitiveservices/data-plane/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/qnamaker/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for QnAMakerClient. + * An API for QnAMaker Service. + */ +package com.microsoft.azure.cognitiveservices.qnamaker;