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 0000000000000..aa6537b5fd992 --- /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 0000000000000..3f17fb84459c3 --- /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 0000000000000..eded5960888d6 --- /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 0000000000000..bb65dc9519999 --- /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 0000000000000..9a1b1589e10ce --- /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 0000000000000..6ef812c6a75ed --- /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 0000000000000..befd34464d853 --- /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 0000000000000..b2e2bb4b162d8 --- /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 0000000000000..d35ab8d72ca02 --- /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 0000000000000..d69791cf0a567 --- /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 0000000000000..9c857f89375a1 --- /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 0000000000000..aa195f3c9dc3e --- /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 0000000000000..9a1079b4bf859 --- /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 0000000000000..0ef00cab59c39 --- /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 0000000000000..dd00520cc82f7 --- /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 0000000000000..0039954280380 --- /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 0000000000000..50b7606b3ba34 --- /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 0000000000000..edcf49be30072 --- /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 0000000000000..f0a5ae0be6900 --- /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 0000000000000..4e3c147e50306 --- /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 0000000000000..0b2636a0dba56 --- /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 0000000000000..6851fe0c02586 --- /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 0000000000000..b91dfa272601e --- /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 0000000000000..480921c65c4f8 --- /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 0000000000000..3839c9bd35208 --- /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 0000000000000..f93cf592b1df2 --- /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 0000000000000..51f079a897bdb --- /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 0000000000000..b477eb7c69143 --- /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 0000000000000..dbc84608cebc8 --- /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 0000000000000..ef29855608f3f --- /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 0000000000000..73975f27cb971 --- /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 0000000000000..f086be715c4f8 --- /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 0000000000000..ffe84ecd8bdf2 --- /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 0000000000000..632cd92279381 --- /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 0000000000000..95f3fbed221ce --- /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 0000000000000..2ff799db68ae3 --- /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 0000000000000..029fb5fd35a20 --- /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 0000000000000..7f9704ad80bfa --- /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 0000000000000..a5346058f1131 --- /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 0000000000000..9cd9ee128fcef --- /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 0000000000000..89866e35bce78 --- /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 0000000000000..8e7e60714bc4e --- /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 0000000000000..4804bbcdf0935 --- /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 0000000000000..7309341288cf9 --- /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 0000000000000..47d53cfecb601 --- /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 0000000000000..567ab9028fbed --- /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 0000000000000..76a2ea1903fd7 --- /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 0000000000000..f1357e231d71e --- /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 0000000000000..81ca8cf69407a --- /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 0000000000000..c75ec4e3603a5 --- /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 0000000000000..7afe93f1fea3c --- /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 0000000000000..d28ed0e6f87f0 --- /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 0000000000000..296460c911e2b --- /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 0000000000000..b020a8b9b56b9 --- /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 0000000000000..2442832425593 --- /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 0000000000000..989dad68f41b1 --- /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 0000000000000..6fefb42c1cf3e --- /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 0000000000000..e6a75733fa37f --- /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 0000000000000..3fb934d575e85 --- /dev/null +++ b/cognitiveservices/data-plane/knowledge/qnamaker/src/main/java/com/microsoft/azure/cognitiveservices/knowledge/qnamaker/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for QnAMakerClient. + * An API for QnAMaker Service. + */ +package com.microsoft.azure.cognitiveservices.knowledge.qnamaker; diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/FormRecognizerClient.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/FormRecognizerClient.java new file mode 100644 index 0000000000000..85b6182847694 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/FormRecognizerClient.java @@ -0,0 +1,551 @@ +/** + * 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.formrecognizer; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.AnalyzeResult; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.BatchReadReceiptHeaders; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.BatchReadReceiptInStreamHeaders; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.ComputerVisionErrorException; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.KeysResult; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.ModelResult; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.ModelsResult; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.ReadReceiptResult; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.TrainRequest; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.TrainResult; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import rx.Observable; + +/** + * The interface for FormRecognizerClient class. + */ +public interface FormRecognizerClient { + /** + * 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://westus2.api.cognitive.microsoft.com).. + * + * @return the endpoint value. + */ + String endpoint(); + + /** + * Sets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).. + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + FormRecognizerClient 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 + */ + FormRecognizerClient 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 + */ + FormRecognizerClient 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 + */ + FormRecognizerClient withGenerateClientRequestId(boolean generateClientRequestId); + + /** + * Train Model. + * Create and train a custom model. The train request must include a source parameter that is either an externally accessible Azure Storage blob container Uri (preferably a Shared Access Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, they must follow the Linux/Unix path format and be an absolute path rooted to the input mount configuration + setting value e.g., if '{Mounts:Input}' configuration setting value is '/input' then a valid source path would be '/input/contosodataset'. All data to be trained is expected to be directly under the source folder. Subfolders are not supported. Models are trained using documents that are of the following content type - 'application/pdf', 'image/jpeg' and 'image/png'." + Other type of content is ignored. + * + * @param trainRequest Request object for training. + * @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 TrainResult object if successful. + */ + TrainResult trainCustomModel(TrainRequest trainRequest); + + /** + * Train Model. + * Create and train a custom model. The train request must include a source parameter that is either an externally accessible Azure Storage blob container Uri (preferably a Shared Access Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, they must follow the Linux/Unix path format and be an absolute path rooted to the input mount configuration + setting value e.g., if '{Mounts:Input}' configuration setting value is '/input' then a valid source path would be '/input/contosodataset'. All data to be trained is expected to be directly under the source folder. Subfolders are not supported. Models are trained using documents that are of the following content type - 'application/pdf', 'image/jpeg' and 'image/png'." + Other type of content is ignored. + * + * @param trainRequest Request object for training. + * @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 trainCustomModelAsync(TrainRequest trainRequest, final ServiceCallback serviceCallback); + + /** + * Train Model. + * Create and train a custom model. The train request must include a source parameter that is either an externally accessible Azure Storage blob container Uri (preferably a Shared Access Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, they must follow the Linux/Unix path format and be an absolute path rooted to the input mount configuration + setting value e.g., if '{Mounts:Input}' configuration setting value is '/input' then a valid source path would be '/input/contosodataset'. All data to be trained is expected to be directly under the source folder. Subfolders are not supported. Models are trained using documents that are of the following content type - 'application/pdf', 'image/jpeg' and 'image/png'." + Other type of content is ignored. + * + * @param trainRequest Request object for training. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainResult object + */ + Observable trainCustomModelAsync(TrainRequest trainRequest); + + /** + * Train Model. + * Create and train a custom model. The train request must include a source parameter that is either an externally accessible Azure Storage blob container Uri (preferably a Shared Access Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, they must follow the Linux/Unix path format and be an absolute path rooted to the input mount configuration + setting value e.g., if '{Mounts:Input}' configuration setting value is '/input' then a valid source path would be '/input/contosodataset'. All data to be trained is expected to be directly under the source folder. Subfolders are not supported. Models are trained using documents that are of the following content type - 'application/pdf', 'image/jpeg' and 'image/png'." + Other type of content is ignored. + * + * @param trainRequest Request object for training. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainResult object + */ + Observable> trainCustomModelWithServiceResponseAsync(TrainRequest trainRequest); + + /** + * Get Keys. + * Retrieve the keys that were + extracted during the training of the specified model. + * + * @param id Model identifier. + * @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 KeysResult object if successful. + */ + KeysResult getExtractedKeys(UUID id); + + /** + * Get Keys. + * Retrieve the keys that were + extracted during the training of the specified model. + * + * @param id Model identifier. + * @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 getExtractedKeysAsync(UUID id, final ServiceCallback serviceCallback); + + /** + * Get Keys. + * Retrieve the keys that were + extracted during the training of the specified model. + * + * @param id Model identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeysResult object + */ + Observable getExtractedKeysAsync(UUID id); + + /** + * Get Keys. + * Retrieve the keys that were + extracted during the training of the specified model. + * + * @param id Model identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeysResult object + */ + Observable> getExtractedKeysWithServiceResponseAsync(UUID id); + + /** + * Get Models. + * Get information about all trained custom models. + * + * @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 ModelsResult object if successful. + */ + ModelsResult getCustomModels(); + + /** + * Get Models. + * Get information about all trained custom models. + * + * @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 getCustomModelsAsync(final ServiceCallback serviceCallback); + + /** + * Get Models. + * Get information about all trained custom models. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ModelsResult object + */ + Observable getCustomModelsAsync(); + + /** + * Get Models. + * Get information about all trained custom models. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ModelsResult object + */ + Observable> getCustomModelsWithServiceResponseAsync(); + + /** + * Get Model. + * Get information about a model. + * + * @param id Model identifier. + * @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 ModelResult object if successful. + */ + ModelResult getCustomModel(UUID id); + + /** + * Get Model. + * Get information about a model. + * + * @param id Model identifier. + * @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 getCustomModelAsync(UUID id, final ServiceCallback serviceCallback); + + /** + * Get Model. + * Get information about a model. + * + * @param id Model identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ModelResult object + */ + Observable getCustomModelAsync(UUID id); + + /** + * Get Model. + * Get information about a model. + * + * @param id Model identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ModelResult object + */ + Observable> getCustomModelWithServiceResponseAsync(UUID id); + + /** + * Delete Model. + * Delete model artifacts. + * + * @param id The identifier of the model to delete. + * @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 deleteCustomModel(UUID id); + + /** + * Delete Model. + * Delete model artifacts. + * + * @param id The identifier of the model to delete. + * @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 deleteCustomModelAsync(UUID id, final ServiceCallback serviceCallback); + + /** + * Delete Model. + * Delete model artifacts. + * + * @param id The identifier of the model to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable deleteCustomModelAsync(UUID id); + + /** + * Delete Model. + * Delete model artifacts. + * + * @param id The identifier of the model to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + Observable> deleteCustomModelWithServiceResponseAsync(UUID id); + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @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 AnalyzeResult object if successful. + */ + AnalyzeResult analyzeWithCustomModel(UUID id, byte[] formStream); + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @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 analyzeWithCustomModelAsync(UUID id, byte[] formStream, final ServiceCallback serviceCallback); + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AnalyzeResult object + */ + Observable analyzeWithCustomModelAsync(UUID id, byte[] formStream); + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AnalyzeResult object + */ + Observable> analyzeWithCustomModelWithServiceResponseAsync(UUID id, byte[] formStream); + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @param keys An optional list of known keys to extract the values for. + * @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 AnalyzeResult object if successful. + */ + AnalyzeResult analyzeWithCustomModel(UUID id, byte[] formStream, List keys); + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @param keys An optional list of known keys to extract the values for. + * @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 analyzeWithCustomModelAsync(UUID id, byte[] formStream, List keys, final ServiceCallback serviceCallback); + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @param keys An optional list of known keys to extract the values for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AnalyzeResult object + */ + Observable analyzeWithCustomModelAsync(UUID id, byte[] formStream, List keys); + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @param keys An optional list of known keys to extract the values for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AnalyzeResult object + */ + Observable> analyzeWithCustomModelWithServiceResponseAsync(UUID id, byte[] formStream, List keys); + + /** + * Batch Read Receipt operation. The response contains a field called 'Operation-Location', which contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void batchReadReceipt(String url); + + /** + * Batch Read Receipt operation. The response contains a field called 'Operation-Location', which contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param url Publicly reachable URL of an image. + * @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 batchReadReceiptAsync(String url, final ServiceCallback serviceCallback); + + /** + * Batch Read Receipt operation. The response contains a field called 'Operation-Location', which contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable batchReadReceiptAsync(String url); + + /** + * Batch Read Receipt operation. The response contains a field called 'Operation-Location', which contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> batchReadReceiptWithServiceResponseAsync(String url); + + /** + * This interface is used for getting the analysis results of a 'Batch Read Receipt' operation. The URL to this interface should be retrieved from the 'Operation-Location' field returned from the 'Batch Read Receipt' operation. + * + * @param operationId Id of read operation returned in the response of a 'Batch Read Receipt' operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ReadReceiptResult object if successful. + */ + ReadReceiptResult getReadReceiptResult(String operationId); + + /** + * This interface is used for getting the analysis results of a 'Batch Read Receipt' operation. The URL to this interface should be retrieved from the 'Operation-Location' field returned from the 'Batch Read Receipt' operation. + * + * @param operationId Id of read operation returned in the response of a 'Batch Read Receipt' operation. + * @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 getReadReceiptResultAsync(String operationId, final ServiceCallback serviceCallback); + + /** + * This interface is used for getting the analysis results of a 'Batch Read Receipt' operation. The URL to this interface should be retrieved from the 'Operation-Location' field returned from the 'Batch Read Receipt' operation. + * + * @param operationId Id of read operation returned in the response of a 'Batch Read Receipt' operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReadReceiptResult object + */ + Observable getReadReceiptResultAsync(String operationId); + + /** + * This interface is used for getting the analysis results of a 'Batch Read Receipt' operation. The URL to this interface should be retrieved from the 'Operation-Location' field returned from the 'Batch Read Receipt' operation. + * + * @param operationId Id of read operation returned in the response of a 'Batch Read Receipt' operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReadReceiptResult object + */ + Observable> getReadReceiptResultWithServiceResponseAsync(String operationId); + + /** + * Read Receipt operation. When you use the 'Batch Read Receipt' interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void batchReadReceiptInStream(byte[] image); + + /** + * Read Receipt operation. When you use the 'Batch Read Receipt' interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param image An image stream. + * @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 batchReadReceiptInStreamAsync(byte[] image, final ServiceCallback serviceCallback); + + /** + * Read Receipt operation. When you use the 'Batch Read Receipt' interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable batchReadReceiptInStreamAsync(byte[] image); + + /** + * Read Receipt operation. When you use the 'Batch Read Receipt' interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + Observable> batchReadReceiptInStreamWithServiceResponseAsync(byte[] image); + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/implementation/FormRecognizerClientImpl.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/implementation/FormRecognizerClientImpl.java new file mode 100644 index 0000000000000..0b92d95ec0d55 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/implementation/FormRecognizerClientImpl.java @@ -0,0 +1,1080 @@ +/** + * 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.formrecognizer.implementation; + +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.cognitiveservices.formrecognizer.FormRecognizerClient; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.AnalyzeResult; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.BatchReadReceiptHeaders; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.BatchReadReceiptInStreamHeaders; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.ComputerVisionErrorException; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.ErrorResponseException; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.ImageUrl; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.KeysResult; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.ModelResult; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.ModelsResult; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.ReadReceiptResult; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.TrainRequest; +import com.microsoft.azure.cognitiveservices.formrecognizer.models.TrainResult; +import com.microsoft.rest.CollectionFormat; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.InputStream; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.MediaType; +import okhttp3.RequestBody; +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.Multipart; +import retrofit2.http.Part; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * Initializes a new instance of the FormRecognizerClientImpl class. + */ +public class FormRecognizerClientImpl extends AzureServiceClient implements FormRecognizerClient { + /** The Retrofit service to perform REST calls. */ + private FormRecognizerClientService service; + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). */ + private String endpoint; + + /** + * Gets Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.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://westus2.api.cognitive.microsoft.com). + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + public FormRecognizerClientImpl 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 FormRecognizerClientImpl 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 FormRecognizerClientImpl 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 FormRecognizerClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * Initializes an instance of FormRecognizerClient client. + * + * @param credentials the management credentials for Azure + */ + public FormRecognizerClientImpl(ServiceClientCredentials credentials) { + this("https://{Endpoint}/formrecognizer/v1.0-preview", credentials); + } + + /** + * Initializes an instance of FormRecognizerClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + private FormRecognizerClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of FormRecognizerClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public FormRecognizerClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.azureClient = new AzureClient(this); + initializeService(); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "FormRecognizerClient", "1.0-preview"); + } + + private void initializeService() { + service = restClient().retrofit().create(FormRecognizerClientService.class); + } + + /** + * The interface defining all the services for FormRecognizerClient to be + * used by Retrofit to perform actually REST calls. + */ + interface FormRecognizerClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.formrecognizer.FormRecognizerClient trainCustomModel" }) + @POST("custom/train") + Observable> trainCustomModel(@Body TrainRequest trainRequest, @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.formrecognizer.FormRecognizerClient getExtractedKeys" }) + @GET("custom/models/{id}/keys") + Observable> getExtractedKeys(@Path("id") UUID id, @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.formrecognizer.FormRecognizerClient getCustomModels" }) + @GET("custom/models") + Observable> getCustomModels(@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.formrecognizer.FormRecognizerClient getCustomModel" }) + @GET("custom/models/{id}") + Observable> getCustomModel(@Path("id") UUID id, @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.formrecognizer.FormRecognizerClient deleteCustomModel" }) + @HTTP(path = "custom/models/{id}", method = "DELETE", hasBody = true) + Observable> deleteCustomModel(@Path("id") UUID id, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Multipart + @POST("custom/models/{id}/analyze") + Observable> analyzeWithCustomModel(@Path("id") UUID id, @Query("keys") String keys, @Part("form_stream") RequestBody formStream, @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.formrecognizer.FormRecognizerClient batchReadReceipt" }) + @POST("prebuilt/receipt/asyncBatchAnalyze") + Observable> batchReadReceipt(@Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @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.formrecognizer.FormRecognizerClient getReadReceiptResult" }) + @GET("prebuilt/receipt/operations/{operationId}") + Observable> getReadReceiptResult(@Path("operationId") String operationId, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.formrecognizer.FormRecognizerClient batchReadReceiptInStream" }) + @POST("prebuilt/receipt/asyncBatchAnalyze") + Observable> batchReadReceiptInStream(@Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + } + + /** + * Train Model. + * Create and train a custom model. The train request must include a source parameter that is either an externally accessible Azure Storage blob container Uri (preferably a Shared Access Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, they must follow the Linux/Unix path format and be an absolute path rooted to the input mount configuration + setting value e.g., if '{Mounts:Input}' configuration setting value is '/input' then a valid source path would be '/input/contosodataset'. All data to be trained is expected to be directly under the source folder. Subfolders are not supported. Models are trained using documents that are of the following content type - 'application/pdf', 'image/jpeg' and 'image/png'." + Other type of content is ignored. + * + * @param trainRequest Request object for training. + * @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 TrainResult object if successful. + */ + public TrainResult trainCustomModel(TrainRequest trainRequest) { + return trainCustomModelWithServiceResponseAsync(trainRequest).toBlocking().single().body(); + } + + /** + * Train Model. + * Create and train a custom model. The train request must include a source parameter that is either an externally accessible Azure Storage blob container Uri (preferably a Shared Access Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, they must follow the Linux/Unix path format and be an absolute path rooted to the input mount configuration + setting value e.g., if '{Mounts:Input}' configuration setting value is '/input' then a valid source path would be '/input/contosodataset'. All data to be trained is expected to be directly under the source folder. Subfolders are not supported. Models are trained using documents that are of the following content type - 'application/pdf', 'image/jpeg' and 'image/png'." + Other type of content is ignored. + * + * @param trainRequest Request object for training. + * @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 trainCustomModelAsync(TrainRequest trainRequest, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(trainCustomModelWithServiceResponseAsync(trainRequest), serviceCallback); + } + + /** + * Train Model. + * Create and train a custom model. The train request must include a source parameter that is either an externally accessible Azure Storage blob container Uri (preferably a Shared Access Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, they must follow the Linux/Unix path format and be an absolute path rooted to the input mount configuration + setting value e.g., if '{Mounts:Input}' configuration setting value is '/input' then a valid source path would be '/input/contosodataset'. All data to be trained is expected to be directly under the source folder. Subfolders are not supported. Models are trained using documents that are of the following content type - 'application/pdf', 'image/jpeg' and 'image/png'." + Other type of content is ignored. + * + * @param trainRequest Request object for training. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainResult object + */ + public Observable trainCustomModelAsync(TrainRequest trainRequest) { + return trainCustomModelWithServiceResponseAsync(trainRequest).map(new Func1, TrainResult>() { + @Override + public TrainResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Train Model. + * Create and train a custom model. The train request must include a source parameter that is either an externally accessible Azure Storage blob container Uri (preferably a Shared Access Signature Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, they must follow the Linux/Unix path format and be an absolute path rooted to the input mount configuration + setting value e.g., if '{Mounts:Input}' configuration setting value is '/input' then a valid source path would be '/input/contosodataset'. All data to be trained is expected to be directly under the source folder. Subfolders are not supported. Models are trained using documents that are of the following content type - 'application/pdf', 'image/jpeg' and 'image/png'." + Other type of content is ignored. + * + * @param trainRequest Request object for training. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TrainResult object + */ + public Observable> trainCustomModelWithServiceResponseAsync(TrainRequest trainRequest) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (trainRequest == null) { + throw new IllegalArgumentException("Parameter trainRequest is required and cannot be null."); + } + Validator.validate(trainRequest); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.trainCustomModel(trainRequest, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = trainCustomModelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse trainCustomModelDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get Keys. + * Retrieve the keys that were + extracted during the training of the specified model. + * + * @param id Model identifier. + * @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 KeysResult object if successful. + */ + public KeysResult getExtractedKeys(UUID id) { + return getExtractedKeysWithServiceResponseAsync(id).toBlocking().single().body(); + } + + /** + * Get Keys. + * Retrieve the keys that were + extracted during the training of the specified model. + * + * @param id Model identifier. + * @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 getExtractedKeysAsync(UUID id, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getExtractedKeysWithServiceResponseAsync(id), serviceCallback); + } + + /** + * Get Keys. + * Retrieve the keys that were + extracted during the training of the specified model. + * + * @param id Model identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeysResult object + */ + public Observable getExtractedKeysAsync(UUID id) { + return getExtractedKeysWithServiceResponseAsync(id).map(new Func1, KeysResult>() { + @Override + public KeysResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get Keys. + * Retrieve the keys that were + extracted during the training of the specified model. + * + * @param id Model identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the KeysResult object + */ + public Observable> getExtractedKeysWithServiceResponseAsync(UUID id) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (id == null) { + throw new IllegalArgumentException("Parameter id is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.getExtractedKeys(id, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getExtractedKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getExtractedKeysDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get Models. + * Get information about all trained custom models. + * + * @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 ModelsResult object if successful. + */ + public ModelsResult getCustomModels() { + return getCustomModelsWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Get Models. + * Get information about all trained custom models. + * + * @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 getCustomModelsAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCustomModelsWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get Models. + * Get information about all trained custom models. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ModelsResult object + */ + public Observable getCustomModelsAsync() { + return getCustomModelsWithServiceResponseAsync().map(new Func1, ModelsResult>() { + @Override + public ModelsResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get Models. + * Get information about all trained custom models. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ModelsResult object + */ + public Observable> getCustomModelsWithServiceResponseAsync() { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.getCustomModels(this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCustomModelsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCustomModelsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get Model. + * Get information about a model. + * + * @param id Model identifier. + * @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 ModelResult object if successful. + */ + public ModelResult getCustomModel(UUID id) { + return getCustomModelWithServiceResponseAsync(id).toBlocking().single().body(); + } + + /** + * Get Model. + * Get information about a model. + * + * @param id Model identifier. + * @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 getCustomModelAsync(UUID id, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCustomModelWithServiceResponseAsync(id), serviceCallback); + } + + /** + * Get Model. + * Get information about a model. + * + * @param id Model identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ModelResult object + */ + public Observable getCustomModelAsync(UUID id) { + return getCustomModelWithServiceResponseAsync(id).map(new Func1, ModelResult>() { + @Override + public ModelResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get Model. + * Get information about a model. + * + * @param id Model identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ModelResult object + */ + public Observable> getCustomModelWithServiceResponseAsync(UUID id) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (id == null) { + throw new IllegalArgumentException("Parameter id is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.getCustomModel(id, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCustomModelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCustomModelDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete Model. + * Delete model artifacts. + * + * @param id The identifier of the model to delete. + * @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 deleteCustomModel(UUID id) { + deleteCustomModelWithServiceResponseAsync(id).toBlocking().single().body(); + } + + /** + * Delete Model. + * Delete model artifacts. + * + * @param id The identifier of the model to delete. + * @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 deleteCustomModelAsync(UUID id, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteCustomModelWithServiceResponseAsync(id), serviceCallback); + } + + /** + * Delete Model. + * Delete model artifacts. + * + * @param id The identifier of the model to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteCustomModelAsync(UUID id) { + return deleteCustomModelWithServiceResponseAsync(id).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete Model. + * Delete model artifacts. + * + * @param id The identifier of the model to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteCustomModelWithServiceResponseAsync(UUID id) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (id == null) { + throw new IllegalArgumentException("Parameter id is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.deleteCustomModel(id, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteCustomModelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteCustomModelDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @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 AnalyzeResult object if successful. + */ + public AnalyzeResult analyzeWithCustomModel(UUID id, byte[] formStream) { + return analyzeWithCustomModelWithServiceResponseAsync(id, formStream).toBlocking().single().body(); + } + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @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 analyzeWithCustomModelAsync(UUID id, byte[] formStream, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(analyzeWithCustomModelWithServiceResponseAsync(id, formStream), serviceCallback); + } + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AnalyzeResult object + */ + public Observable analyzeWithCustomModelAsync(UUID id, byte[] formStream) { + return analyzeWithCustomModelWithServiceResponseAsync(id, formStream).map(new Func1, AnalyzeResult>() { + @Override + public AnalyzeResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AnalyzeResult object + */ + public Observable> analyzeWithCustomModelWithServiceResponseAsync(UUID id, byte[] formStream) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (id == null) { + throw new IllegalArgumentException("Parameter id is required and cannot be null."); + } + if (formStream == null) { + throw new IllegalArgumentException("Parameter formStream is required and cannot be null."); + } + final List keys = null; + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + String keysConverted = this.serializerAdapter().serializeList(keys, CollectionFormat.CSV);RequestBody formStreamConverted = RequestBody.create(MediaType.parse("multipart/form-data"), formStream); + return service.analyzeWithCustomModel(id, keysConverted, formStreamConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = analyzeWithCustomModelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @param keys An optional list of known keys to extract the values for. + * @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 AnalyzeResult object if successful. + */ + public AnalyzeResult analyzeWithCustomModel(UUID id, byte[] formStream, List keys) { + return analyzeWithCustomModelWithServiceResponseAsync(id, formStream, keys).toBlocking().single().body(); + } + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @param keys An optional list of known keys to extract the values for. + * @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 analyzeWithCustomModelAsync(UUID id, byte[] formStream, List keys, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(analyzeWithCustomModelWithServiceResponseAsync(id, formStream, keys), serviceCallback); + } + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @param keys An optional list of known keys to extract the values for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AnalyzeResult object + */ + public Observable analyzeWithCustomModelAsync(UUID id, byte[] formStream, List keys) { + return analyzeWithCustomModelWithServiceResponseAsync(id, formStream, keys).map(new Func1, AnalyzeResult>() { + @Override + public AnalyzeResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Analyze Form. + * Extract key-value pairs from a given document. The input document must be of one of the supported content types - 'application/pdf', 'image/jpeg' or 'image/png'. A success response is returned in JSON. + * + * @param id Model Identifier to analyze the document with. + * @param formStream A pdf document or image (jpg,png) file to analyze. + * @param keys An optional list of known keys to extract the values for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AnalyzeResult object + */ + public Observable> analyzeWithCustomModelWithServiceResponseAsync(UUID id, byte[] formStream, List keys) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (id == null) { + throw new IllegalArgumentException("Parameter id is required and cannot be null."); + } + if (formStream == null) { + throw new IllegalArgumentException("Parameter formStream is required and cannot be null."); + } + Validator.validate(keys); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + String keysConverted = this.serializerAdapter().serializeList(keys, CollectionFormat.CSV);RequestBody formStreamConverted = RequestBody.create(MediaType.parse("multipart/form-data"), formStream); + return service.analyzeWithCustomModel(id, keysConverted, formStreamConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = analyzeWithCustomModelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse analyzeWithCustomModelDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Batch Read Receipt operation. The response contains a field called 'Operation-Location', which contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void batchReadReceipt(String url) { + batchReadReceiptWithServiceResponseAsync(url).toBlocking().single().body(); + } + + /** + * Batch Read Receipt operation. The response contains a field called 'Operation-Location', which contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param url Publicly reachable URL of an image. + * @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 batchReadReceiptAsync(String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(batchReadReceiptWithServiceResponseAsync(url), serviceCallback); + } + + /** + * Batch Read Receipt operation. The response contains a field called 'Operation-Location', which contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable batchReadReceiptAsync(String url) { + return batchReadReceiptWithServiceResponseAsync(url).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Batch Read Receipt operation. The response contains a field called 'Operation-Location', which contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> batchReadReceiptWithServiceResponseAsync(String url) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + ImageUrl imageUrl = new ImageUrl(); + imageUrl.withUrl(url); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.batchReadReceipt(this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = batchReadReceiptDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders batchReadReceiptDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ComputerVisionErrorException.class) + .buildWithHeaders(response, BatchReadReceiptHeaders.class); + } + + /** + * This interface is used for getting the analysis results of a 'Batch Read Receipt' operation. The URL to this interface should be retrieved from the 'Operation-Location' field returned from the 'Batch Read Receipt' operation. + * + * @param operationId Id of read operation returned in the response of a 'Batch Read Receipt' operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ReadReceiptResult object if successful. + */ + public ReadReceiptResult getReadReceiptResult(String operationId) { + return getReadReceiptResultWithServiceResponseAsync(operationId).toBlocking().single().body(); + } + + /** + * This interface is used for getting the analysis results of a 'Batch Read Receipt' operation. The URL to this interface should be retrieved from the 'Operation-Location' field returned from the 'Batch Read Receipt' operation. + * + * @param operationId Id of read operation returned in the response of a 'Batch Read Receipt' operation. + * @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 getReadReceiptResultAsync(String operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getReadReceiptResultWithServiceResponseAsync(operationId), serviceCallback); + } + + /** + * This interface is used for getting the analysis results of a 'Batch Read Receipt' operation. The URL to this interface should be retrieved from the 'Operation-Location' field returned from the 'Batch Read Receipt' operation. + * + * @param operationId Id of read operation returned in the response of a 'Batch Read Receipt' operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReadReceiptResult object + */ + public Observable getReadReceiptResultAsync(String operationId) { + return getReadReceiptResultWithServiceResponseAsync(operationId).map(new Func1, ReadReceiptResult>() { + @Override + public ReadReceiptResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * This interface is used for getting the analysis results of a 'Batch Read Receipt' operation. The URL to this interface should be retrieved from the 'Operation-Location' field returned from the 'Batch Read Receipt' operation. + * + * @param operationId Id of read operation returned in the response of a 'Batch Read Receipt' operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ReadReceiptResult object + */ + public Observable> getReadReceiptResultWithServiceResponseAsync(String operationId) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.getReadReceiptResult(operationId, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getReadReceiptResultDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getReadReceiptResultDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ComputerVisionErrorException.class) + .build(response); + } + + /** + * Read Receipt operation. When you use the 'Batch Read Receipt' interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void batchReadReceiptInStream(byte[] image) { + batchReadReceiptInStreamWithServiceResponseAsync(image).toBlocking().single().body(); + } + + /** + * Read Receipt operation. When you use the 'Batch Read Receipt' interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param image An image stream. + * @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 batchReadReceiptInStreamAsync(byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(batchReadReceiptInStreamWithServiceResponseAsync(image), serviceCallback); + } + + /** + * Read Receipt operation. When you use the 'Batch Read Receipt' interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable batchReadReceiptInStreamAsync(byte[] image) { + return batchReadReceiptInStreamWithServiceResponseAsync(image).map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Read Receipt operation. When you use the 'Batch Read Receipt' interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your 'Get Read Receipt Result' operation. + * + * @param image An image stream. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> batchReadReceiptInStreamWithServiceResponseAsync(byte[] image) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (image == null) { + throw new IllegalArgumentException("Parameter image is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); + return service.batchReadReceiptInStream(imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = batchReadReceiptInStreamDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders batchReadReceiptInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ComputerVisionErrorException.class) + .buildWithHeaders(response, BatchReadReceiptInStreamHeaders.class); + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/implementation/package-info.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/implementation/package-info.java new file mode 100644 index 0000000000000..47490d16cdb7a --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/implementation/package-info.java @@ -0,0 +1,10 @@ +// 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 FormRecognizerClient. + */ +package com.microsoft.azure.cognitiveservices.formrecognizer.implementation; diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/AnalyzeResult.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/AnalyzeResult.java new file mode 100644 index 0000000000000..fa97fbb84e875 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/AnalyzeResult.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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Analyze API call result. + */ +public class AnalyzeResult { + /** + * Status of the analyze operation. Possible values include: 'success', + * 'partialSuccess', 'failure'. + */ + @JsonProperty(value = "status") + private String status; + + /** + * Page level information extracted in the analyzed + * document. + */ + @JsonProperty(value = "pages") + private List pages; + + /** + * List of errors reported during the analyze + * operation. + */ + @JsonProperty(value = "errors") + private List errors; + + /** + * Get status of the analyze operation. Possible values include: 'success', 'partialSuccess', 'failure'. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set status of the analyze operation. Possible values include: 'success', 'partialSuccess', 'failure'. + * + * @param status the status value to set + * @return the AnalyzeResult object itself. + */ + public AnalyzeResult withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get page level information extracted in the analyzed + document. + * + * @return the pages value + */ + public List pages() { + return this.pages; + } + + /** + * Set page level information extracted in the analyzed + document. + * + * @param pages the pages value to set + * @return the AnalyzeResult object itself. + */ + public AnalyzeResult withPages(List pages) { + this.pages = pages; + return this; + } + + /** + * Get list of errors reported during the analyze + operation. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + + /** + * Set list of errors reported during the analyze + operation. + * + * @param errors the errors value to set + * @return the AnalyzeResult object itself. + */ + public AnalyzeResult withErrors(List errors) { + this.errors = errors; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/BatchReadReceiptHeaders.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/BatchReadReceiptHeaders.java new file mode 100644 index 0000000000000..0763d880fd113 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/BatchReadReceiptHeaders.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for BatchReadReceipt operation. + */ +public class BatchReadReceiptHeaders { + /** + * URL to query for status of the operation. The URL will expire in 48 + * hours. + */ + @JsonProperty(value = "Operation-Location") + private String operationLocation; + + /** + * Get uRL to query for status of the operation. The URL will expire in 48 hours. + * + * @return the operationLocation value + */ + public String operationLocation() { + return this.operationLocation; + } + + /** + * Set uRL to query for status of the operation. The URL will expire in 48 hours. + * + * @param operationLocation the operationLocation value to set + * @return the BatchReadReceiptHeaders object itself. + */ + public BatchReadReceiptHeaders withOperationLocation(String operationLocation) { + this.operationLocation = operationLocation; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/BatchReadReceiptInStreamHeaders.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/BatchReadReceiptInStreamHeaders.java new file mode 100644 index 0000000000000..479b9e3d38981 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/BatchReadReceiptInStreamHeaders.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for BatchReadReceiptInStream operation. + */ +public class BatchReadReceiptInStreamHeaders { + /** + * URL to query for status of the operation. The URL will expire in 48 + * hours. + */ + @JsonProperty(value = "Operation-Location") + private String operationLocation; + + /** + * Get uRL to query for status of the operation. The URL will expire in 48 hours. + * + * @return the operationLocation value + */ + public String operationLocation() { + return this.operationLocation; + } + + /** + * Set uRL to query for status of the operation. The URL will expire in 48 hours. + * + * @param operationLocation the operationLocation value to set + * @return the BatchReadReceiptInStreamHeaders object itself. + */ + public BatchReadReceiptInStreamHeaders withOperationLocation(String operationLocation) { + this.operationLocation = operationLocation; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ComputerVisionError.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ComputerVisionError.java new file mode 100644 index 0000000000000..2a0b5e35c3c1e --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ComputerVisionError.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about the API request error. + */ +public class ComputerVisionError { + /** + * The error code. + */ + @JsonProperty(value = "code", required = true) + private Object code; + + /** + * A message explaining the error reported by the service. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /** + * A unique request identifier. + */ + @JsonProperty(value = "requestId") + private String requestId; + + /** + * Get the error code. + * + * @return the code value + */ + public Object code() { + return this.code; + } + + /** + * Set the error code. + * + * @param code the code value to set + * @return the ComputerVisionError object itself. + */ + public ComputerVisionError withCode(Object code) { + this.code = code; + return this; + } + + /** + * Get a message explaining the error reported by the service. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set a message explaining the error reported by the service. + * + * @param message the message value to set + * @return the ComputerVisionError object itself. + */ + public ComputerVisionError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get a unique request identifier. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set a unique request identifier. + * + * @param requestId the requestId value to set + * @return the ComputerVisionError object itself. + */ + public ComputerVisionError withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ComputerVisionErrorException.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ComputerVisionErrorException.java new file mode 100644 index 0000000000000..9a20f70b2e410 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ComputerVisionErrorException.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.formrecognizer.models; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ComputerVisionError + * information. + */ +public class ComputerVisionErrorException extends RestException { + /** + * Initializes a new instance of the ComputerVisionErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ComputerVisionErrorException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ComputerVisionErrorException 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 ComputerVisionErrorException(final String message, final Response response, final ComputerVisionError body) { + super(message, response, body); + } + + @Override + public ComputerVisionError body() { + return (ComputerVisionError) super.body(); + } +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ElementReference.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ElementReference.java new file mode 100644 index 0000000000000..38889b4e44377 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ElementReference.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Reference to an OCR word. + */ +public class ElementReference { + /** + * The ref property. + */ + @JsonProperty(value = "$ref") + private String ref; + + /** + * Get the ref value. + * + * @return the ref value + */ + public String ref() { + return this.ref; + } + + /** + * Set the ref value. + * + * @param ref the ref value to set + * @return the ElementReference object itself. + */ + public ElementReference withRef(String ref) { + this.ref = ref; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ErrorInformation.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ErrorInformation.java new file mode 100644 index 0000000000000..edf56120531ad --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ErrorInformation.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ErrorInformation model. + */ +public class ErrorInformation { + /** + * The code property. + */ + @JsonProperty(value = "code") + private String code; + + /** + * The innerError property. + */ + @JsonProperty(value = "innerError") + private InnerError innerError; + + /** + * The message property. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the ErrorInformation object itself. + */ + public ErrorInformation withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the innerError value. + * + * @return the innerError value + */ + public InnerError innerError() { + return this.innerError; + } + + /** + * Set the innerError value. + * + * @param innerError the innerError value to set + * @return the ErrorInformation object itself. + */ + public ErrorInformation withInnerError(InnerError innerError) { + this.innerError = innerError; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the ErrorInformation object itself. + */ + public ErrorInformation withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ErrorResponse.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ErrorResponse.java new file mode 100644 index 0000000000000..fe6136a83660a --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ErrorResponse.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ErrorResponse model. + */ +public class ErrorResponse { + /** + * The error property. + */ + @JsonProperty(value = "error") + private ErrorInformation error; + + /** + * Get the error value. + * + * @return the error value + */ + public ErrorInformation error() { + return this.error; + } + + /** + * Set the error value. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorInformation error) { + this.error = error; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ErrorResponseException.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ErrorResponseException.java new file mode 100644 index 0000000000000..edd33e50d6314 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/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.formrecognizer.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/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedKeyValuePair.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedKeyValuePair.java new file mode 100644 index 0000000000000..a51bd21495ccd --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedKeyValuePair.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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Representation of a key-value pair as a list + * of key and value tokens. + */ +public class ExtractedKeyValuePair { + /** + * List of tokens for the extracted key in a key-value pair. + */ + @JsonProperty(value = "key") + private List key; + + /** + * List of tokens for the extracted value in a key-value pair. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get list of tokens for the extracted key in a key-value pair. + * + * @return the key value + */ + public List key() { + return this.key; + } + + /** + * Set list of tokens for the extracted key in a key-value pair. + * + * @param key the key value to set + * @return the ExtractedKeyValuePair object itself. + */ + public ExtractedKeyValuePair withKey(List key) { + this.key = key; + return this; + } + + /** + * Get list of tokens for the extracted value in a key-value pair. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set list of tokens for the extracted value in a key-value pair. + * + * @param value the value value to set + * @return the ExtractedKeyValuePair object itself. + */ + public ExtractedKeyValuePair withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedPage.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedPage.java new file mode 100644 index 0000000000000..f117bae1d50f5 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedPage.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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Extraction information of a single page in a + * with a document. + */ +public class ExtractedPage { + /** + * Page number. + */ + @JsonProperty(value = "number") + private Integer number; + + /** + * Height of the page (in pixels). + */ + @JsonProperty(value = "height") + private Integer height; + + /** + * Width of the page (in pixels). + */ + @JsonProperty(value = "width") + private Integer width; + + /** + * Cluster identifier. + */ + @JsonProperty(value = "clusterId") + private Integer clusterId; + + /** + * List of Key-Value pairs extracted from the page. + */ + @JsonProperty(value = "keyValuePairs") + private List keyValuePairs; + + /** + * List of Tables and their information extracted from the page. + */ + @JsonProperty(value = "tables") + private List tables; + + /** + * Get page number. + * + * @return the number value + */ + public Integer number() { + return this.number; + } + + /** + * Set page number. + * + * @param number the number value to set + * @return the ExtractedPage object itself. + */ + public ExtractedPage withNumber(Integer number) { + this.number = number; + return this; + } + + /** + * Get height of the page (in pixels). + * + * @return the height value + */ + public Integer height() { + return this.height; + } + + /** + * Set height of the page (in pixels). + * + * @param height the height value to set + * @return the ExtractedPage object itself. + */ + public ExtractedPage withHeight(Integer height) { + this.height = height; + return this; + } + + /** + * Get width of the page (in pixels). + * + * @return the width value + */ + public Integer width() { + return this.width; + } + + /** + * Set width of the page (in pixels). + * + * @param width the width value to set + * @return the ExtractedPage object itself. + */ + public ExtractedPage withWidth(Integer width) { + this.width = width; + return this; + } + + /** + * Get cluster identifier. + * + * @return the clusterId value + */ + public Integer clusterId() { + return this.clusterId; + } + + /** + * Set cluster identifier. + * + * @param clusterId the clusterId value to set + * @return the ExtractedPage object itself. + */ + public ExtractedPage withClusterId(Integer clusterId) { + this.clusterId = clusterId; + return this; + } + + /** + * Get list of Key-Value pairs extracted from the page. + * + * @return the keyValuePairs value + */ + public List keyValuePairs() { + return this.keyValuePairs; + } + + /** + * Set list of Key-Value pairs extracted from the page. + * + * @param keyValuePairs the keyValuePairs value to set + * @return the ExtractedPage object itself. + */ + public ExtractedPage withKeyValuePairs(List keyValuePairs) { + this.keyValuePairs = keyValuePairs; + return this; + } + + /** + * Get list of Tables and their information extracted from the page. + * + * @return the tables value + */ + public List tables() { + return this.tables; + } + + /** + * Set list of Tables and their information extracted from the page. + * + * @param tables the tables value to set + * @return the ExtractedPage object itself. + */ + public ExtractedPage withTables(List tables) { + this.tables = tables; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedTable.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedTable.java new file mode 100644 index 0000000000000..d1dd9eb01b1e3 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedTable.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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Extraction information about a table + * contained in a page. + */ +public class ExtractedTable { + /** + * Table identifier. + */ + @JsonProperty(value = "id") + private String id; + + /** + * List of columns contained in the table. + */ + @JsonProperty(value = "columns") + private List columns; + + /** + * Get table identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set table identifier. + * + * @param id the id value to set + * @return the ExtractedTable object itself. + */ + public ExtractedTable withId(String id) { + this.id = id; + return this; + } + + /** + * Get list of columns contained in the table. + * + * @return the columns value + */ + public List columns() { + return this.columns; + } + + /** + * Set list of columns contained in the table. + * + * @param columns the columns value to set + * @return the ExtractedTable object itself. + */ + public ExtractedTable withColumns(List columns) { + this.columns = columns; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedTableColumn.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedTableColumn.java new file mode 100644 index 0000000000000..4e14af9f89df3 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedTableColumn.java @@ -0,0 +1,74 @@ +/** + * 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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Extraction information of a column in + * a table. + */ +public class ExtractedTableColumn { + /** + * List of extracted tokens for the column header. + */ + @JsonProperty(value = "header") + private List headerProperty; + + /** + * Extracted text for each cell of a column. Each cell + * in the column can have a list of one or more tokens. + */ + @JsonProperty(value = "entries") + private List> entries; + + /** + * Get list of extracted tokens for the column header. + * + * @return the headerProperty value + */ + public List headerProperty() { + return this.headerProperty; + } + + /** + * Set list of extracted tokens for the column header. + * + * @param headerProperty the headerProperty value to set + * @return the ExtractedTableColumn object itself. + */ + public ExtractedTableColumn withHeaderProperty(List headerProperty) { + this.headerProperty = headerProperty; + return this; + } + + /** + * Get extracted text for each cell of a column. Each cell + in the column can have a list of one or more tokens. + * + * @return the entries value + */ + public List> entries() { + return this.entries; + } + + /** + * Set extracted text for each cell of a column. Each cell + in the column can have a list of one or more tokens. + * + * @param entries the entries value to set + * @return the ExtractedTableColumn object itself. + */ + public ExtractedTableColumn withEntries(List> entries) { + this.entries = entries; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedToken.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedToken.java new file mode 100644 index 0000000000000..ed920a4198334 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ExtractedToken.java @@ -0,0 +1,108 @@ +/** + * 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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Canonical representation of single extracted text. + */ +public class ExtractedToken { + /** + * String value of the extracted text. + */ + @JsonProperty(value = "text") + private String text; + + /** + * Bounding box of the extracted text. Represents the + * location of the extracted text as a pair of + * cartesian co-ordinates. The co-ordinate pairs are arranged by + * top-left, top-right, bottom-right and bottom-left endpoints box + * with origin reference from the bottom-left of the page. + */ + @JsonProperty(value = "boundingBox") + private List boundingBox; + + /** + * A measure of accuracy of the extracted text. + */ + @JsonProperty(value = "confidence") + private Double confidence; + + /** + * Get string value of the extracted text. + * + * @return the text value + */ + public String text() { + return this.text; + } + + /** + * Set string value of the extracted text. + * + * @param text the text value to set + * @return the ExtractedToken object itself. + */ + public ExtractedToken withText(String text) { + this.text = text; + return this; + } + + /** + * Get bounding box of the extracted text. Represents the + location of the extracted text as a pair of + cartesian co-ordinates. The co-ordinate pairs are arranged by + top-left, top-right, bottom-right and bottom-left endpoints box + with origin reference from the bottom-left of the page. + * + * @return the boundingBox value + */ + public List boundingBox() { + return this.boundingBox; + } + + /** + * Set bounding box of the extracted text. Represents the + location of the extracted text as a pair of + cartesian co-ordinates. The co-ordinate pairs are arranged by + top-left, top-right, bottom-right and bottom-left endpoints box + with origin reference from the bottom-left of the page. + * + * @param boundingBox the boundingBox value to set + * @return the ExtractedToken object itself. + */ + public ExtractedToken withBoundingBox(List boundingBox) { + this.boundingBox = boundingBox; + return this; + } + + /** + * Get a measure of accuracy of the extracted text. + * + * @return the confidence value + */ + public Double confidence() { + return this.confidence; + } + + /** + * Set a measure of accuracy of the extracted text. + * + * @param confidence the confidence value to set + * @return the ExtractedToken object itself. + */ + public ExtractedToken withConfidence(Double confidence) { + this.confidence = confidence; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/FieldValue.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/FieldValue.java new file mode 100644 index 0000000000000..d593033ceab76 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/FieldValue.java @@ -0,0 +1,79 @@ +/** + * 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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Base class representing a recognized field value. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "valueType") +@JsonTypeName("fieldValue") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "stringValue", value = StringValue.class), + @JsonSubTypes.Type(name = "numberValue", value = NumberValue.class) +}) +public class FieldValue { + /** + * OCR text content of the recognized field. + */ + @JsonProperty(value = "text") + private String text; + + /** + * List of references to OCR words comprising the recognized field value. + */ + @JsonProperty(value = "elements") + private List elements; + + /** + * Get oCR text content of the recognized field. + * + * @return the text value + */ + public String text() { + return this.text; + } + + /** + * Set oCR text content of the recognized field. + * + * @param text the text value to set + * @return the FieldValue object itself. + */ + public FieldValue withText(String text) { + this.text = text; + return this; + } + + /** + * Get list of references to OCR words comprising the recognized field value. + * + * @return the elements value + */ + public List elements() { + return this.elements; + } + + /** + * Set list of references to OCR words comprising the recognized field value. + * + * @param elements the elements value to set + * @return the FieldValue object itself. + */ + public FieldValue withElements(List elements) { + this.elements = elements; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/FormDocumentReport.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/FormDocumentReport.java new file mode 100644 index 0000000000000..12445ef605463 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/FormDocumentReport.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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The FormDocumentReport model. + */ +public class FormDocumentReport { + /** + * Reference to the data that the report is for. + */ + @JsonProperty(value = "documentName") + private String documentName; + + /** + * Total number of pages trained on. + */ + @JsonProperty(value = "pages") + private Integer pages; + + /** + * List of errors per page. + */ + @JsonProperty(value = "errors") + private List errors; + + /** + * Status of the training operation. Possible values include: 'success', + * 'partialSuccess', 'failure'. + */ + @JsonProperty(value = "status") + private String status; + + /** + * Get reference to the data that the report is for. + * + * @return the documentName value + */ + public String documentName() { + return this.documentName; + } + + /** + * Set reference to the data that the report is for. + * + * @param documentName the documentName value to set + * @return the FormDocumentReport object itself. + */ + public FormDocumentReport withDocumentName(String documentName) { + this.documentName = documentName; + return this; + } + + /** + * Get total number of pages trained on. + * + * @return the pages value + */ + public Integer pages() { + return this.pages; + } + + /** + * Set total number of pages trained on. + * + * @param pages the pages value to set + * @return the FormDocumentReport object itself. + */ + public FormDocumentReport withPages(Integer pages) { + this.pages = pages; + return this; + } + + /** + * Get list of errors per page. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + + /** + * Set list of errors per page. + * + * @param errors the errors value to set + * @return the FormDocumentReport object itself. + */ + public FormDocumentReport withErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Get status of the training operation. Possible values include: 'success', 'partialSuccess', 'failure'. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set status of the training operation. Possible values include: 'success', 'partialSuccess', 'failure'. + * + * @param status the status value to set + * @return the FormDocumentReport object itself. + */ + public FormDocumentReport withStatus(String status) { + this.status = status; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/FormOperationError.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/FormOperationError.java new file mode 100644 index 0000000000000..a438db9a129fd --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/FormOperationError.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error reported during an operation. + */ +public class FormOperationError { + /** + * Message reported during the train operation. + */ + @JsonProperty(value = "errorMessage") + private String errorMessage; + + /** + * Get message reported during the train operation. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Set message reported during the train operation. + * + * @param errorMessage the errorMessage value to set + * @return the FormOperationError object itself. + */ + public FormOperationError withErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ImageUrl.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ImageUrl.java new file mode 100644 index 0000000000000..d85fdad32ccf7 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ImageUrl.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ImageUrl model. + */ +public class ImageUrl { + /** + * Publicly reachable URL of an image. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * Get publicly reachable URL of an image. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set publicly reachable URL of an image. + * + * @param url the url value to set + * @return the ImageUrl object itself. + */ + public ImageUrl withUrl(String url) { + this.url = url; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/InnerError.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/InnerError.java new file mode 100644 index 0000000000000..dff5fe3b3fae7 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/InnerError.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The InnerError model. + */ +public class InnerError { + /** + * The requestId property. + */ + @JsonProperty(value = "requestId") + private String requestId; + + /** + * Get the requestId value. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId value. + * + * @param requestId the requestId value to set + * @return the InnerError object itself. + */ + public InnerError withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/KeysResult.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/KeysResult.java new file mode 100644 index 0000000000000..7895ce0b61116 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/KeysResult.java @@ -0,0 +1,46 @@ +/** + * 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.formrecognizer.models; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of an operation to get + * the keys extracted by a model. + */ +public class KeysResult { + /** + * Object mapping ClusterIds to Key lists. + */ + @JsonProperty(value = "clusters") + private Map> clusters; + + /** + * Get object mapping ClusterIds to Key lists. + * + * @return the clusters value + */ + public Map> clusters() { + return this.clusters; + } + + /** + * Set object mapping ClusterIds to Key lists. + * + * @param clusters the clusters value to set + * @return the KeysResult object itself. + */ + public KeysResult withClusters(Map> clusters) { + this.clusters = clusters; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/Line.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/Line.java new file mode 100644 index 0000000000000..501e592bfc84c --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/Line.java @@ -0,0 +1,96 @@ +/** + * 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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object representing a recognized text line. + */ +public class Line { + /** + * Bounding box of a recognized line. + */ + @JsonProperty(value = "boundingBox") + private List boundingBox; + + /** + * The text content of the line. + */ + @JsonProperty(value = "text") + private String text; + + /** + * List of words in the text line. + */ + @JsonProperty(value = "words") + private List words; + + /** + * Get bounding box of a recognized line. + * + * @return the boundingBox value + */ + public List boundingBox() { + return this.boundingBox; + } + + /** + * Set bounding box of a recognized line. + * + * @param boundingBox the boundingBox value to set + * @return the Line object itself. + */ + public Line withBoundingBox(List boundingBox) { + this.boundingBox = boundingBox; + return this; + } + + /** + * Get the text content of the line. + * + * @return the text value + */ + public String text() { + return this.text; + } + + /** + * Set the text content of the line. + * + * @param text the text value to set + * @return the Line object itself. + */ + public Line withText(String text) { + this.text = text; + return this; + } + + /** + * Get list of words in the text line. + * + * @return the words value + */ + public List words() { + return this.words; + } + + /** + * Set list of words in the text line. + * + * @param words the words value to set + * @return the Line object itself. + */ + public Line withWords(List words) { + this.words = words; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ModelResult.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ModelResult.java new file mode 100644 index 0000000000000..6ecd6ec5736be --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ModelResult.java @@ -0,0 +1,124 @@ +/** + * 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.formrecognizer.models; + +import java.util.UUID; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of a model status query operation. + */ +public class ModelResult { + /** + * Get or set model identifier. + */ + @JsonProperty(value = "modelId") + private UUID modelId; + + /** + * Get or set the status of model. Possible values include: 'created', + * 'ready', 'invalid'. + */ + @JsonProperty(value = "status") + private String status; + + /** + * Get or set the created date time of the model. + */ + @JsonProperty(value = "createdDateTime") + private DateTime createdDateTime; + + /** + * Get or set the model last updated datetime. + */ + @JsonProperty(value = "lastUpdatedDateTime") + private DateTime lastUpdatedDateTime; + + /** + * Get get or set model identifier. + * + * @return the modelId value + */ + public UUID modelId() { + return this.modelId; + } + + /** + * Set get or set model identifier. + * + * @param modelId the modelId value to set + * @return the ModelResult object itself. + */ + public ModelResult withModelId(UUID modelId) { + this.modelId = modelId; + return this; + } + + /** + * Get get or set the status of model. Possible values include: 'created', 'ready', 'invalid'. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set get or set the status of model. Possible values include: 'created', 'ready', 'invalid'. + * + * @param status the status value to set + * @return the ModelResult object itself. + */ + public ModelResult withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get get or set the created date time of the model. + * + * @return the createdDateTime value + */ + public DateTime createdDateTime() { + return this.createdDateTime; + } + + /** + * Set get or set the created date time of the model. + * + * @param createdDateTime the createdDateTime value to set + * @return the ModelResult object itself. + */ + public ModelResult withCreatedDateTime(DateTime createdDateTime) { + this.createdDateTime = createdDateTime; + return this; + } + + /** + * Get get or set the model last updated datetime. + * + * @return the lastUpdatedDateTime value + */ + public DateTime lastUpdatedDateTime() { + return this.lastUpdatedDateTime; + } + + /** + * Set get or set the model last updated datetime. + * + * @param lastUpdatedDateTime the lastUpdatedDateTime value to set + * @return the ModelResult object itself. + */ + public ModelResult withLastUpdatedDateTime(DateTime lastUpdatedDateTime) { + this.lastUpdatedDateTime = lastUpdatedDateTime; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ModelsResult.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ModelsResult.java new file mode 100644 index 0000000000000..73a94bfa8d1f7 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ModelsResult.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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of query operation to fetch multiple models. + */ +public class ModelsResult { + /** + * Collection of models. + */ + @JsonProperty(value = "models") + private List modelsProperty; + + /** + * Get collection of models. + * + * @return the modelsProperty value + */ + public List modelsProperty() { + return this.modelsProperty; + } + + /** + * Set collection of models. + * + * @param modelsProperty the modelsProperty value to set + * @return the ModelsResult object itself. + */ + public ModelsResult withModelsProperty(List modelsProperty) { + this.modelsProperty = modelsProperty; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/NumberValue.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/NumberValue.java new file mode 100644 index 0000000000000..227f61f18bcdf --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/NumberValue.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Recognized numeric field value. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "valueType") +@JsonTypeName("numberValue") +public class NumberValue extends FieldValue { + /** + * Numeric value of the recognized field. + */ + @JsonProperty(value = "value") + private Double value; + + /** + * Get numeric value of the recognized field. + * + * @return the value value + */ + public Double value() { + return this.value; + } + + /** + * Set numeric value of the recognized field. + * + * @param value the value value to set + * @return the NumberValue object itself. + */ + public NumberValue withValue(Double value) { + this.value = value; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ReadReceiptResult.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ReadReceiptResult.java new file mode 100644 index 0000000000000..699ee5ba50412 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/ReadReceiptResult.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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Analysis result of the 'Batch Read Receipt' operation. + */ +public class ReadReceiptResult { + /** + * Status of the read operation. Possible values include: 'Not Started', + * 'Running', 'Failed', 'Succeeded'. + */ + @JsonProperty(value = "status") + private TextOperationStatusCodes status; + + /** + * Text recognition result of the 'Batch Read Receipt' operation. + */ + @JsonProperty(value = "recognitionResults") + private List recognitionResults; + + /** + * Semantic understanding result of the 'Batch Read Receipt' operation. + */ + @JsonProperty(value = "understandingResults") + private List understandingResults; + + /** + * Get status of the read operation. Possible values include: 'Not Started', 'Running', 'Failed', 'Succeeded'. + * + * @return the status value + */ + public TextOperationStatusCodes status() { + return this.status; + } + + /** + * Set status of the read operation. Possible values include: 'Not Started', 'Running', 'Failed', 'Succeeded'. + * + * @param status the status value to set + * @return the ReadReceiptResult object itself. + */ + public ReadReceiptResult withStatus(TextOperationStatusCodes status) { + this.status = status; + return this; + } + + /** + * Get text recognition result of the 'Batch Read Receipt' operation. + * + * @return the recognitionResults value + */ + public List recognitionResults() { + return this.recognitionResults; + } + + /** + * Set text recognition result of the 'Batch Read Receipt' operation. + * + * @param recognitionResults the recognitionResults value to set + * @return the ReadReceiptResult object itself. + */ + public ReadReceiptResult withRecognitionResults(List recognitionResults) { + this.recognitionResults = recognitionResults; + return this; + } + + /** + * Get semantic understanding result of the 'Batch Read Receipt' operation. + * + * @return the understandingResults value + */ + public List understandingResults() { + return this.understandingResults; + } + + /** + * Set semantic understanding result of the 'Batch Read Receipt' operation. + * + * @param understandingResults the understandingResults value to set + * @return the ReadReceiptResult object itself. + */ + public ReadReceiptResult withUnderstandingResults(List understandingResults) { + this.understandingResults = understandingResults; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/StringValue.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/StringValue.java new file mode 100644 index 0000000000000..7df9aa5a27a82 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/StringValue.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Recognized string field value. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "valueType") +@JsonTypeName("stringValue") +public class StringValue extends FieldValue { + /** + * String value of the recognized field. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get string value of the recognized field. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set string value of the recognized field. + * + * @param value the value value to set + * @return the StringValue object itself. + */ + public StringValue withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextOperationStatusCodes.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextOperationStatusCodes.java new file mode 100644 index 0000000000000..4dcc1c7006a36 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextOperationStatusCodes.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TextOperationStatusCodes. + */ +public enum TextOperationStatusCodes { + /** Enum value Not Started. */ + NOT_STARTED("Not Started"), + + /** Enum value Running. */ + RUNNING("Running"), + + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"); + + /** The actual serialized value for a TextOperationStatusCodes instance. */ + private String value; + + TextOperationStatusCodes(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TextOperationStatusCodes instance. + * + * @param value the serialized value to parse. + * @return the parsed TextOperationStatusCodes object, or null if unable to parse. + */ + @JsonCreator + public static TextOperationStatusCodes fromString(String value) { + TextOperationStatusCodes[] items = TextOperationStatusCodes.values(); + for (TextOperationStatusCodes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextRecognitionResult.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextRecognitionResult.java new file mode 100644 index 0000000000000..e422044a25aff --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextRecognitionResult.java @@ -0,0 +1,177 @@ +/** + * 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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object representing a recognized text region. + */ +public class TextRecognitionResult { + /** + * The 1-based page number of the recognition result. + */ + @JsonProperty(value = "page") + private Integer page; + + /** + * The orientation of the image in degrees in the clockwise direction. + * Range between [0, 360). + */ + @JsonProperty(value = "clockwiseOrientation") + private Double clockwiseOrientation; + + /** + * The width of the image in pixels or the PDF in inches. + */ + @JsonProperty(value = "width") + private Double width; + + /** + * The height of the image in pixels or the PDF in inches. + */ + @JsonProperty(value = "height") + private Double height; + + /** + * The unit used in the Width, Height and BoundingBox. For images, the unit + * is 'pixel'. For PDF, the unit is 'inch'. Possible values include: + * 'pixel', 'inch'. + */ + @JsonProperty(value = "unit") + private TextRecognitionResultDimensionUnit unit; + + /** + * A list of recognized text lines. + */ + @JsonProperty(value = "lines", required = true) + private List lines; + + /** + * Get the 1-based page number of the recognition result. + * + * @return the page value + */ + public Integer page() { + return this.page; + } + + /** + * Set the 1-based page number of the recognition result. + * + * @param page the page value to set + * @return the TextRecognitionResult object itself. + */ + public TextRecognitionResult withPage(Integer page) { + this.page = page; + return this; + } + + /** + * Get the orientation of the image in degrees in the clockwise direction. Range between [0, 360). + * + * @return the clockwiseOrientation value + */ + public Double clockwiseOrientation() { + return this.clockwiseOrientation; + } + + /** + * Set the orientation of the image in degrees in the clockwise direction. Range between [0, 360). + * + * @param clockwiseOrientation the clockwiseOrientation value to set + * @return the TextRecognitionResult object itself. + */ + public TextRecognitionResult withClockwiseOrientation(Double clockwiseOrientation) { + this.clockwiseOrientation = clockwiseOrientation; + return this; + } + + /** + * Get the width of the image in pixels or the PDF in inches. + * + * @return the width value + */ + public Double width() { + return this.width; + } + + /** + * Set the width of the image in pixels or the PDF in inches. + * + * @param width the width value to set + * @return the TextRecognitionResult object itself. + */ + public TextRecognitionResult withWidth(Double width) { + this.width = width; + return this; + } + + /** + * Get the height of the image in pixels or the PDF in inches. + * + * @return the height value + */ + public Double height() { + return this.height; + } + + /** + * Set the height of the image in pixels or the PDF in inches. + * + * @param height the height value to set + * @return the TextRecognitionResult object itself. + */ + public TextRecognitionResult withHeight(Double height) { + this.height = height; + return this; + } + + /** + * Get the unit used in the Width, Height and BoundingBox. For images, the unit is 'pixel'. For PDF, the unit is 'inch'. Possible values include: 'pixel', 'inch'. + * + * @return the unit value + */ + public TextRecognitionResultDimensionUnit unit() { + return this.unit; + } + + /** + * Set the unit used in the Width, Height and BoundingBox. For images, the unit is 'pixel'. For PDF, the unit is 'inch'. Possible values include: 'pixel', 'inch'. + * + * @param unit the unit value to set + * @return the TextRecognitionResult object itself. + */ + public TextRecognitionResult withUnit(TextRecognitionResultDimensionUnit unit) { + this.unit = unit; + return this; + } + + /** + * Get a list of recognized text lines. + * + * @return the lines value + */ + public List lines() { + return this.lines; + } + + /** + * Set a list of recognized text lines. + * + * @param lines the lines value to set + * @return the TextRecognitionResult object itself. + */ + public TextRecognitionResult withLines(List lines) { + this.lines = lines; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextRecognitionResultConfidenceClass.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextRecognitionResultConfidenceClass.java new file mode 100644 index 0000000000000..4440e6fb9b572 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextRecognitionResultConfidenceClass.java @@ -0,0 +1,53 @@ +/** + * 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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TextRecognitionResultConfidenceClass. + */ +public enum TextRecognitionResultConfidenceClass { + /** Enum value High. */ + HIGH("High"), + + /** Enum value Low. */ + LOW("Low"); + + /** The actual serialized value for a TextRecognitionResultConfidenceClass instance. */ + private String value; + + TextRecognitionResultConfidenceClass(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TextRecognitionResultConfidenceClass instance. + * + * @param value the serialized value to parse. + * @return the parsed TextRecognitionResultConfidenceClass object, or null if unable to parse. + */ + @JsonCreator + public static TextRecognitionResultConfidenceClass fromString(String value) { + TextRecognitionResultConfidenceClass[] items = TextRecognitionResultConfidenceClass.values(); + for (TextRecognitionResultConfidenceClass item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextRecognitionResultDimensionUnit.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextRecognitionResultDimensionUnit.java new file mode 100644 index 0000000000000..37384647ed0ce --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TextRecognitionResultDimensionUnit.java @@ -0,0 +1,53 @@ +/** + * 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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TextRecognitionResultDimensionUnit. + */ +public enum TextRecognitionResultDimensionUnit { + /** Enum value pixel. */ + PIXEL("pixel"), + + /** Enum value inch. */ + INCH("inch"); + + /** The actual serialized value for a TextRecognitionResultDimensionUnit instance. */ + private String value; + + TextRecognitionResultDimensionUnit(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TextRecognitionResultDimensionUnit instance. + * + * @param value the serialized value to parse. + * @return the parsed TextRecognitionResultDimensionUnit object, or null if unable to parse. + */ + @JsonCreator + public static TextRecognitionResultDimensionUnit fromString(String value) { + TextRecognitionResultDimensionUnit[] items = TextRecognitionResultDimensionUnit.values(); + for (TextRecognitionResultDimensionUnit item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TrainRequest.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TrainRequest.java new file mode 100644 index 0000000000000..f66315d297b36 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TrainRequest.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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contract to initiate a train request. + */ +public class TrainRequest { + /** + * Get or set source path. + */ + @JsonProperty(value = "source", required = true) + private String source; + + /** + * Get or set filter to further search the + * source path for content. + */ + @JsonProperty(value = "sourceFilter") + private TrainSourceFilter sourceFilter; + + /** + * Get get or set source path. + * + * @return the source value + */ + public String source() { + return this.source; + } + + /** + * Set get or set source path. + * + * @param source the source value to set + * @return the TrainRequest object itself. + */ + public TrainRequest withSource(String source) { + this.source = source; + return this; + } + + /** + * Get get or set filter to further search the + source path for content. + * + * @return the sourceFilter value + */ + public TrainSourceFilter sourceFilter() { + return this.sourceFilter; + } + + /** + * Set get or set filter to further search the + source path for content. + * + * @param sourceFilter the sourceFilter value to set + * @return the TrainRequest object itself. + */ + public TrainRequest withSourceFilter(TrainSourceFilter sourceFilter) { + this.sourceFilter = sourceFilter; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TrainResult.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TrainResult.java new file mode 100644 index 0000000000000..109c8b4300326 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TrainResult.java @@ -0,0 +1,100 @@ +/** + * 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.formrecognizer.models; + +import java.util.UUID; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response of the Train API call. + */ +public class TrainResult { + /** + * Identifier of the model. + */ + @JsonProperty(value = "modelId") + private UUID modelId; + + /** + * List of documents used to train the model and the + * train operation error reported by each. + */ + @JsonProperty(value = "trainingDocuments") + private List trainingDocuments; + + /** + * Errors returned during the training operation. + */ + @JsonProperty(value = "errors") + private List errors; + + /** + * Get identifier of the model. + * + * @return the modelId value + */ + public UUID modelId() { + return this.modelId; + } + + /** + * Set identifier of the model. + * + * @param modelId the modelId value to set + * @return the TrainResult object itself. + */ + public TrainResult withModelId(UUID modelId) { + this.modelId = modelId; + return this; + } + + /** + * Get list of documents used to train the model and the + train operation error reported by each. + * + * @return the trainingDocuments value + */ + public List trainingDocuments() { + return this.trainingDocuments; + } + + /** + * Set list of documents used to train the model and the + train operation error reported by each. + * + * @param trainingDocuments the trainingDocuments value to set + * @return the TrainResult object itself. + */ + public TrainResult withTrainingDocuments(List trainingDocuments) { + this.trainingDocuments = trainingDocuments; + return this; + } + + /** + * Get errors returned during the training operation. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + + /** + * Set errors returned during the training operation. + * + * @param errors the errors value to set + * @return the TrainResult object itself. + */ + public TrainResult withErrors(List errors) { + this.errors = errors; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TrainSourceFilter.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TrainSourceFilter.java new file mode 100644 index 0000000000000..47d7367003d8c --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/TrainSourceFilter.java @@ -0,0 +1,81 @@ +/** + * 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.formrecognizer.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Filters to be applied when traversing a data source. + */ +public class TrainSourceFilter { + /** + * A case-sensitive prefix string to filter content + * under the source location. For e.g., when using a Azure Blob + * Uri use the prefix to restrict subfolders for content. + */ + @JsonProperty(value = "prefix") + private String prefix; + + /** + * A flag to indicate if sub folders within the set of + * prefix folders will also need to be included when searching + * for content to be preprocessed. + */ + @JsonProperty(value = "includeSubFolders") + private Boolean includeSubFolders; + + /** + * Get a case-sensitive prefix string to filter content + under the source location. For e.g., when using a Azure Blob + Uri use the prefix to restrict subfolders for content. + * + * @return the prefix value + */ + public String prefix() { + return this.prefix; + } + + /** + * Set a case-sensitive prefix string to filter content + under the source location. For e.g., when using a Azure Blob + Uri use the prefix to restrict subfolders for content. + * + * @param prefix the prefix value to set + * @return the TrainSourceFilter object itself. + */ + public TrainSourceFilter withPrefix(String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Get a flag to indicate if sub folders within the set of + prefix folders will also need to be included when searching + for content to be preprocessed. + * + * @return the includeSubFolders value + */ + public Boolean includeSubFolders() { + return this.includeSubFolders; + } + + /** + * Set a flag to indicate if sub folders within the set of + prefix folders will also need to be included when searching + for content to be preprocessed. + * + * @param includeSubFolders the includeSubFolders value to set + * @return the TrainSourceFilter object itself. + */ + public TrainSourceFilter withIncludeSubFolders(Boolean includeSubFolders) { + this.includeSubFolders = includeSubFolders; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/UnderstandingResult.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/UnderstandingResult.java new file mode 100644 index 0000000000000..765f88305870f --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/UnderstandingResult.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.formrecognizer.models; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A set of extracted fields corresponding to a semantic object, such as a + * receipt, in the input document. + */ +public class UnderstandingResult { + /** + * List of pages where the document is found. + */ + @JsonProperty(value = "pages") + private List pages; + + /** + * Dictionary of recognized field values. + */ + @JsonProperty(value = "fields") + private Map fields; + + /** + * Get list of pages where the document is found. + * + * @return the pages value + */ + public List pages() { + return this.pages; + } + + /** + * Set list of pages where the document is found. + * + * @param pages the pages value to set + * @return the UnderstandingResult object itself. + */ + public UnderstandingResult withPages(List pages) { + this.pages = pages; + return this; + } + + /** + * Get dictionary of recognized field values. + * + * @return the fields value + */ + public Map fields() { + return this.fields; + } + + /** + * Set dictionary of recognized field values. + * + * @param fields the fields value to set + * @return the UnderstandingResult object itself. + */ + public UnderstandingResult withFields(Map fields) { + this.fields = fields; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/Word.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/Word.java new file mode 100644 index 0000000000000..e25c98d3709ee --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/Word.java @@ -0,0 +1,96 @@ +/** + * 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.formrecognizer.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object representing a recognized word. + */ +public class Word { + /** + * Bounding box of a recognized word. + */ + @JsonProperty(value = "boundingBox", required = true) + private List boundingBox; + + /** + * The text content of the word. + */ + @JsonProperty(value = "text", required = true) + private String text; + + /** + * Qualitative confidence measure. Possible values include: 'High', 'Low'. + */ + @JsonProperty(value = "confidence") + private TextRecognitionResultConfidenceClass confidence; + + /** + * Get bounding box of a recognized word. + * + * @return the boundingBox value + */ + public List boundingBox() { + return this.boundingBox; + } + + /** + * Set bounding box of a recognized word. + * + * @param boundingBox the boundingBox value to set + * @return the Word object itself. + */ + public Word withBoundingBox(List boundingBox) { + this.boundingBox = boundingBox; + return this; + } + + /** + * Get the text content of the word. + * + * @return the text value + */ + public String text() { + return this.text; + } + + /** + * Set the text content of the word. + * + * @param text the text value to set + * @return the Word object itself. + */ + public Word withText(String text) { + this.text = text; + return this; + } + + /** + * Get qualitative confidence measure. Possible values include: 'High', 'Low'. + * + * @return the confidence value + */ + public TextRecognitionResultConfidenceClass confidence() { + return this.confidence; + } + + /** + * Set qualitative confidence measure. Possible values include: 'High', 'Low'. + * + * @param confidence the confidence value to set + * @return the Word object itself. + */ + public Word withConfidence(TextRecognitionResultConfidenceClass confidence) { + this.confidence = confidence; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/package-info.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/package-info.java new file mode 100644 index 0000000000000..e94ead383a6fb --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/models/package-info.java @@ -0,0 +1,10 @@ +// 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 FormRecognizerClient. + */ +package com.microsoft.azure.cognitiveservices.formrecognizer.models; diff --git a/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/package-info.java b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/package-info.java new file mode 100644 index 0000000000000..ef76b823ae000 --- /dev/null +++ b/cognitiveservices/data-plane/vision/formrecognizer/src/main/java/com/microsoft/azure/cognitiveservices/formrecognizer/package-info.java @@ -0,0 +1,10 @@ +// 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 FormRecognizerClient. + */ +package com.microsoft.azure.cognitiveservices.formrecognizer; diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/pom.xml b/cognitiveservices/resource-manager/v2016_02_01_preview/pom.xml index aa793759b74e9..28a8028a50c62 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/pom.xml +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/pom.xml @@ -7,19 +7,19 @@ --> 4.0.0 - com.microsoft.azure.azure-mgmt-cognitiveservices-2016-02-01-preview + com.microsoft.azure.cognitiveservices.v2016_02_01_preview com.microsoft.azure azure-arm-parent - 1.1.0 - ../../../pom.management.xml + 0.0.3-beta + ../../../pom.xml azure-mgmt-cognitiveservices - 1.0.0-beta-SNAPSHOT + 1.0.0-beta jar Microsoft Azure SDK for CognitiveServices Management This package contains Microsoft CognitiveServices Management SDK. - https://github.com/Azure/azure-libraries-for-java + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccount.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccount.java index 3aae651135f3c..df146dbf9891c 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccount.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccount.java @@ -10,14 +10,15 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasResourceGroup; import com.microsoft.azure.arm.model.Refreshable; import com.microsoft.azure.arm.model.Updatable; import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; -import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.cognitiveservices.v2016_02_01_preview.implementation.CognitiveServicesManager; +import java.util.Map; import com.microsoft.azure.management.cognitiveservices.v2016_02_01_preview.implementation.CognitiveServicesAccountInner; /** @@ -77,7 +78,9 @@ interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup, Resource.Defin /** * The template for a CognitiveServicesAccount update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithSku, UpdateStages.WithTags { } /** * Grouping of CognitiveServicesAccount update stages. */ interface UpdateStages { + /** + * The stage of the cognitiveservicesaccount update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku the sku parameter value + * @return the next update stage + */ + Update withSku(Sku sku); + } + + /** + * The stage of the cognitiveservicesaccount update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters + * @return the next update stage + */ + Update withTags(Map tags); + } + } } diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccountCreateParameters.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccountCreateParameters.java index d20ce32cd4bf6..da53e191819fb 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccountCreateParameters.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccountCreateParameters.java @@ -79,7 +79,7 @@ public CognitiveServicesAccountCreateParameters withSku(Sku sku) { } /** - * Get the kind value. + * Get required. Indicates the type of cognitive service account. Possible values include: 'Academic', 'Bing.Autosuggest', 'Bing.Search', 'Bing.Speech', 'Bing.SpellCheck', 'ComputerVision', 'ContentModerator', 'Emotion', 'Face', 'LUIS', 'Recommendations', 'SpeakerRecognition', 'Speech', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM'. * * @return the kind value */ @@ -88,7 +88,7 @@ public Kind kind() { } /** - * Set the kind value. + * Set required. Indicates the type of cognitive service account. Possible values include: 'Academic', 'Bing.Autosuggest', 'Bing.Search', 'Bing.Speech', 'Bing.SpellCheck', 'ComputerVision', 'ContentModerator', 'Emotion', 'Face', 'LUIS', 'Recommendations', 'SpeakerRecognition', 'Speech', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM'. * * @param kind the kind value to set * @return the CognitiveServicesAccountCreateParameters object itself. @@ -99,7 +99,7 @@ public CognitiveServicesAccountCreateParameters withKind(Kind kind) { } /** - * Get the location value. + * Get required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update the request will succeed. * * @return the location value */ @@ -108,7 +108,7 @@ public String location() { } /** - * Set the location value. + * Set required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update the request will succeed. * * @param location the location value to set * @return the CognitiveServicesAccountCreateParameters object itself. @@ -119,7 +119,7 @@ public CognitiveServicesAccountCreateParameters withLocation(String location) { } /** - * Get the tags value. + * Get gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. * * @return the tags value */ @@ -128,7 +128,7 @@ public Map tags() { } /** - * Set the tags value. + * Set gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. * * @param tags the tags value to set * @return the CognitiveServicesAccountCreateParameters object itself. @@ -139,7 +139,7 @@ public CognitiveServicesAccountCreateParameters withTags(Map tag } /** - * Get the properties value. + * Get must exist in the request. Must not be null. * * @return the properties value */ @@ -148,7 +148,7 @@ public Object properties() { } /** - * Set the properties value. + * Set must exist in the request. Must not be null. * * @param properties the properties value to set * @return the CognitiveServicesAccountCreateParameters object itself. diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccountUpdateParameters.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccountUpdateParameters.java index 436d7281a53b9..da50a104060f4 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccountUpdateParameters.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccountUpdateParameters.java @@ -52,7 +52,7 @@ public CognitiveServicesAccountUpdateParameters withSku(Sku sku) { } /** - * Get the tags value. + * Get gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. * * @return the tags value */ @@ -61,7 +61,7 @@ public Map tags() { } /** - * Set the tags value. + * Set gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. * * @param tags the tags value to set * @return the CognitiveServicesAccountUpdateParameters object itself. diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccounts.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccounts.java index a9bd74564e7dd..51c9674310571 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccounts.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesAccounts.java @@ -16,6 +16,11 @@ * Type representing CognitiveServicesAccounts. */ public interface CognitiveServicesAccounts { + /** + * Begins definition for a new Account resource. + * @param name resource name. + * @return the first stage of the new Account definition. + */ CognitiveServicesAccount.DefinitionStages.Blank defineAccount(String name); /** @@ -59,7 +64,7 @@ public interface CognitiveServicesAccounts { * Lists the account keys for the specified Cognitive Services account. * * @param resourceGroupName The name of the resource group within the user's subscription. - * @param accountName The name of the cognitive services account within the specified resource group. Congitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param accountName The name of the cognitive services account within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesResourceAndSku.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesResourceAndSku.java index 7a9fa20806604..3cbacce9ff43e 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesResourceAndSku.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/CognitiveServicesResourceAndSku.java @@ -27,7 +27,7 @@ public class CognitiveServicesResourceAndSku { private Sku sku; /** - * Get the resourceType value. + * Get resource Namespace and Type. * * @return the resourceType value */ @@ -36,7 +36,7 @@ public String resourceType() { } /** - * Set the resourceType value. + * Set resource Namespace and Type. * * @param resourceType the resourceType value to set * @return the CognitiveServicesResourceAndSku object itself. diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/ErrorBody.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/ErrorBody.java index be37d00ea466b..077d930350d70 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/ErrorBody.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/ErrorBody.java @@ -27,7 +27,7 @@ public class ErrorBody { private String message; /** - * Get the code value. + * Get error code. * * @return the code value */ @@ -36,7 +36,7 @@ public String code() { } /** - * Set the code value. + * Set error code. * * @param code the code value to set * @return the ErrorBody object itself. @@ -47,7 +47,7 @@ public ErrorBody withCode(String code) { } /** - * Get the message value. + * Get error message. * * @return the message value */ @@ -56,7 +56,7 @@ public String message() { } /** - * Set the message value. + * Set error message. * * @param message the message value to set * @return the ErrorBody object itself. diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/RegenerateKeyParameters.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/RegenerateKeyParameters.java index 565f318c28a2e..e1e4e5a4a7d0e 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/RegenerateKeyParameters.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/RegenerateKeyParameters.java @@ -22,7 +22,7 @@ public class RegenerateKeyParameters { private KeyName keyName; /** - * Get the keyName value. + * Get key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2'. * * @return the keyName value */ @@ -31,7 +31,7 @@ public KeyName keyName() { } /** - * Set the keyName value. + * Set key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2'. * * @param keyName the keyName value to set * @return the RegenerateKeyParameters object itself. diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/Sku.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/Sku.java index ea67223475e30..f57a04e257283 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/Sku.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/Sku.java @@ -30,7 +30,7 @@ public class Sku { private SkuTier tier; /** - * Get the name value. + * Get gets or sets the sku name. Required for account creation, optional for update. Possible values include: 'F0', 'P0', 'P1', 'P2', 'S0', 'S1', 'S2', 'S3', 'S4', 'S5', 'S6'. * * @return the name value */ @@ -39,7 +39,7 @@ public SkuName name() { } /** - * Set the name value. + * Set gets or sets the sku name. Required for account creation, optional for update. Possible values include: 'F0', 'P0', 'P1', 'P2', 'S0', 'S1', 'S2', 'S3', 'S4', 'S5', 'S6'. * * @param name the name value to set * @return the Sku object itself. @@ -50,7 +50,7 @@ public Sku withName(SkuName name) { } /** - * Get the tier value. + * Get gets the sku tier. This is based on the SKU name. Possible values include: 'Free', 'Standard', 'Premium'. * * @return the tier value */ diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountEnumerateSkusResultInner.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountEnumerateSkusResultInner.java index 9cf0351b4e40d..525a6e54eeccd 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountEnumerateSkusResultInner.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountEnumerateSkusResultInner.java @@ -23,7 +23,7 @@ public class CognitiveServicesAccountEnumerateSkusResultInner { private List value; /** - * Get the value value. + * Get gets the list of Cognitive Services accounts and their properties. * * @return the value value */ diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountImpl.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountImpl.java index 0889608f52977..677c972aa20ef 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountImpl.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountImpl.java @@ -11,16 +11,20 @@ import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; import com.microsoft.azure.management.cognitiveservices.v2016_02_01_preview.CognitiveServicesAccount; import rx.Observable; +import com.microsoft.azure.management.cognitiveservices.v2016_02_01_preview.Sku; +import java.util.Map; import com.microsoft.azure.management.cognitiveservices.v2016_02_01_preview.CognitiveServicesAccountCreateParameters; import com.microsoft.azure.management.cognitiveservices.v2016_02_01_preview.ProvisioningState; -import com.microsoft.azure.management.cognitiveservices.v2016_02_01_preview.Sku; import com.microsoft.azure.management.cognitiveservices.v2016_02_01_preview.Kind; import rx.functions.Func1; class CognitiveServicesAccountImpl extends GroupableResourceCoreImpl implements CognitiveServicesAccount, CognitiveServicesAccount.Definition, CognitiveServicesAccount.Update { + private Sku usku; + private Map utags; private CognitiveServicesAccountCreateParameters createParameter; CognitiveServicesAccountImpl(String name, CognitiveServicesAccountInner inner, CognitiveServicesManager manager) { super(name, inner, manager); + this.usku = new Sku(); this.createParameter = new CognitiveServicesAccountCreateParameters(); } @@ -43,7 +47,7 @@ public CognitiveServicesAccountInner call(CognitiveServicesAccountInner resource @Override public Observable updateResourceAsync() { CognitiveServicesAccountsInner client = this.manager().inner().cognitiveServicesAccounts(); - return client.updateAsync(this.resourceGroupName(), this.name()) + return client.updateAsync(this.resourceGroupName(), this.name(), this.usku, this.utags) .map(new Func1() { @Override public CognitiveServicesAccountInner call(CognitiveServicesAccountInner resource) { @@ -66,6 +70,7 @@ public boolean isInCreateMode() { } private void resetCreateUpdateParameters() { + this.usku = new Sku(); this.createParameter = new CognitiveServicesAccountCreateParameters(); } @@ -106,9 +111,19 @@ public CognitiveServicesAccountImpl withProperties(Object properties) { return this; } + @Override + public CognitiveServicesAccountImpl withTags(Map tags) { + this.utags = tags; + return this; + } + @Override public CognitiveServicesAccountImpl withSku(Sku sku) { - this.createParameter.withSku(sku); + if (isInCreateMode()) { + this.createParameter.withSku(sku); + } else { + this.usku = sku; + } return this; } diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountInner.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountInner.java index 23d2c7b850427..be9b50229fdb4 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountInner.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountInner.java @@ -53,7 +53,7 @@ public class CognitiveServicesAccountInner extends Resource { private Sku sku; /** - * Get the etag value. + * Get entity Tag. * * @return the etag value */ @@ -62,7 +62,7 @@ public String etag() { } /** - * Set the etag value. + * Set entity Tag. * * @param etag the etag value to set * @return the CognitiveServicesAccountInner object itself. @@ -73,7 +73,7 @@ public CognitiveServicesAccountInner withEtag(String etag) { } /** - * Get the kind value. + * Get type of cognitive service account. * * @return the kind value */ @@ -82,7 +82,7 @@ public String kind() { } /** - * Set the kind value. + * Set type of cognitive service account. * * @param kind the kind value to set * @return the CognitiveServicesAccountInner object itself. @@ -93,7 +93,7 @@ public CognitiveServicesAccountInner withKind(String kind) { } /** - * Get the provisioningState value. + * Get gets the status of the cognitive services account at the time the operation was called. Possible values include: 'Creating', 'ResolvingDNS', 'Succeeded', 'Failed'. * * @return the provisioningState value */ @@ -102,7 +102,7 @@ public ProvisioningState provisioningState() { } /** - * Get the endpoint value. + * Get endpoint of the created account. * * @return the endpoint value */ @@ -111,7 +111,7 @@ public String endpoint() { } /** - * Set the endpoint value. + * Set endpoint of the created account. * * @param endpoint the endpoint value to set * @return the CognitiveServicesAccountInner object itself. diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountKeysInner.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountKeysInner.java index aaec76e3bab24..b3f633432c8b4 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountKeysInner.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountKeysInner.java @@ -27,7 +27,7 @@ public class CognitiveServicesAccountKeysInner { private String key2; /** - * Get the key1 value. + * Get gets the value of key 1. * * @return the key1 value */ @@ -36,7 +36,7 @@ public String key1() { } /** - * Set the key1 value. + * Set gets the value of key 1. * * @param key1 the key1 value to set * @return the CognitiveServicesAccountKeysInner object itself. @@ -47,7 +47,7 @@ public CognitiveServicesAccountKeysInner withKey1(String key1) { } /** - * Get the key2 value. + * Get gets the value of key 2. * * @return the key2 value */ @@ -56,7 +56,7 @@ public String key2() { } /** - * Set the key2 value. + * Set gets the value of key 2. * * @param key2 the key2 value to set * @return the CognitiveServicesAccountKeysInner object itself. diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsImpl.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsImpl.java index 3b26554097394..94bebcbf8565f 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsImpl.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsImpl.java @@ -40,7 +40,7 @@ private CognitiveServicesAccountImpl wrapAccountModel(String name) { return new CognitiveServicesAccountImpl(name, new CognitiveServicesAccountInner(), this.manager()); } - private CognitiveServicesAccountImpl wrapModel(CognitiveServicesAccountInner inner) { + private CognitiveServicesAccountImpl wrapCognitiveServicesAccountModel(CognitiveServicesAccountInner inner) { return new CognitiveServicesAccountImpl(inner.name(), inner, manager()); } @@ -54,7 +54,7 @@ public Observable getByResourceGroupAsync(String resou return this.getCognitiveServicesAccountInnerUsingCognitiveServicesAccountsInnerAsync(resourceGroupName, name).map(new Func1 () { @Override public CognitiveServicesAccount call(CognitiveServicesAccountInner inner) { - return wrapModel(inner); + return wrapCognitiveServicesAccountModel(inner); } }); } @@ -72,7 +72,7 @@ public Observable call(Page() { @Override public CognitiveServicesAccount call(CognitiveServicesAccountInner inner) { - return wrapModel(inner); + return wrapCognitiveServicesAccountModel(inner); } }); } @@ -90,7 +90,7 @@ public Observable call(Page() { @Override public CognitiveServicesAccount call(CognitiveServicesAccountInner inner) { - return wrapModel(inner); + return wrapCognitiveServicesAccountModel(inner); } }); } diff --git a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsInner.java b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsInner.java index 9d3852c459d96..e0a31cda47e8b 100644 --- a/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsInner.java +++ b/cognitiveservices/resource-manager/v2016_02_01_preview/src/main/java/com/microsoft/azure/management/cognitiveservices/v2016_02_01_preview/implementation/CognitiveServicesAccountsInner.java @@ -730,7 +730,7 @@ private ServiceResponse> listDelegate(Re * Lists the account keys for the specified Cognitive Services account. * * @param resourceGroupName The name of the resource group within the user's subscription. - * @param accountName The name of the cognitive services account within the specified resource group. Congitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param accountName The name of the cognitive services account within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -744,7 +744,7 @@ public CognitiveServicesAccountKeysInner listKeys(String resourceGroupName, Stri * Lists the account keys for the specified Cognitive Services account. * * @param resourceGroupName The name of the resource group within the user's subscription. - * @param accountName The name of the cognitive services account within the specified resource group. Congitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param accountName The name of the cognitive services account within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -757,7 +757,7 @@ public ServiceFuture listKeysAsync(String res * Lists the account keys for the specified Cognitive Services account. * * @param resourceGroupName The name of the resource group within the user's subscription. - * @param accountName The name of the cognitive services account within the specified resource group. Congitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. + * @param accountName The name of the cognitive services account within the specified resource group. Cognitive Services account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the CognitiveServicesAccountKeysInner object */ @@ -774,7 +774,7 @@ public CognitiveServicesAccountKeysInner call(ServiceResponse 4.0.0 - com.microsoft.azure.azure-mgmt-cognitiveservices-2017-04-18 + com.microsoft.azure.cognitiveservices.v2017_04_18 com.microsoft.azure azure-arm-parent - 1.1.0 - ../../../pom.management.xml + 0.0.3-beta + ../../../pom.xml azure-mgmt-cognitiveservices - 1.0.0-beta-SNAPSHOT + 1.0.0-beta jar Microsoft Azure SDK for CognitiveServices Management This package contains Microsoft CognitiveServices Management SDK. - https://github.com/Azure/azure-libraries-for-java + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckDomainAvailabilityParameter.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckDomainAvailabilityParameter.java new file mode 100644 index 0000000000000..595a8de9e3158 --- /dev/null +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckDomainAvailabilityParameter.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.management.cognitiveservices.v2017_04_18; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Check Domain availability parameter. + */ +public class CheckDomainAvailabilityParameter { + /** + * The subdomain name to use. + */ + @JsonProperty(value = "subdomainName", required = true) + private String subdomainName; + + /** + * The Type of the resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Get the subdomain name to use. + * + * @return the subdomainName value + */ + public String subdomainName() { + return this.subdomainName; + } + + /** + * Set the subdomain name to use. + * + * @param subdomainName the subdomainName value to set + * @return the CheckDomainAvailabilityParameter object itself. + */ + public CheckDomainAvailabilityParameter withSubdomainName(String subdomainName) { + this.subdomainName = subdomainName; + return this; + } + + /** + * Get the Type of the resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the Type of the resource. + * + * @param type the type value to set + * @return the CheckDomainAvailabilityParameter object itself. + */ + public CheckDomainAvailabilityParameter withType(String type) { + this.type = type; + return this; + } + +} diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilityParameter.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilityParameter.java index 0628af3df9eb4..7ba9af34d08b2 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilityParameter.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilityParameter.java @@ -19,19 +19,13 @@ public class CheckSkuAvailabilityParameter { * The SKU of the resource. */ @JsonProperty(value = "skus", required = true) - private List skus; + private List skus; /** - * The Kind of the resource. Possible values include: - * 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', - * 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', - * 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', - * 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', - * 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', - * 'TextTranslation', 'WebLM'. + * The Kind of the resource. */ @JsonProperty(value = "kind", required = true) - private Kind kind; + private String kind; /** * The Type of the resource. @@ -40,47 +34,47 @@ public class CheckSkuAvailabilityParameter { private String type; /** - * Get the skus value. + * Get the SKU of the resource. * * @return the skus value */ - public List skus() { + public List skus() { return this.skus; } /** - * Set the skus value. + * Set the SKU of the resource. * * @param skus the skus value to set * @return the CheckSkuAvailabilityParameter object itself. */ - public CheckSkuAvailabilityParameter withSkus(List skus) { + public CheckSkuAvailabilityParameter withSkus(List skus) { this.skus = skus; return this; } /** - * Get the kind value. + * Get the Kind of the resource. * * @return the kind value */ - public Kind kind() { + public String kind() { return this.kind; } /** - * Set the kind value. + * Set the Kind of the resource. * * @param kind the kind value to set * @return the CheckSkuAvailabilityParameter object itself. */ - public CheckSkuAvailabilityParameter withKind(Kind kind) { + public CheckSkuAvailabilityParameter withKind(String kind) { this.kind = kind; return this; } /** - * Get the type value. + * Get the Type of the resource. * * @return the type value */ @@ -89,7 +83,7 @@ public String type() { } /** - * Set the type value. + * Set the Type of the resource. * * @param type the type value to set * @return the CheckSkuAvailabilityParameter object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilityResult.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilityResult.java index c76772c593c35..b74879eca5852 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilityResult.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilityResult.java @@ -15,16 +15,10 @@ */ public class CheckSkuAvailabilityResult { /** - * The Kind of the resource. Possible values include: - * 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', - * 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', - * 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', - * 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', - * 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', - * 'TextTranslation', 'WebLM'. + * The Kind of the resource. */ @JsonProperty(value = "kind") - private Kind kind; + private String kind; /** * The Type of the resource. @@ -33,11 +27,10 @@ public class CheckSkuAvailabilityResult { private String type; /** - * The SKU of Cognitive Services account. Possible values include: 'F0', - * 'P0', 'P1', 'P2', 'S0', 'S1', 'S2', 'S3', 'S4', 'S5', 'S6'. + * The SKU of Cognitive Services account. */ @JsonProperty(value = "skuName") - private SkuName skuName; + private String skuName; /** * Indicates the given SKU is available or not. @@ -58,27 +51,27 @@ public class CheckSkuAvailabilityResult { private String message; /** - * Get the kind value. + * Get the Kind of the resource. * * @return the kind value */ - public Kind kind() { + public String kind() { return this.kind; } /** - * Set the kind value. + * Set the Kind of the resource. * * @param kind the kind value to set * @return the CheckSkuAvailabilityResult object itself. */ - public CheckSkuAvailabilityResult withKind(Kind kind) { + public CheckSkuAvailabilityResult withKind(String kind) { this.kind = kind; return this; } /** - * Get the type value. + * Get the Type of the resource. * * @return the type value */ @@ -87,7 +80,7 @@ public String type() { } /** - * Set the type value. + * Set the Type of the resource. * * @param type the type value to set * @return the CheckSkuAvailabilityResult object itself. @@ -98,27 +91,27 @@ public CheckSkuAvailabilityResult withType(String type) { } /** - * Get the skuName value. + * Get the SKU of Cognitive Services account. * * @return the skuName value */ - public SkuName skuName() { + public String skuName() { return this.skuName; } /** - * Set the skuName value. + * Set the SKU of Cognitive Services account. * * @param skuName the skuName value to set * @return the CheckSkuAvailabilityResult object itself. */ - public CheckSkuAvailabilityResult withSkuName(SkuName skuName) { + public CheckSkuAvailabilityResult withSkuName(String skuName) { this.skuName = skuName; return this; } /** - * Get the skuAvailable value. + * Get indicates the given SKU is available or not. * * @return the skuAvailable value */ @@ -127,7 +120,7 @@ public Boolean skuAvailable() { } /** - * Set the skuAvailable value. + * Set indicates the given SKU is available or not. * * @param skuAvailable the skuAvailable value to set * @return the CheckSkuAvailabilityResult object itself. @@ -138,7 +131,7 @@ public CheckSkuAvailabilityResult withSkuAvailable(Boolean skuAvailable) { } /** - * Get the reason value. + * Get reason why the SKU is not available. * * @return the reason value */ @@ -147,7 +140,7 @@ public String reason() { } /** - * Set the reason value. + * Set reason why the SKU is not available. * * @param reason the reason value to set * @return the CheckSkuAvailabilityResult object itself. @@ -158,7 +151,7 @@ public CheckSkuAvailabilityResult withReason(String reason) { } /** - * Get the message value. + * Get additional error message. * * @return the message value */ @@ -167,7 +160,7 @@ public String message() { } /** - * Set the message value. + * Set additional error message. * * @param message the message value to set * @return the CheckSkuAvailabilityResult object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilitys.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilitys.java index 8d2b7f45e83d1..9d86bf00bd5c9 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilitys.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CheckSkuAvailabilitys.java @@ -22,11 +22,11 @@ public interface CheckSkuAvailabilitys extends HasInner listAsync(String location, List skus, Kind kind, String type); + Observable listAsync(String location, List skus, String kind, String type); } diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccount.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccount.java index b6c4e027e9623..1848629459a54 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccount.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccount.java @@ -10,20 +10,26 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasResourceGroup; import com.microsoft.azure.arm.model.Refreshable; import com.microsoft.azure.arm.model.Updatable; import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; -import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.implementation.CognitiveServicesManager; +import java.util.Map; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.implementation.CognitiveServicesAccountInner; /** * Type representing CognitiveServicesAccount. */ public interface CognitiveServicesAccount extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the customSubDomainName value. + */ + String customSubDomainName(); + /** * @return the endpoint value. */ @@ -44,6 +50,11 @@ public interface CognitiveServicesAccount extends HasInner, Resource.Defin /** * The template for a CognitiveServicesAccount update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithSku, UpdateStages.WithTags, UpdateStages.WithProperties { } /** * Grouping of CognitiveServicesAccount update stages. */ interface UpdateStages { + /** + * The stage of the cognitiveservicesaccount update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku Gets or sets the SKU of the resource + * @return the next update stage + */ + Update withSku(Sku sku); + } + + /** + * The stage of the cognitiveservicesaccount update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the cognitiveservicesaccount update allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Additional properties for Account. Only provided fields will be updated + * @return the next update stage + */ + Update withProperties(Object properties); + } + } } diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountCreateParameters.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountCreateParameters.java index 33b0cfc9cf786..c05cac6e941de 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountCreateParameters.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountCreateParameters.java @@ -22,16 +22,10 @@ public class CognitiveServicesAccountCreateParameters { private Sku sku; /** - * Required. Gets or sets the Kind of the resource. Possible values - * include: 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', - * 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', - * 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', - * 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', - * 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', - * 'TextTranslation', 'WebLM'. + * Required. Gets or sets the Kind of the resource. */ @JsonProperty(value = "kind", required = true) - private Kind kind; + private String kind; /** * Required. Gets or sets the location of the resource. This will be one of @@ -60,7 +54,7 @@ public class CognitiveServicesAccountCreateParameters { private Object properties; /** - * Get the sku value. + * Get required. Gets or sets the SKU of the resource. * * @return the sku value */ @@ -69,7 +63,7 @@ public Sku sku() { } /** - * Set the sku value. + * Set required. Gets or sets the SKU of the resource. * * @param sku the sku value to set * @return the CognitiveServicesAccountCreateParameters object itself. @@ -80,27 +74,27 @@ public CognitiveServicesAccountCreateParameters withSku(Sku sku) { } /** - * Get the kind value. + * Get required. Gets or sets the Kind of the resource. * * @return the kind value */ - public Kind kind() { + public String kind() { return this.kind; } /** - * Set the kind value. + * Set required. Gets or sets the Kind of the resource. * * @param kind the kind value to set * @return the CognitiveServicesAccountCreateParameters object itself. */ - public CognitiveServicesAccountCreateParameters withKind(Kind kind) { + public CognitiveServicesAccountCreateParameters withKind(String kind) { this.kind = kind; return this; } /** - * Get the location value. + * Get required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update the request will succeed. * * @return the location value */ @@ -109,7 +103,7 @@ public String location() { } /** - * Set the location value. + * Set required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update the request will succeed. * * @param location the location value to set * @return the CognitiveServicesAccountCreateParameters object itself. @@ -120,7 +114,7 @@ public CognitiveServicesAccountCreateParameters withLocation(String location) { } /** - * Get the tags value. + * Get gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. * * @return the tags value */ @@ -129,7 +123,7 @@ public Map tags() { } /** - * Set the tags value. + * Set gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. * * @param tags the tags value to set * @return the CognitiveServicesAccountCreateParameters object itself. @@ -140,7 +134,7 @@ public CognitiveServicesAccountCreateParameters withTags(Map tag } /** - * Get the properties value. + * Get must exist in the request. Must be an empty object. Must not be null. * * @return the properties value */ @@ -149,7 +143,7 @@ public Object properties() { } /** - * Set the properties value. + * Set must exist in the request. Must be an empty object. Must not be null. * * @param properties the properties value to set * @return the CognitiveServicesAccountCreateParameters object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountUpdateParameters.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountUpdateParameters.java index c44814eadb855..402ab26cb9d8a 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountUpdateParameters.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountUpdateParameters.java @@ -32,7 +32,13 @@ public class CognitiveServicesAccountUpdateParameters { private Map tags; /** - * Get the sku value. + * Additional properties for Account. Only provided fields will be updated. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get gets or sets the SKU of the resource. * * @return the sku value */ @@ -41,7 +47,7 @@ public Sku sku() { } /** - * Set the sku value. + * Set gets or sets the SKU of the resource. * * @param sku the sku value to set * @return the CognitiveServicesAccountUpdateParameters object itself. @@ -52,7 +58,7 @@ public CognitiveServicesAccountUpdateParameters withSku(Sku sku) { } /** - * Get the tags value. + * Get gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. * * @return the tags value */ @@ -61,7 +67,7 @@ public Map tags() { } /** - * Set the tags value. + * Set gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. * * @param tags the tags value to set * @return the CognitiveServicesAccountUpdateParameters object itself. @@ -71,4 +77,24 @@ public CognitiveServicesAccountUpdateParameters withTags(Map tag return this; } + /** + * Get additional properties for Account. Only provided fields will be updated. + * + * @return the properties value + */ + public Object properties() { + return this.properties; + } + + /** + * Set additional properties for Account. Only provided fields will be updated. + * + * @param properties the properties value to set + * @return the CognitiveServicesAccountUpdateParameters object itself. + */ + public CognitiveServicesAccountUpdateParameters withProperties(Object properties) { + this.properties = properties; + return this; + } + } diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesResourceAndSku.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesResourceAndSku.java index 05101654d7881..fd943f93985bf 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesResourceAndSku.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesResourceAndSku.java @@ -27,7 +27,7 @@ public class CognitiveServicesResourceAndSku { private Sku sku; /** - * Get the resourceType value. + * Get resource Namespace and Type. * * @return the resourceType value */ @@ -36,7 +36,7 @@ public String resourceType() { } /** - * Set the resourceType value. + * Set resource Namespace and Type. * * @param resourceType the resourceType value to set * @return the CognitiveServicesResourceAndSku object itself. @@ -47,7 +47,7 @@ public CognitiveServicesResourceAndSku withResourceType(String resourceType) { } /** - * Get the sku value. + * Get the SKU of Cognitive Services account. * * @return the sku value */ @@ -56,7 +56,7 @@ public Sku sku() { } /** - * Set the sku value. + * Set the SKU of Cognitive Services account. * * @param sku the sku value to set * @return the CognitiveServicesResourceAndSku object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Error.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Error.java index 3de58ecec4724..18039d91afb79 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Error.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Error.java @@ -21,7 +21,7 @@ public class Error { private ErrorBody error; /** - * Get the error value. + * Get the error body. * * @return the error value */ @@ -30,7 +30,7 @@ public ErrorBody error() { } /** - * Set the error value. + * Set the error body. * * @param error the error value to set * @return the Error object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ErrorBody.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ErrorBody.java index f3272520ef0a4..4bc0931c59ff4 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ErrorBody.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ErrorBody.java @@ -27,7 +27,7 @@ public class ErrorBody { private String message; /** - * Get the code value. + * Get error code. * * @return the code value */ @@ -36,7 +36,7 @@ public String code() { } /** - * Set the code value. + * Set error code. * * @param code the code value to set * @return the ErrorBody object itself. @@ -47,7 +47,7 @@ public ErrorBody withCode(String code) { } /** - * Get the message value. + * Get error message. * * @return the message value */ @@ -56,7 +56,7 @@ public String message() { } /** - * Set the message value. + * Set error message. * * @param message the message value to set * @return the ErrorBody object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/IpRule.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/IpRule.java new file mode 100644 index 0000000000000..c9da3991a09e2 --- /dev/null +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/IpRule.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.management.cognitiveservices.v2017_04_18; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A rule governing the accessibility from a specific ip address or ip range. + */ +public class IpRule { + /** + * An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + * IP address) or '124.56.78.0/24' (all addresses that start with + * 124.56.78). + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get an IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set an IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + * + * @param value the value value to set + * @return the IpRule object itself. + */ + public IpRule withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/MetricName.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/MetricName.java index e192df37c15a5..18597d12df49d 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/MetricName.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/MetricName.java @@ -27,7 +27,7 @@ public class MetricName { private String localizedValue; /** - * Get the value value. + * Get the name of the metric. * * @return the value value */ @@ -36,7 +36,7 @@ public String value() { } /** - * Get the localizedValue value. + * Get the friendly name of the metric. * * @return the localizedValue value */ diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleAction.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleAction.java new file mode 100644 index 0000000000000..47ea682cad253 --- /dev/null +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleAction.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.management.cognitiveservices.v2017_04_18; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NetworkRuleAction. + */ +public final class NetworkRuleAction extends ExpandableStringEnum { + /** Static value Allow for NetworkRuleAction. */ + public static final NetworkRuleAction ALLOW = fromString("Allow"); + + /** Static value Deny for NetworkRuleAction. */ + public static final NetworkRuleAction DENY = fromString("Deny"); + + /** + * Creates or finds a NetworkRuleAction from its string representation. + * @param name a name to look for + * @return the corresponding NetworkRuleAction + */ + @JsonCreator + public static NetworkRuleAction fromString(String name) { + return fromString(name, NetworkRuleAction.class); + } + + /** + * @return known NetworkRuleAction values + */ + public static Collection values() { + return values(NetworkRuleAction.class); + } +} diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleBypassOptions.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleBypassOptions.java new file mode 100644 index 0000000000000..0e0cacd30b79c --- /dev/null +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleBypassOptions.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.management.cognitiveservices.v2017_04_18; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NetworkRuleBypassOptions. + */ +public final class NetworkRuleBypassOptions extends ExpandableStringEnum { + /** Static value AzureServices for NetworkRuleBypassOptions. */ + public static final NetworkRuleBypassOptions AZURE_SERVICES = fromString("AzureServices"); + + /** Static value None for NetworkRuleBypassOptions. */ + public static final NetworkRuleBypassOptions NONE = fromString("None"); + + /** + * Creates or finds a NetworkRuleBypassOptions from its string representation. + * @param name a name to look for + * @return the corresponding NetworkRuleBypassOptions + */ + @JsonCreator + public static NetworkRuleBypassOptions fromString(String name) { + return fromString(name, NetworkRuleBypassOptions.class); + } + + /** + * @return known NetworkRuleBypassOptions values + */ + public static Collection values() { + return values(NetworkRuleBypassOptions.class); + } +} diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleSet.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleSet.java new file mode 100644 index 0000000000000..389183f157227 --- /dev/null +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/NetworkRuleSet.java @@ -0,0 +1,126 @@ +/** + * 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.management.cognitiveservices.v2017_04_18; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A set of rules governing the network accessibility. + */ +public class NetworkRuleSet { + /** + * Tells what traffic can bypass network rules. This can be 'AzureServices' + * or 'None'. If not specified the default is 'AzureServices'. Possible + * values include: 'AzureServices', 'None'. + */ + @JsonProperty(value = "bypass") + private NetworkRuleBypassOptions bypass; + + /** + * The default action when no rule from ipRules and from + * virtualNetworkRules match. This is only used after the bypass property + * has been evaluated. Possible values include: 'Allow', 'Deny'. + */ + @JsonProperty(value = "defaultAction") + private NetworkRuleAction defaultAction; + + /** + * The list of IP address rules. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /** + * The list of virtual network rules. + */ + @JsonProperty(value = "virtualNetworkRules") + private List virtualNetworkRules; + + /** + * Get tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: 'AzureServices', 'None'. + * + * @return the bypass value + */ + public NetworkRuleBypassOptions bypass() { + return this.bypass; + } + + /** + * Set tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: 'AzureServices', 'None'. + * + * @param bypass the bypass value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withBypass(NetworkRuleBypassOptions bypass) { + this.bypass = bypass; + return this; + } + + /** + * Get the default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. Possible values include: 'Allow', 'Deny'. + * + * @return the defaultAction value + */ + public NetworkRuleAction defaultAction() { + return this.defaultAction; + } + + /** + * Set the default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. Possible values include: 'Allow', 'Deny'. + * + * @param defaultAction the defaultAction value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withDefaultAction(NetworkRuleAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get the list of IP address rules. + * + * @return the ipRules value + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the list of IP address rules. + * + * @param ipRules the ipRules value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the list of virtual network rules. + * + * @return the virtualNetworkRules value + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the list of virtual network rules. + * + * @param virtualNetworkRules the virtualNetworkRules value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + +} diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/OperationDisplayInfo.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/OperationDisplayInfo.java index e4cbb28b61ce7..b104a215eb992 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/OperationDisplayInfo.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/OperationDisplayInfo.java @@ -39,7 +39,7 @@ public class OperationDisplayInfo { private String resource; /** - * Get the description value. + * Get the description of the operation. * * @return the description value */ @@ -48,7 +48,7 @@ public String description() { } /** - * Set the description value. + * Set the description of the operation. * * @param description the description value to set * @return the OperationDisplayInfo object itself. @@ -59,7 +59,7 @@ public OperationDisplayInfo withDescription(String description) { } /** - * Get the operation value. + * Get the action that users can perform, based on their permission level. * * @return the operation value */ @@ -68,7 +68,7 @@ public String operation() { } /** - * Set the operation value. + * Set the action that users can perform, based on their permission level. * * @param operation the operation value to set * @return the OperationDisplayInfo object itself. @@ -79,7 +79,7 @@ public OperationDisplayInfo withOperation(String operation) { } /** - * Get the provider value. + * Get service provider: Microsoft Cognitive Services. * * @return the provider value */ @@ -88,7 +88,7 @@ public String provider() { } /** - * Set the provider value. + * Set service provider: Microsoft Cognitive Services. * * @param provider the provider value to set * @return the OperationDisplayInfo object itself. @@ -99,7 +99,7 @@ public OperationDisplayInfo withProvider(String provider) { } /** - * Get the resource value. + * Get resource on which the operation is performed. * * @return the resource value */ @@ -108,7 +108,7 @@ public String resource() { } /** - * Set the resource value. + * Set resource on which the operation is performed. * * @param resource the resource value to set * @return the OperationDisplayInfo object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/RegenerateKeyParameters.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/RegenerateKeyParameters.java index 7dfb39b092ca7..ffa01d0246464 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/RegenerateKeyParameters.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/RegenerateKeyParameters.java @@ -22,7 +22,7 @@ public class RegenerateKeyParameters { private KeyName keyName; /** - * Get the keyName value. + * Get key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2'. * * @return the keyName value */ @@ -31,7 +31,7 @@ public KeyName keyName() { } /** - * Set the keyName value. + * Set key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2'. * * @param keyName the keyName value to set * @return the RegenerateKeyParameters object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ResourceSkuRestrictionInfo.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ResourceSkuRestrictionInfo.java index d95c2df857c64..2a05b5e5b83a5 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ResourceSkuRestrictionInfo.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ResourceSkuRestrictionInfo.java @@ -28,7 +28,7 @@ public class ResourceSkuRestrictionInfo { private List zones; /** - * Get the locations value. + * Get locations where the SKU is restricted. * * @return the locations value */ @@ -37,7 +37,7 @@ public List locations() { } /** - * Get the zones value. + * Get list of availability zones where the SKU is restricted. * * @return the zones value */ diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ResourceSkuRestrictions.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ResourceSkuRestrictions.java index 5d6d556a0accf..53f55127961d5 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ResourceSkuRestrictions.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/ResourceSkuRestrictions.java @@ -42,7 +42,7 @@ public class ResourceSkuRestrictions { private ResourceSkuRestrictionsReasonCode reasonCode; /** - * Get the type value. + * Get the type of restrictions. Possible values include: 'Location', 'Zone'. * * @return the type value */ @@ -51,7 +51,7 @@ public ResourceSkuRestrictionsType type() { } /** - * Get the values value. + * Get the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. * * @return the values value */ @@ -60,7 +60,7 @@ public List values() { } /** - * Get the restrictionInfo value. + * Get the information about the restriction where the SKU cannot be used. * * @return the restrictionInfo value */ @@ -69,7 +69,7 @@ public ResourceSkuRestrictionInfo restrictionInfo() { } /** - * Get the reasonCode value. + * Get the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. * * @return the reasonCode value */ diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Sku.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Sku.java index 3a958818f8e18..e4b4b0845376c 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Sku.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Sku.java @@ -16,11 +16,10 @@ public class Sku { /** * Gets or sets the sku name. Required for account creation, optional for - * update. Possible values include: 'F0', 'P0', 'P1', 'P2', 'S0', 'S1', - * 'S2', 'S3', 'S4', 'S5', 'S6'. + * update. */ @JsonProperty(value = "name", required = true) - private SkuName name; + private String name; /** * Gets the sku tier. This is based on the SKU name. Possible values @@ -30,27 +29,27 @@ public class Sku { private SkuTier tier; /** - * Get the name value. + * Get gets or sets the sku name. Required for account creation, optional for update. * * @return the name value */ - public SkuName name() { + public String name() { return this.name; } /** - * Set the name value. + * Set gets or sets the sku name. Required for account creation, optional for update. * * @param name the name value to set * @return the Sku object itself. */ - public Sku withName(SkuName name) { + public Sku withName(String name) { this.name = name; return this; } /** - * Get the tier value. + * Get gets the sku tier. This is based on the SKU name. Possible values include: 'Free', 'Standard', 'Premium'. * * @return the tier value */ diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Usage.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Usage.java index 2b1d4cf0737e0..c9cce5e78a656 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Usage.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/Usage.java @@ -60,7 +60,7 @@ public class Usage { private QuotaUsageStatus status; /** - * Get the unit value. + * Get the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds'. * * @return the unit value */ @@ -69,7 +69,7 @@ public UnitType unit() { } /** - * Set the unit value. + * Set the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds'. * * @param unit the unit value to set * @return the Usage object itself. @@ -80,7 +80,7 @@ public Usage withUnit(UnitType unit) { } /** - * Get the name value. + * Get the name information for the metric. * * @return the name value */ @@ -89,7 +89,7 @@ public MetricName name() { } /** - * Get the quotaPeriod value. + * Get the quota period used to summarize the usage values. * * @return the quotaPeriod value */ @@ -98,7 +98,7 @@ public String quotaPeriod() { } /** - * Get the limit value. + * Get maximum value for this metric. * * @return the limit value */ @@ -107,7 +107,7 @@ public Double limit() { } /** - * Get the currentValue value. + * Get current value for this metric. * * @return the currentValue value */ @@ -116,7 +116,7 @@ public Double currentValue() { } /** - * Get the nextResetTime value. + * Get next reset time for current quota. * * @return the nextResetTime value */ @@ -125,7 +125,7 @@ public String nextResetTime() { } /** - * Get the status value. + * Get cognitive Services account quota usage status. Possible values include: 'Included', 'Blocked', 'InOverage', 'Unknown'. * * @return the status value */ @@ -134,7 +134,7 @@ public QuotaUsageStatus status() { } /** - * Set the status value. + * Set cognitive Services account quota usage status. Possible values include: 'Included', 'Blocked', 'InOverage', 'Unknown'. * * @param status the status value to set * @return the Usage object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/VirtualNetworkRule.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/VirtualNetworkRule.java new file mode 100644 index 0000000000000..124697627744b --- /dev/null +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/VirtualNetworkRule.java @@ -0,0 +1,96 @@ +/** + * 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.management.cognitiveservices.v2017_04_18; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A rule governing the accessibility from a specific virtual network. + */ +public class VirtualNetworkRule { + /** + * Full resource id of a vnet subnet, such as + * '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Gets the state of virtual network rule. + */ + @JsonProperty(value = "state") + private String state; + + /** + * Ignore missing vnet service endpoint or not. + */ + @JsonProperty(value = "ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /** + * Get full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + * + * @param id the id value to set + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withId(String id) { + this.id = id; + return this; + } + + /** + * Get gets the state of virtual network rule. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Set gets the state of virtual network rule. + * + * @param state the state value to set + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withState(String state) { + this.state = state; + return this; + } + + /** + * Get ignore missing vnet service endpoint or not. + * + * @return the ignoreMissingVnetServiceEndpoint value + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set ignore missing vnet service endpoint or not. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + +} diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsImpl.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsImpl.java index 3741d2109158b..702435a0cb806 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsImpl.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsImpl.java @@ -82,41 +82,22 @@ public PagedList listByResourceGroup(String resourceGr return this.wrapList(client.listByResourceGroup(resourceGroupName)); } - private Observable> listByResourceGroupNextInnerPageAsync(String nextLink) { - if (nextLink == null) { - Observable.empty(); - } - AccountsInner client = this.inner(); - return client.listByResourceGroupNextAsync(nextLink) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Page page) { - return Observable.just(page).concatWith(listByResourceGroupNextInnerPageAsync(page.nextPageLink())); - } - }); - } @Override public Observable listByResourceGroupAsync(String resourceGroupName) { AccountsInner client = this.inner(); return client.listByResourceGroupAsync(resourceGroupName) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Page page) { - return listByResourceGroupNextInnerPageAsync(page.nextPageLink()); - } - }) .flatMapIterable(new Func1, Iterable>() { @Override public Iterable call(Page page) { return page.items(); } - }) + }) .map(new Func1() { @Override public CognitiveServicesAccount call(CognitiveServicesAccountInner inner) { return wrapModel(inner); } - }); + }); } @Override @@ -125,41 +106,22 @@ public PagedList list() { return this.wrapList(client.list()); } - private Observable> listNextInnerPageAsync(String nextLink) { - if (nextLink == null) { - Observable.empty(); - } - AccountsInner client = this.inner(); - return client.listNextAsync(nextLink) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Page page) { - return Observable.just(page).concatWith(listNextInnerPageAsync(page.nextPageLink())); - } - }); - } @Override public Observable listAsync() { AccountsInner client = this.inner(); return client.listAsync() - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Page page) { - return listNextInnerPageAsync(page.nextPageLink()); - } - }) .flatMapIterable(new Func1, Iterable>() { @Override public Iterable call(Page page) { return page.items(); } - }) + }) .map(new Func1() { @Override public CognitiveServicesAccount call(CognitiveServicesAccountInner inner) { return wrapModel(inner); } - }); + }); } @Override diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java index 55fdcc4cd88d6..9a0de28b8aa51 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java @@ -284,9 +284,11 @@ public Observable> updateWithServ } final Sku sku = null; final Map tags = null; + final Object properties = null; CognitiveServicesAccountUpdateParameters parameters = new CognitiveServicesAccountUpdateParameters(); parameters.withSku(null); parameters.withTags(null); + parameters.withProperties(null); return service.update(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -308,13 +310,14 @@ public Observable> call(Response< * @param accountName The name of Cognitive Services account. * @param sku Gets or sets the SKU of the resource. * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. + * @param properties Additional properties for Account. Only provided fields will be updated. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the CognitiveServicesAccountInner object if successful. */ - public CognitiveServicesAccountInner update(String resourceGroupName, String accountName, Sku sku, Map tags) { - return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags).toBlocking().single().body(); + public CognitiveServicesAccountInner update(String resourceGroupName, String accountName, Sku sku, Map tags, Object properties) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags, properties).toBlocking().single().body(); } /** @@ -324,12 +327,13 @@ public CognitiveServicesAccountInner update(String resourceGroupName, String acc * @param accountName The name of Cognitive Services account. * @param sku Gets or sets the SKU of the resource. * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. + * @param properties Additional properties for Account. Only provided fields will be updated. * @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 resourceGroupName, String accountName, Sku sku, Map tags, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags), serviceCallback); + public ServiceFuture updateAsync(String resourceGroupName, String accountName, Sku sku, Map tags, Object properties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags, properties), serviceCallback); } /** @@ -339,11 +343,12 @@ public ServiceFuture updateAsync(String resourceG * @param accountName The name of Cognitive Services account. * @param sku Gets or sets the SKU of the resource. * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. + * @param properties Additional properties for Account. Only provided fields will be updated. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the CognitiveServicesAccountInner object */ - public Observable updateAsync(String resourceGroupName, String accountName, Sku sku, Map tags) { - return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags).map(new Func1, CognitiveServicesAccountInner>() { + public Observable updateAsync(String resourceGroupName, String accountName, Sku sku, Map tags, Object properties) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags, properties).map(new Func1, CognitiveServicesAccountInner>() { @Override public CognitiveServicesAccountInner call(ServiceResponse response) { return response.body(); @@ -358,10 +363,11 @@ public CognitiveServicesAccountInner call(ServiceResponse> updateWithServiceResponseAsync(String resourceGroupName, String accountName, Sku sku, Map tags) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, Sku sku, Map tags, Object properties) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -379,6 +385,7 @@ public Observable> updateWithServ CognitiveServicesAccountUpdateParameters parameters = new CognitiveServicesAccountUpdateParameters(); parameters.withSku(sku); parameters.withTags(tags); + parameters.withProperties(properties); return service.update(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckDomainAvailabilityResultInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckDomainAvailabilityResultInner.java new file mode 100644 index 0000000000000..b82eac9e8df26 --- /dev/null +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckDomainAvailabilityResultInner.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.management.cognitiveservices.v2017_04_18.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Check Domain availability result. + */ +public class CheckDomainAvailabilityResultInner { + /** + * Indicates the given SKU is available or not. + */ + @JsonProperty(value = "isSubdomainAvailable") + private Boolean isSubdomainAvailable; + + /** + * Reason why the SKU is not available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * The subdomain name to use. + */ + @JsonProperty(value = "subdomainName") + private String subdomainName; + + /** + * The Type of the resource. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get indicates the given SKU is available or not. + * + * @return the isSubdomainAvailable value + */ + public Boolean isSubdomainAvailable() { + return this.isSubdomainAvailable; + } + + /** + * Set indicates the given SKU is available or not. + * + * @param isSubdomainAvailable the isSubdomainAvailable value to set + * @return the CheckDomainAvailabilityResultInner object itself. + */ + public CheckDomainAvailabilityResultInner withIsSubdomainAvailable(Boolean isSubdomainAvailable) { + this.isSubdomainAvailable = isSubdomainAvailable; + return this; + } + + /** + * Get reason why the SKU is not available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set reason why the SKU is not available. + * + * @param reason the reason value to set + * @return the CheckDomainAvailabilityResultInner object itself. + */ + public CheckDomainAvailabilityResultInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the subdomain name to use. + * + * @return the subdomainName value + */ + public String subdomainName() { + return this.subdomainName; + } + + /** + * Set the subdomain name to use. + * + * @param subdomainName the subdomainName value to set + * @return the CheckDomainAvailabilityResultInner object itself. + */ + public CheckDomainAvailabilityResultInner withSubdomainName(String subdomainName) { + this.subdomainName = subdomainName; + return this; + } + + /** + * Get the Type of the resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the Type of the resource. + * + * @param type the type value to set + * @return the CheckDomainAvailabilityResultInner object itself. + */ + public CheckDomainAvailabilityResultInner withType(String type) { + this.type = type; + return this; + } + +} diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilityResultListInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilityResultListInner.java index 99e08ca959233..3edc75d3412ca 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilityResultListInner.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilityResultListInner.java @@ -23,7 +23,7 @@ public class CheckSkuAvailabilityResultListInner { private List value; /** - * Get the value value. + * Get check SKU availability result list. * * @return the value value */ @@ -32,7 +32,7 @@ public List value() { } /** - * Set the value value. + * Set check SKU availability result list. * * @param value the value value to set * @return the CheckSkuAvailabilityResultListInner object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilitysImpl.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilitysImpl.java index 03862ab4aa2ab..3723197c7a91b 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilitysImpl.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilitysImpl.java @@ -15,8 +15,6 @@ import rx.Observable; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CheckSkuAvailabilityResultList; import java.util.List; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.SkuName; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.Kind; class CheckSkuAvailabilitysImpl extends WrapperImpl implements CheckSkuAvailabilitys { private final CognitiveServicesManager manager; @@ -31,7 +29,7 @@ public CognitiveServicesManager manager() { } @Override - public Observable listAsync(String location, List skus, Kind kind, String type) { + public Observable listAsync(String location, List skus, String kind, String type) { CheckSkuAvailabilitysInner client = this.inner(); return client.listAsync(location, skus, kind, type) .map(new Func1() { diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilitysInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilitysInner.java index a10a21e756242..fbdbf95add867 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilitysInner.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CheckSkuAvailabilitysInner.java @@ -12,8 +12,6 @@ import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CheckSkuAvailabilityParameter; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.Kind; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.SkuName; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; @@ -68,14 +66,14 @@ interface CheckSkuAvailabilitysService { * * @param location Resource location. * @param skus The SKU of the resource. - * @param kind The Kind of the resource. Possible values include: 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM' + * @param kind The Kind of the resource. * @param type The Type of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the CheckSkuAvailabilityResultListInner object if successful. */ - public CheckSkuAvailabilityResultListInner list(String location, List skus, Kind kind, String type) { + public CheckSkuAvailabilityResultListInner list(String location, List skus, String kind, String type) { return listWithServiceResponseAsync(location, skus, kind, type).toBlocking().single().body(); } @@ -84,13 +82,13 @@ public CheckSkuAvailabilityResultListInner list(String location, List s * * @param location Resource location. * @param skus The SKU of the resource. - * @param kind The Kind of the resource. Possible values include: 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM' + * @param kind The Kind of the resource. * @param type The Type of the resource. * @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 listAsync(String location, List skus, Kind kind, String type, final ServiceCallback serviceCallback) { + public ServiceFuture listAsync(String location, List skus, String kind, String type, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(listWithServiceResponseAsync(location, skus, kind, type), serviceCallback); } @@ -99,12 +97,12 @@ public ServiceFuture listAsync(String locat * * @param location Resource location. * @param skus The SKU of the resource. - * @param kind The Kind of the resource. Possible values include: 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM' + * @param kind The Kind of the resource. * @param type The Type of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the CheckSkuAvailabilityResultListInner object */ - public Observable listAsync(String location, List skus, Kind kind, String type) { + public Observable listAsync(String location, List skus, String kind, String type) { return listWithServiceResponseAsync(location, skus, kind, type).map(new Func1, CheckSkuAvailabilityResultListInner>() { @Override public CheckSkuAvailabilityResultListInner call(ServiceResponse response) { @@ -118,12 +116,12 @@ public CheckSkuAvailabilityResultListInner call(ServiceResponse> listWithServiceResponseAsync(String location, List skus, Kind kind, String type) { + public Observable> listWithServiceResponseAsync(String location, List skus, String kind, String type) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountEnumerateSkusResultInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountEnumerateSkusResultInner.java index f1f50799a0e25..ada320f88f884 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountEnumerateSkusResultInner.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountEnumerateSkusResultInner.java @@ -23,7 +23,7 @@ public class CognitiveServicesAccountEnumerateSkusResultInner { private List value; /** - * Get the value value. + * Get gets the list of Cognitive Services accounts and their properties. * * @return the value value */ diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountImpl.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountImpl.java index 6f3578436ea2e..e4ecf0e12dcf4 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountImpl.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountImpl.java @@ -11,16 +11,21 @@ import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CognitiveServicesAccount; import rx.Observable; +import com.microsoft.azure.management.cognitiveservices.v2017_04_18.Sku; +import java.util.Map; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CognitiveServicesAccountCreateParameters; +import com.microsoft.azure.management.cognitiveservices.v2017_04_18.NetworkRuleSet; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.ProvisioningState; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.Sku; -import com.microsoft.azure.management.cognitiveservices.v2017_04_18.Kind; import rx.functions.Func1; class CognitiveServicesAccountImpl extends GroupableResourceCoreImpl implements CognitiveServicesAccount, CognitiveServicesAccount.Definition, CognitiveServicesAccount.Update { + private Sku usku; + private Map utags; + private Object uproperties; private CognitiveServicesAccountCreateParameters createParameter; CognitiveServicesAccountImpl(String name, CognitiveServicesAccountInner inner, CognitiveServicesManager manager) { super(name, inner, manager); + this.usku = new Sku(); this.createParameter = new CognitiveServicesAccountCreateParameters(); } @@ -43,7 +48,7 @@ public CognitiveServicesAccountInner call(CognitiveServicesAccountInner resource @Override public Observable updateResourceAsync() { AccountsInner client = this.manager().inner().accounts(); - return client.updateAsync(this.resourceGroupName(), this.name()) + return client.updateAsync(this.resourceGroupName(), this.name(), this.usku, this.utags, this.uproperties) .map(new Func1() { @Override public CognitiveServicesAccountInner call(CognitiveServicesAccountInner resource) { @@ -66,9 +71,15 @@ public boolean isInCreateMode() { } private void resetCreateUpdateParameters() { + this.usku = new Sku(); this.createParameter = new CognitiveServicesAccountCreateParameters(); } + @Override + public String customSubDomainName() { + return this.inner().customSubDomainName(); + } + @Override public String endpoint() { return this.inner().endpoint(); @@ -89,6 +100,11 @@ public String kind() { return this.inner().kind(); } + @Override + public NetworkRuleSet networkAcls() { + return this.inner().networkAcls(); + } + @Override public ProvisioningState provisioningState() { return this.inner().provisioningState(); @@ -100,20 +116,34 @@ public Sku sku() { } @Override - public CognitiveServicesAccountImpl withKind(Kind kind) { + public CognitiveServicesAccountImpl withKind(String kind) { this.createParameter.withKind(kind); return this; } + @Override + public CognitiveServicesAccountImpl withTags(Map tags) { + this.utags = tags; + return this; + } + @Override public CognitiveServicesAccountImpl withProperties(Object properties) { - this.createParameter.withProperties(properties); + if (isInCreateMode()) { + this.createParameter.withProperties(properties); + } else { + this.uproperties = properties; + } return this; } @Override public CognitiveServicesAccountImpl withSku(Sku sku) { - this.createParameter.withSku(sku); + if (isInCreateMode()) { + this.createParameter.withSku(sku); + } else { + this.usku = sku; + } return this; } diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountInner.java index a8e5b3a0817dc..6d5e79d9f5a6e 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountInner.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountInner.java @@ -9,6 +9,7 @@ package com.microsoft.azure.management.cognitiveservices.v2017_04_18.implementation; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.ProvisioningState; +import com.microsoft.azure.management.cognitiveservices.v2017_04_18.NetworkRuleSet; import com.microsoft.azure.management.cognitiveservices.v2017_04_18.Sku; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; @@ -52,6 +53,19 @@ public class CognitiveServicesAccountInner extends Resource { @JsonProperty(value = "properties.internalId") private String internalId; + /** + * Optional subdomain name used for token-based authentication. + */ + @JsonProperty(value = "properties.customSubDomainName") + private String customSubDomainName; + + /** + * A collection of rules governing the accessibility from specific network + * locations. + */ + @JsonProperty(value = "properties.networkAcls") + private NetworkRuleSet networkAcls; + /** * The SKU of Cognitive Services account. */ @@ -59,7 +73,7 @@ public class CognitiveServicesAccountInner extends Resource { private Sku sku; /** - * Get the etag value. + * Get entity Tag. * * @return the etag value */ @@ -68,7 +82,7 @@ public String etag() { } /** - * Set the etag value. + * Set entity Tag. * * @param etag the etag value to set * @return the CognitiveServicesAccountInner object itself. @@ -79,7 +93,7 @@ public CognitiveServicesAccountInner withEtag(String etag) { } /** - * Get the kind value. + * Get type of cognitive service account. * * @return the kind value */ @@ -88,7 +102,7 @@ public String kind() { } /** - * Set the kind value. + * Set type of cognitive service account. * * @param kind the kind value to set * @return the CognitiveServicesAccountInner object itself. @@ -99,7 +113,7 @@ public CognitiveServicesAccountInner withKind(String kind) { } /** - * Get the provisioningState value. + * Get gets the status of the cognitive services account at the time the operation was called. Possible values include: 'Creating', 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed'. * * @return the provisioningState value */ @@ -108,7 +122,7 @@ public ProvisioningState provisioningState() { } /** - * Get the endpoint value. + * Get endpoint of the created account. * * @return the endpoint value */ @@ -117,7 +131,7 @@ public String endpoint() { } /** - * Set the endpoint value. + * Set endpoint of the created account. * * @param endpoint the endpoint value to set * @return the CognitiveServicesAccountInner object itself. @@ -128,7 +142,7 @@ public CognitiveServicesAccountInner withEndpoint(String endpoint) { } /** - * Get the internalId value. + * Get the internal identifier. * * @return the internalId value */ @@ -137,7 +151,7 @@ public String internalId() { } /** - * Set the internalId value. + * Set the internal identifier. * * @param internalId the internalId value to set * @return the CognitiveServicesAccountInner object itself. @@ -148,7 +162,47 @@ public CognitiveServicesAccountInner withInternalId(String internalId) { } /** - * Get the sku value. + * Get optional subdomain name used for token-based authentication. + * + * @return the customSubDomainName value + */ + public String customSubDomainName() { + return this.customSubDomainName; + } + + /** + * Set optional subdomain name used for token-based authentication. + * + * @param customSubDomainName the customSubDomainName value to set + * @return the CognitiveServicesAccountInner object itself. + */ + public CognitiveServicesAccountInner withCustomSubDomainName(String customSubDomainName) { + this.customSubDomainName = customSubDomainName; + return this; + } + + /** + * Get a collection of rules governing the accessibility from specific network locations. + * + * @return the networkAcls value + */ + public NetworkRuleSet networkAcls() { + return this.networkAcls; + } + + /** + * Set a collection of rules governing the accessibility from specific network locations. + * + * @param networkAcls the networkAcls value to set + * @return the CognitiveServicesAccountInner object itself. + */ + public CognitiveServicesAccountInner withNetworkAcls(NetworkRuleSet networkAcls) { + this.networkAcls = networkAcls; + return this; + } + + /** + * Get the SKU of Cognitive Services account. * * @return the sku value */ @@ -157,7 +211,7 @@ public Sku sku() { } /** - * Set the sku value. + * Set the SKU of Cognitive Services account. * * @param sku the sku value to set * @return the CognitiveServicesAccountInner object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountKeysInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountKeysInner.java index 6b6d5f6d31553..3e9bc1251a093 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountKeysInner.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesAccountKeysInner.java @@ -27,7 +27,7 @@ public class CognitiveServicesAccountKeysInner { private String key2; /** - * Get the key1 value. + * Get gets the value of key 1. * * @return the key1 value */ @@ -36,7 +36,7 @@ public String key1() { } /** - * Set the key1 value. + * Set gets the value of key 1. * * @param key1 the key1 value to set * @return the CognitiveServicesAccountKeysInner object itself. @@ -47,7 +47,7 @@ public CognitiveServicesAccountKeysInner withKey1(String key1) { } /** - * Get the key2 value. + * Get gets the value of key 2. * * @return the key2 value */ @@ -56,7 +56,7 @@ public String key2() { } /** - * Set the key2 value. + * Set gets the value of key 2. * * @param key2 the key2 value to set * @return the CognitiveServicesAccountKeysInner object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManagementClientImpl.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManagementClientImpl.java index 35bb37c416591..c2d7874ae8631 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManagementClientImpl.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/CognitiveServicesManagementClientImpl.java @@ -8,15 +8,33 @@ package com.microsoft.azure.management.cognitiveservices.v2017_04_18.implementation; +import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cognitiveservices.v2017_04_18.CheckDomainAvailabilityParameter; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; /** * Initializes a new instance of the CognitiveServicesManagementClientImpl class. */ public class CognitiveServicesManagementClientImpl extends AzureServiceClient { + /** The Retrofit service to perform REST calls. */ + private CognitiveServicesManagementClientService service; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; @@ -63,11 +81,11 @@ public String apiVersion() { return this.apiVersion; } - /** Gets or sets the preferred language for the response. */ + /** The preferred language for the response. */ private String acceptLanguage; /** - * Gets Gets or sets the preferred language for the response. + * Gets The preferred language for the response. * * @return the acceptLanguage value. */ @@ -76,7 +94,7 @@ public String acceptLanguage() { } /** - * Sets Gets or sets the preferred language for the response. + * Sets The preferred language for the response. * * @param acceptLanguage the acceptLanguage value. * @return the service client itself @@ -86,11 +104,11 @@ public CognitiveServicesManagementClientImpl withAcceptLanguage(String acceptLan return this; } - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ private int longRunningOperationRetryTimeout; /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @return the longRunningOperationRetryTimeout value. */ @@ -99,7 +117,7 @@ public int longRunningOperationRetryTimeout() { } /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. * @return the service client itself @@ -109,11 +127,11 @@ public CognitiveServicesManagementClientImpl withLongRunningOperationRetryTimeou return this; } - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + /** 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 When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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. */ @@ -122,7 +140,7 @@ public boolean generateClientRequestId() { } /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * 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 @@ -224,6 +242,7 @@ protected void initialize() { this.operations = new OperationsInner(restClient().retrofit(), this); this.checkSkuAvailabilitys = new CheckSkuAvailabilitysInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); + initializeService(); } /** @@ -233,6 +252,108 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "CognitiveServicesManagementClient", "2017-04-18"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "CognitiveServicesManagementClient", "2017-04-18"); } + + private void initializeService() { + service = restClient().retrofit().create(CognitiveServicesManagementClientService.class); + } + + /** + * The interface defining all the services for CognitiveServicesManagementClient to be + * used by Retrofit to perform actually REST calls. + */ + interface CognitiveServicesManagementClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cognitiveservices.v2017_04_18.CognitiveServicesManagementClient checkDomainAvailability" }) + @POST("providers/Microsoft.CognitiveServices/checkDomainAvailability") + Observable> checkDomainAvailability(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CheckDomainAvailabilityParameter parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Check whether a domain is available. + * + * @param subdomainName The subdomain name to use. + * @param type The Type of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CheckDomainAvailabilityResultInner object if successful. + */ + public CheckDomainAvailabilityResultInner checkDomainAvailability(String subdomainName, String type) { + return checkDomainAvailabilityWithServiceResponseAsync(subdomainName, type).toBlocking().single().body(); + } + + /** + * Check whether a domain is available. + * + * @param subdomainName The subdomain name to use. + * @param type The Type of the resource. + * @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 checkDomainAvailabilityAsync(String subdomainName, String type, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkDomainAvailabilityWithServiceResponseAsync(subdomainName, type), serviceCallback); + } + + /** + * Check whether a domain is available. + * + * @param subdomainName The subdomain name to use. + * @param type The Type of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckDomainAvailabilityResultInner object + */ + public Observable checkDomainAvailabilityAsync(String subdomainName, String type) { + return checkDomainAvailabilityWithServiceResponseAsync(subdomainName, type).map(new Func1, CheckDomainAvailabilityResultInner>() { + @Override + public CheckDomainAvailabilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Check whether a domain is available. + * + * @param subdomainName The subdomain name to use. + * @param type The Type of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckDomainAvailabilityResultInner object + */ + public Observable> checkDomainAvailabilityWithServiceResponseAsync(String subdomainName, String type) { + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + if (subdomainName == null) { + throw new IllegalArgumentException("Parameter subdomainName is required and cannot be null."); + } + if (type == null) { + throw new IllegalArgumentException("Parameter type is required and cannot be null."); + } + CheckDomainAvailabilityParameter parameters = new CheckDomainAvailabilityParameter(); + parameters.withSubdomainName(subdomainName); + parameters.withType(type); + return service.checkDomainAvailability(this.apiVersion(), this.acceptLanguage(), parameters, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkDomainAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkDomainAvailabilityDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + } diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/OperationEntityInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/OperationEntityInner.java index 91702e3f4836b..86b777cac898b 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/OperationEntityInner.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/OperationEntityInner.java @@ -40,7 +40,7 @@ public class OperationEntityInner { private Object properties; /** - * Get the name value. + * Get operation name: {provider}/{resource}/{operation}. * * @return the name value */ @@ -49,7 +49,7 @@ public String name() { } /** - * Set the name value. + * Set operation name: {provider}/{resource}/{operation}. * * @param name the name value to set * @return the OperationEntityInner object itself. @@ -60,7 +60,7 @@ public OperationEntityInner withName(String name) { } /** - * Get the display value. + * Get the operation supported by Cognitive Services. * * @return the display value */ @@ -69,7 +69,7 @@ public OperationDisplayInfo display() { } /** - * Set the display value. + * Set the operation supported by Cognitive Services. * * @param display the display value to set * @return the OperationEntityInner object itself. @@ -80,7 +80,7 @@ public OperationEntityInner withDisplay(OperationDisplayInfo display) { } /** - * Get the origin value. + * Get the origin of the operation. * * @return the origin value */ @@ -89,7 +89,7 @@ public String origin() { } /** - * Set the origin value. + * Set the origin of the operation. * * @param origin the origin value to set * @return the OperationEntityInner object itself. @@ -100,7 +100,7 @@ public OperationEntityInner withOrigin(String origin) { } /** - * Get the properties value. + * Get additional properties. * * @return the properties value */ @@ -109,7 +109,7 @@ public Object properties() { } /** - * Set the properties value. + * Set additional properties. * * @param properties the properties value to set * @return the OperationEntityInner object itself. diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/OperationsImpl.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/OperationsImpl.java index f5041bdc54609..f8ee98c8195dc 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/OperationsImpl.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/OperationsImpl.java @@ -28,41 +28,22 @@ public CognitiveServicesManager manager() { return this.manager; } - private Observable> listNextInnerPageAsync(String nextLink) { - if (nextLink == null) { - Observable.empty(); - } - OperationsInner client = this.inner(); - return client.listNextAsync(nextLink) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Page page) { - return Observable.just(page).concatWith(listNextInnerPageAsync(page.nextPageLink())); - } - }); - } @Override public Observable listAsync() { OperationsInner client = this.inner(); return client.listAsync() - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Page page) { - return listNextInnerPageAsync(page.nextPageLink()); - } - }) .flatMapIterable(new Func1, Iterable>() { @Override public Iterable call(Page page) { return page.items(); } - }) + }) .map(new Func1() { @Override public OperationEntity call(OperationEntityInner inner) { return new OperationEntityImpl(inner, manager()); } - }); + }); } } diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/ResourceSkuInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/ResourceSkuInner.java index 909de81a52b00..91e1c829cf214 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/ResourceSkuInner.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/ResourceSkuInner.java @@ -54,7 +54,7 @@ public class ResourceSkuInner { private List restrictions; /** - * Get the resourceType value. + * Get the type of resource the SKU applies to. * * @return the resourceType value */ @@ -63,7 +63,7 @@ public String resourceType() { } /** - * Get the name value. + * Get the name of SKU. * * @return the name value */ @@ -72,7 +72,7 @@ public String name() { } /** - * Get the tier value. + * Get specifies the tier of Cognitive Services account. * * @return the tier value */ @@ -81,7 +81,7 @@ public String tier() { } /** - * Get the kind value. + * Get the Kind of resources that are supported in this SKU. * * @return the kind value */ @@ -90,7 +90,7 @@ public String kind() { } /** - * Get the locations value. + * Get the set of locations that the SKU is available. * * @return the locations value */ @@ -99,7 +99,7 @@ public List locations() { } /** - * Get the restrictions value. + * Get the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. * * @return the restrictions value */ diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/ResourceSkusImpl.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/ResourceSkusImpl.java index f0b7e756f3e26..7f5910f09e496 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/ResourceSkusImpl.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/ResourceSkusImpl.java @@ -28,41 +28,22 @@ public CognitiveServicesManager manager() { return this.manager; } - private Observable> listNextInnerPageAsync(String nextLink) { - if (nextLink == null) { - Observable.empty(); - } - ResourceSkusInner client = this.inner(); - return client.listNextAsync(nextLink) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Page page) { - return Observable.just(page).concatWith(listNextInnerPageAsync(page.nextPageLink())); - } - }); - } @Override public Observable listAsync() { ResourceSkusInner client = this.inner(); return client.listAsync() - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Page page) { - return listNextInnerPageAsync(page.nextPageLink()); - } - }) .flatMapIterable(new Func1, Iterable>() { @Override public Iterable call(Page page) { return page.items(); } - }) + }) .map(new Func1() { @Override public ResourceSku call(ResourceSkuInner inner) { return new ResourceSkuImpl(inner, manager()); } - }); + }); } } diff --git a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/UsagesResultInner.java b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/UsagesResultInner.java index faa532dc3b219..5eefb86d82985 100644 --- a/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/UsagesResultInner.java +++ b/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/UsagesResultInner.java @@ -23,7 +23,7 @@ public class UsagesResultInner { private List value; /** - * Get the value value. + * Get the list of usages for Cognitive Service account. * * @return the value value */