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/EndpointKeys.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/EndpointKeys.java new file mode 100644 index 000000000000..3f17fb84459c --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/EndpointKeys.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 EndpointKeys. + */ +public interface EndpointKeys { + /** + * 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/EndpointSettings.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/EndpointSettings.java new file mode 100644 index 000000000000..eded5960888d --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/EndpointSettings.java @@ -0,0 +1,133 @@ +/** + * 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.EndpointSettingsDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.EndpointSettingsDTOActiveLearning; +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 EndpointSettings. + */ +public interface EndpointSettings { + /** + * Gets endpoint settings 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 EndpointSettingsDTO object if successful. + */ + EndpointSettingsDTO getSettings(); + + /** + * Gets endpoint settings 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 getSettingsAsync(final ServiceCallback serviceCallback); + + /** + * Gets endpoint settings for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointSettingsDTO object + */ + Observable getSettingsAsync(); + + /** + * Gets endpoint settings for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointSettingsDTO object + */ + Observable> getSettingsWithServiceResponseAsync(); + + /** + * Updates endpoint settings 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 String object if successful. + */ + String updateSettings(); + + /** + * Updates endpoint settings 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 updateSettingsAsync(final ServiceCallback serviceCallback); + + /** + * Updates endpoint settings for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the String object + */ + Observable updateSettingsAsync(); + + /** + * Updates endpoint settings for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the String object + */ + Observable> updateSettingsWithServiceResponseAsync(); + /** + * Updates endpoint settings for an endpoint. + * + * @param activeLearning Active Learning settings of the 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 String object if successful. + */ + String updateSettings(EndpointSettingsDTOActiveLearning activeLearning); + + /** + * Updates endpoint settings for an endpoint. + * + * @param activeLearning Active Learning settings of the 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 updateSettingsAsync(EndpointSettingsDTOActiveLearning activeLearning, final ServiceCallback serviceCallback); + + /** + * Updates endpoint settings for an endpoint. + * + * @param activeLearning Active Learning settings of the endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the String object + */ + Observable updateSettingsAsync(EndpointSettingsDTOActiveLearning activeLearning); + + /** + * Updates endpoint settings for an endpoint. + * + * @param activeLearning Active Learning settings of the endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the String object + */ + Observable> updateSettingsWithServiceResponseAsync(EndpointSettingsDTOActiveLearning activeLearning); + +} 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..6ef812c6a75e --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/QnAMakerClient.java @@ -0,0 +1,128 @@ +/** + * 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 EndpointSettings object to access its operations. + * @return the EndpointSettings object. + */ + EndpointSettings endpointSettings(); + + /** + * Gets the EndpointKeys object to access its operations. + * @return the EndpointKeys object. + */ + EndpointKeys endpointKeys(); + + /** + * 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/EndpointKeysImpl.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/EndpointKeysImpl.java new file mode 100644 index 000000000000..b2e2bb4b162d --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/EndpointKeysImpl.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.EndpointKeys; +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 EndpointKeys. + */ +public class EndpointKeysImpl implements EndpointKeys { + /** The Retrofit service to perform REST calls. */ + private EndpointKeysService service; + /** The service client containing this operation class. */ + private QnAMakerClientImpl client; + + /** + * Initializes an instance of EndpointKeysImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EndpointKeysImpl(Retrofit retrofit, QnAMakerClientImpl client) { + this.service = retrofit.create(EndpointKeysService.class); + this.client = client; + } + + /** + * The interface defining all the services for EndpointKeys to be + * used by Retrofit to perform actually REST calls. + */ + interface EndpointKeysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.EndpointKeys 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.EndpointKeys 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/EndpointSettingsImpl.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/EndpointSettingsImpl.java new file mode 100644 index 000000000000..d35ab8d72ca0 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/EndpointSettingsImpl.java @@ -0,0 +1,282 @@ +/** + * 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.EndpointSettings; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.EndpointSettingsDTO; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.models.EndpointSettingsDTOActiveLearning; +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 com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in EndpointSettings. + */ +public class EndpointSettingsImpl implements EndpointSettings { + /** The Retrofit service to perform REST calls. */ + private EndpointSettingsService service; + /** The service client containing this operation class. */ + private QnAMakerClientImpl client; + + /** + * Initializes an instance of EndpointSettingsImpl. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EndpointSettingsImpl(Retrofit retrofit, QnAMakerClientImpl client) { + this.service = retrofit.create(EndpointSettingsService.class); + this.client = client; + } + + /** + * The interface defining all the services for EndpointSettings to be + * used by Retrofit to perform actually REST calls. + */ + interface EndpointSettingsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.knowledge.qnamaker.EndpointSettings getSettings" }) + @GET("endpointSettings") + Observable> getSettings(@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.EndpointSettings updateSettings" }) + @PATCH("endpointSettings") + Observable> updateSettings(@Header("accept-language") String acceptLanguage, @Body EndpointSettingsDTO endpointSettingsPayload, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * Gets endpoint settings 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 EndpointSettingsDTO object if successful. + */ + public EndpointSettingsDTO getSettings() { + return getSettingsWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets endpoint settings 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 getSettingsAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSettingsWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets endpoint settings for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointSettingsDTO object + */ + public Observable getSettingsAsync() { + return getSettingsWithServiceResponseAsync().map(new Func1, EndpointSettingsDTO>() { + @Override + public EndpointSettingsDTO call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets endpoint settings for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EndpointSettingsDTO object + */ + public Observable> getSettingsWithServiceResponseAsync() { + 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.getSettings(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSettingsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSettingsDelegate(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); + } + + /** + * Updates endpoint settings 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 String object if successful. + */ + public String updateSettings() { + return updateSettingsWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Updates endpoint settings 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 updateSettingsAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateSettingsWithServiceResponseAsync(), serviceCallback); + } + + /** + * Updates endpoint settings for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the String object + */ + public Observable updateSettingsAsync() { + return updateSettingsWithServiceResponseAsync().map(new Func1, String>() { + @Override + public String call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates endpoint settings for an endpoint. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the String object + */ + public Observable> updateSettingsWithServiceResponseAsync() { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + final EndpointSettingsDTOActiveLearning activeLearning = null; + EndpointSettingsDTO endpointSettingsPayload = new EndpointSettingsDTO(); + endpointSettingsPayload.withActiveLearning(null); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.updateSettings(this.client.acceptLanguage(), endpointSettingsPayload, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateSettingsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates endpoint settings for an endpoint. + * + * @param activeLearning Active Learning settings of the 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 String object if successful. + */ + public String updateSettings(EndpointSettingsDTOActiveLearning activeLearning) { + return updateSettingsWithServiceResponseAsync(activeLearning).toBlocking().single().body(); + } + + /** + * Updates endpoint settings for an endpoint. + * + * @param activeLearning Active Learning settings of the 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 updateSettingsAsync(EndpointSettingsDTOActiveLearning activeLearning, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateSettingsWithServiceResponseAsync(activeLearning), serviceCallback); + } + + /** + * Updates endpoint settings for an endpoint. + * + * @param activeLearning Active Learning settings of the endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the String object + */ + public Observable updateSettingsAsync(EndpointSettingsDTOActiveLearning activeLearning) { + return updateSettingsWithServiceResponseAsync(activeLearning).map(new Func1, String>() { + @Override + public String call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates endpoint settings for an endpoint. + * + * @param activeLearning Active Learning settings of the endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the String object + */ + public Observable> updateSettingsWithServiceResponseAsync(EndpointSettingsDTOActiveLearning activeLearning) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + Validator.validate(activeLearning); + EndpointSettingsDTO endpointSettingsPayload = new EndpointSettingsDTO(); + endpointSettingsPayload.withActiveLearning(activeLearning); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.updateSettings(this.client.acceptLanguage(), endpointSettingsPayload, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateSettingsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateSettingsDelegate(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..aa195f3c9dc3 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/implementation/QnAMakerClientImpl.java @@ -0,0 +1,245 @@ +/** + * 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.EndpointKeys; +import com.microsoft.azure.cognitiveservices.knowledge.qnamaker.EndpointSettings; +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 EndpointSettings object to access its operations. + */ + private EndpointSettings endpointSettings; + + /** + * Gets the EndpointSettings object to access its operations. + * @return the EndpointSettings object. + */ + public EndpointSettings endpointSettings() { + return this.endpointSettings; + } + + /** + * The EndpointKeys object to access its operations. + */ + private EndpointKeys endpointKeys; + + /** + * Gets the EndpointKeys object to access its operations. + * @return the EndpointKeys object. + */ + public EndpointKeys endpointKeys() { + return this.endpointKeys; + } + + /** + * 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.endpointSettings = new EndpointSettingsImpl(restClient().retrofit(), this); + this.endpointKeys = new EndpointKeysImpl(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/ActiveLearningSettingsDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ActiveLearningSettingsDTO.java new file mode 100644 index 000000000000..0ef00cab59c3 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ActiveLearningSettingsDTO.java @@ -0,0 +1,43 @@ +/** + * 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; + +/** + * Active Learning settings of the endpoint. + */ +public class ActiveLearningSettingsDTO { + /** + * True/False string providing Active Learning. + */ + @JsonProperty(value = "enable") + private String enable; + + /** + * Get true/False string providing Active Learning. + * + * @return the enable value + */ + public String enable() { + return this.enable; + } + + /** + * Set true/False string providing Active Learning. + * + * @param enable the enable value to set + * @return the ActiveLearningSettingsDTO object itself. + */ + public ActiveLearningSettingsDTO withEnable(String enable) { + this.enable = enable; + return this; + } + +} 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/ContextDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ContextDTO.java new file mode 100644 index 000000000000..003995428038 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/ContextDTO.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.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Context associated with Qna. + */ +public class ContextDTO { + /** + * To mark if a prompt is relevant only with a previous question or not. + * true - Do not include this QnA as search result for queries without + * context + * false - ignores context and includes this QnA in search result. + */ + @JsonProperty(value = "isContextOnly") + private Boolean isContextOnly; + + /** + * List of prompts associated with the answer. + */ + @JsonProperty(value = "prompts") + private List prompts; + + /** + * Get to mark if a prompt is relevant only with a previous question or not. + true - Do not include this QnA as search result for queries without context + false - ignores context and includes this QnA in search result. + * + * @return the isContextOnly value + */ + public Boolean isContextOnly() { + return this.isContextOnly; + } + + /** + * Set to mark if a prompt is relevant only with a previous question or not. + true - Do not include this QnA as search result for queries without context + false - ignores context and includes this QnA in search result. + * + * @param isContextOnly the isContextOnly value to set + * @return the ContextDTO object itself. + */ + public ContextDTO withIsContextOnly(Boolean isContextOnly) { + this.isContextOnly = isContextOnly; + return this; + } + + /** + * Get list of prompts associated with the answer. + * + * @return the prompts value + */ + public List prompts() { + return this.prompts; + } + + /** + * Set list of prompts associated with the answer. + * + * @param prompts the prompts value to set + * @return the ContextDTO object itself. + */ + public ContextDTO withPrompts(List prompts) { + this.prompts = prompts; + 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/EndpointSettingsDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/EndpointSettingsDTO.java new file mode 100644 index 000000000000..0b2636a0dba5 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/EndpointSettingsDTO.java @@ -0,0 +1,43 @@ +/** + * 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; + +/** + * Endpoint settings. + */ +public class EndpointSettingsDTO { + /** + * Active Learning settings of the endpoint. + */ + @JsonProperty(value = "activeLearning") + private EndpointSettingsDTOActiveLearning activeLearning; + + /** + * Get active Learning settings of the endpoint. + * + * @return the activeLearning value + */ + public EndpointSettingsDTOActiveLearning activeLearning() { + return this.activeLearning; + } + + /** + * Set active Learning settings of the endpoint. + * + * @param activeLearning the activeLearning value to set + * @return the EndpointSettingsDTO object itself. + */ + public EndpointSettingsDTO withActiveLearning(EndpointSettingsDTOActiveLearning activeLearning) { + this.activeLearning = activeLearning; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/EndpointSettingsDTOActiveLearning.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/EndpointSettingsDTOActiveLearning.java new file mode 100644 index 000000000000..6851fe0c0258 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/EndpointSettingsDTOActiveLearning.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; + + +/** + * Active Learning settings of the endpoint. + */ +public class EndpointSettingsDTOActiveLearning extends ActiveLearningSettingsDTO { +} 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/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/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/PromptDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/PromptDTO.java new file mode 100644 index 000000000000..a5346058f113 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/PromptDTO.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 com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Prompt for an answer. + */ +public class PromptDTO { + /** + * Index of the prompt - used in ordering of the prompts. + */ + @JsonProperty(value = "displayOrder") + private Integer displayOrder; + + /** + * Qna id corresponding to the prompt - if QnaId is present, QnADTO object + * is ignored. + */ + @JsonProperty(value = "qnaId") + private Integer qnaId; + + /** + * QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO + * object. + */ + @JsonProperty(value = "qna") + private PromptDTOQna qna; + + /** + * Text displayed to represent a follow up question prompt. + */ + @JsonProperty(value = "displayText") + private String displayText; + + /** + * Get index of the prompt - used in ordering of the prompts. + * + * @return the displayOrder value + */ + public Integer displayOrder() { + return this.displayOrder; + } + + /** + * Set index of the prompt - used in ordering of the prompts. + * + * @param displayOrder the displayOrder value to set + * @return the PromptDTO object itself. + */ + public PromptDTO withDisplayOrder(Integer displayOrder) { + this.displayOrder = displayOrder; + return this; + } + + /** + * Get qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored. + * + * @return the qnaId value + */ + public Integer qnaId() { + return this.qnaId; + } + + /** + * Set qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored. + * + * @param qnaId the qnaId value to set + * @return the PromptDTO object itself. + */ + public PromptDTO withQnaId(Integer qnaId) { + this.qnaId = qnaId; + return this; + } + + /** + * Get qnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. + * + * @return the qna value + */ + public PromptDTOQna qna() { + return this.qna; + } + + /** + * Set qnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. + * + * @param qna the qna value to set + * @return the PromptDTO object itself. + */ + public PromptDTO withQna(PromptDTOQna qna) { + this.qna = qna; + return this; + } + + /** + * Get text displayed to represent a follow up question prompt. + * + * @return the displayText value + */ + public String displayText() { + return this.displayText; + } + + /** + * Set text displayed to represent a follow up question prompt. + * + * @param displayText the displayText value to set + * @return the PromptDTO object itself. + */ + public PromptDTO withDisplayText(String displayText) { + this.displayText = displayText; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/PromptDTOQna.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/PromptDTOQna.java new file mode 100644 index 000000000000..9cd9ee128fce --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/PromptDTOQna.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; + + +/** + * QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. + */ +public class PromptDTOQna extends QnADTO { +} 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..89866e35bce7 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/QnADTO.java @@ -0,0 +1,175 @@ +/** + * 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; + + /** + * Context of a QnA. + */ + @JsonProperty(value = "context") + private QnADTOContext context; + + /** + * 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; + } + + /** + * Get context of a QnA. + * + * @return the context value + */ + public QnADTOContext context() { + return this.context; + } + + /** + * Set context of a QnA. + * + * @param context the context value to set + * @return the QnADTO object itself. + */ + public QnADTO withContext(QnADTOContext context) { + this.context = context; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/QnADTOContext.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/QnADTOContext.java new file mode 100644 index 000000000000..8e7e60714bc4 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/QnADTOContext.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; + + +/** + * Context of a QnA. + */ +public class QnADTOContext extends ContextDTO { +} 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/UpdateContextDTO.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateContextDTO.java new file mode 100644 index 000000000000..47d53cfecb60 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateContextDTO.java @@ -0,0 +1,103 @@ +/** + * 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; + +/** + * Update Body schema to represent context to be updated. + */ +public class UpdateContextDTO { + /** + * List of prompts associated with qna to be deleted. + */ + @JsonProperty(value = "promptsToDelete") + private List promptsToDelete; + + /** + * List of prompts to be added to the qna. + */ + @JsonProperty(value = "promptsToAdd") + private List promptsToAdd; + + /** + * To mark if a prompt is relevant only with a previous question or not. + * true - Do not include this QnA as search result for queries without + * context + * false - ignores context and includes this QnA in search result. + */ + @JsonProperty(value = "isContextOnly") + private Boolean isContextOnly; + + /** + * Get list of prompts associated with qna to be deleted. + * + * @return the promptsToDelete value + */ + public List promptsToDelete() { + return this.promptsToDelete; + } + + /** + * Set list of prompts associated with qna to be deleted. + * + * @param promptsToDelete the promptsToDelete value to set + * @return the UpdateContextDTO object itself. + */ + public UpdateContextDTO withPromptsToDelete(List promptsToDelete) { + this.promptsToDelete = promptsToDelete; + return this; + } + + /** + * Get list of prompts to be added to the qna. + * + * @return the promptsToAdd value + */ + public List promptsToAdd() { + return this.promptsToAdd; + } + + /** + * Set list of prompts to be added to the qna. + * + * @param promptsToAdd the promptsToAdd value to set + * @return the UpdateContextDTO object itself. + */ + public UpdateContextDTO withPromptsToAdd(List promptsToAdd) { + this.promptsToAdd = promptsToAdd; + return this; + } + + /** + * Get to mark if a prompt is relevant only with a previous question or not. + true - Do not include this QnA as search result for queries without context + false - ignores context and includes this QnA in search result. + * + * @return the isContextOnly value + */ + public Boolean isContextOnly() { + return this.isContextOnly; + } + + /** + * Set to mark if a prompt is relevant only with a previous question or not. + true - Do not include this QnA as search result for queries without context + false - ignores context and includes this QnA in search result. + * + * @param isContextOnly the isContextOnly value to set + * @return the UpdateContextDTO object itself. + */ + public UpdateContextDTO withIsContextOnly(Boolean isContextOnly) { + this.isContextOnly = isContextOnly; + 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/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..7afe93f1fea3 --- /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 metadata 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 metadata associated with answer to be added. + * + * @return the add value + */ + public List add() { + return this.add; + } + + /** + * Set list of metadata 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..d28ed0e6f87f --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTO.java @@ -0,0 +1,174 @@ +/** + * 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; + + /** + * Context associated with Qna to be updated. + */ + @JsonProperty(value = "context") + private UpdateQnaDTOContext context; + + /** + * 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; + } + + /** + * Get context associated with Qna to be updated. + * + * @return the context value + */ + public UpdateQnaDTOContext context() { + return this.context; + } + + /** + * Set context associated with Qna to be updated. + * + * @param context the context value to set + * @return the UpdateQnaDTO object itself. + */ + public UpdateQnaDTO withContext(UpdateQnaDTOContext context) { + this.context = context; + return this; + } + +} diff --git a/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTOContext.java b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTOContext.java new file mode 100644 index 000000000000..296460c911e2 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/models/UpdateQnaDTOContext.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; + + +/** + * Context associated with Qna to be updated. + */ +public class UpdateQnaDTOContext extends UpdateContextDTO { +} 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;