From a985e30b424d14bbc840b211f8de93f79e0c038b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 9 Feb 2021 16:59:28 +0000 Subject: [PATCH] CodeGen from PR 12896 in Azure/azure-rest-api-specs Fixes ExampleId type and incorrect ArmTokenParameter name (#12896) Co-authored-by: Younes --- .../luis/authoring/_luis_authoring_client.py | 5 - .../models/_luis_authoring_client_enums.py | 1 + .../language/luis/authoring/models/_models.py | 28 +- .../luis/authoring/models/_models_py3.py | 38 ++- .../luis/authoring/operations/__init__.py | 2 - .../operations/_examples_operations.py | 18 +- .../operations/_features_operations.py | 24 +- .../authoring/operations/_model_operations.py | 36 ++- .../operations/_permissions_operations.py | 277 ------------------ .../authoring/operations/_train_operations.py | 6 +- 10 files changed, 108 insertions(+), 327 deletions(-) delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_permissions_operations.py diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_luis_authoring_client.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_luis_authoring_client.py index 1a4854c8b590..185b9453df69 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_luis_authoring_client.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/_luis_authoring_client.py @@ -20,7 +20,6 @@ from .operations import AppsOperations from .operations import VersionsOperations from .operations import TrainOperations -from .operations import PermissionsOperations from .operations import PatternOperations from .operations import SettingsOperations from .operations import AzureAccountsOperations @@ -45,8 +44,6 @@ class LUISAuthoringClient(SDKClient): :vartype versions: azure.cognitiveservices.language.luis.authoring.operations.VersionsOperations :ivar train: Train operations :vartype train: azure.cognitiveservices.language.luis.authoring.operations.TrainOperations - :ivar permissions: Permissions operations - :vartype permissions: azure.cognitiveservices.language.luis.authoring.operations.PermissionsOperations :ivar pattern: Pattern operations :vartype pattern: azure.cognitiveservices.language.luis.authoring.operations.PatternOperations :ivar settings: Settings operations @@ -85,8 +82,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.train = TrainOperations( self._client, self.config, self._serialize, self._deserialize) - self.permissions = PermissionsOperations( - self._client, self.config, self._serialize, self._deserialize) self.pattern = PatternOperations( self._client, self.config, self._serialize, self._deserialize) self.settings = SettingsOperations( diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py index f85ad6da8c8e..3bfeb07e7bff 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py @@ -22,4 +22,5 @@ class TrainingStatus(str, Enum): class OperationStatusType(str, Enum): failed = "Failed" + failed = "FAILED" success = "Success" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models.py index b1e37b4e3af3..3b1472b1ddec 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models.py @@ -862,6 +862,9 @@ class EntityLabel(Model): :type role: str :param role_id: The role id for the predicted entity. :type role_id: str + :param children: + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.EntityLabel] """ _validation = { @@ -876,6 +879,7 @@ class EntityLabel(Model): 'end_token_index': {'key': 'endTokenIndex', 'type': 'int'}, 'role': {'key': 'role', 'type': 'str'}, 'role_id': {'key': 'roleId', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[EntityLabel]'}, } def __init__(self, **kwargs): @@ -885,6 +889,7 @@ def __init__(self, **kwargs): self.end_token_index = kwargs.get('end_token_index', None) self.role = kwargs.get('role', None) self.role_id = kwargs.get('role_id', None) + self.children = kwargs.get('children', None) class EntityLabelObject(Model): @@ -903,6 +908,9 @@ class EntityLabelObject(Model): :type end_char_index: int :param role: The role the entity plays in the utterance. :type role: str + :param children: The identified entities within the example utterance. + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.EntityLabelObject] """ _validation = { @@ -916,6 +924,7 @@ class EntityLabelObject(Model): 'start_char_index': {'key': 'startCharIndex', 'type': 'int'}, 'end_char_index': {'key': 'endCharIndex', 'type': 'int'}, 'role': {'key': 'role', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[EntityLabelObject]'}, } def __init__(self, **kwargs): @@ -924,6 +933,7 @@ def __init__(self, **kwargs): self.start_char_index = kwargs.get('start_char_index', None) self.end_char_index = kwargs.get('end_char_index', None) self.role = kwargs.get('role', None) + self.children = kwargs.get('children', None) class EntityModelCreateObject(Model): @@ -1065,6 +1075,9 @@ class EntityPrediction(Model): :type end_token_index: int :param phrase: Required. The actual token(s) that comprise the entity. :type phrase: str + :param children: + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.EntityPrediction] """ _validation = { @@ -1079,6 +1092,7 @@ class EntityPrediction(Model): 'start_token_index': {'key': 'startTokenIndex', 'type': 'int'}, 'end_token_index': {'key': 'endTokenIndex', 'type': 'int'}, 'phrase': {'key': 'phrase', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[EntityPrediction]'}, } def __init__(self, **kwargs): @@ -1087,6 +1101,7 @@ def __init__(self, **kwargs): self.start_token_index = kwargs.get('start_token_index', None) self.end_token_index = kwargs.get('end_token_index', None) self.phrase = kwargs.get('phrase', None) + self.children = kwargs.get('children', None) class EntityRole(Model): @@ -1618,6 +1633,9 @@ class JSONEntity(Model): :type entity: str :param role: The role the entity plays in the utterance. :type role: str + :param children: + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.JSONEntity] """ _validation = { @@ -1631,6 +1649,7 @@ class JSONEntity(Model): 'end_pos': {'key': 'endPos', 'type': 'int'}, 'entity': {'key': 'entity', 'type': 'str'}, 'role': {'key': 'role', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[JSONEntity]'}, } def __init__(self, **kwargs): @@ -1639,6 +1658,7 @@ def __init__(self, **kwargs): self.end_pos = kwargs.get('end_pos', None) self.entity = kwargs.get('entity', None) self.role = kwargs.get('role', None) + self.children = kwargs.get('children', None) class JSONModelFeature(Model): @@ -1802,12 +1822,12 @@ class LabelExampleResponse(Model): :param utterance_text: The example utterance. :type utterance_text: str :param example_id: The newly created sample ID. - :type example_id: int + :type example_id: long """ _attribute_map = { 'utterance_text': {'key': 'UtteranceText', 'type': 'str'}, - 'example_id': {'key': 'ExampleId', 'type': 'int'}, + 'example_id': {'key': 'ExampleId', 'type': 'long'}, } def __init__(self, **kwargs): @@ -2045,17 +2065,21 @@ class ModelFeatureInformation(Model): :type model_name: str :param feature_name: The name of the feature used. :type feature_name: str + :param is_required: + :type is_required: bool """ _attribute_map = { 'model_name': {'key': 'modelName', 'type': 'str'}, 'feature_name': {'key': 'featureName', 'type': 'str'}, + 'is_required': {'key': 'isRequired', 'type': 'bool'}, } def __init__(self, **kwargs): super(ModelFeatureInformation, self).__init__(**kwargs) self.model_name = kwargs.get('model_name', None) self.feature_name = kwargs.get('feature_name', None) + self.is_required = kwargs.get('is_required', None) class ModelInfoResponse(Model): diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models_py3.py index 55e8311dd71d..9685363241b2 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_models_py3.py @@ -862,6 +862,9 @@ class EntityLabel(Model): :type role: str :param role_id: The role id for the predicted entity. :type role_id: str + :param children: + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.EntityLabel] """ _validation = { @@ -876,15 +879,17 @@ class EntityLabel(Model): 'end_token_index': {'key': 'endTokenIndex', 'type': 'int'}, 'role': {'key': 'role', 'type': 'str'}, 'role_id': {'key': 'roleId', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[EntityLabel]'}, } - def __init__(self, *, entity_name: str, start_token_index: int, end_token_index: int, role: str=None, role_id: str=None, **kwargs) -> None: + def __init__(self, *, entity_name: str, start_token_index: int, end_token_index: int, role: str=None, role_id: str=None, children=None, **kwargs) -> None: super(EntityLabel, self).__init__(**kwargs) self.entity_name = entity_name self.start_token_index = start_token_index self.end_token_index = end_token_index self.role = role self.role_id = role_id + self.children = children class EntityLabelObject(Model): @@ -903,6 +908,9 @@ class EntityLabelObject(Model): :type end_char_index: int :param role: The role the entity plays in the utterance. :type role: str + :param children: The identified entities within the example utterance. + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.EntityLabelObject] """ _validation = { @@ -916,14 +924,16 @@ class EntityLabelObject(Model): 'start_char_index': {'key': 'startCharIndex', 'type': 'int'}, 'end_char_index': {'key': 'endCharIndex', 'type': 'int'}, 'role': {'key': 'role', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[EntityLabelObject]'}, } - def __init__(self, *, entity_name: str, start_char_index: int, end_char_index: int, role: str=None, **kwargs) -> None: + def __init__(self, *, entity_name: str, start_char_index: int, end_char_index: int, role: str=None, children=None, **kwargs) -> None: super(EntityLabelObject, self).__init__(**kwargs) self.entity_name = entity_name self.start_char_index = start_char_index self.end_char_index = end_char_index self.role = role + self.children = children class EntityModelCreateObject(Model): @@ -1065,6 +1075,9 @@ class EntityPrediction(Model): :type end_token_index: int :param phrase: Required. The actual token(s) that comprise the entity. :type phrase: str + :param children: + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.EntityPrediction] """ _validation = { @@ -1079,14 +1092,16 @@ class EntityPrediction(Model): 'start_token_index': {'key': 'startTokenIndex', 'type': 'int'}, 'end_token_index': {'key': 'endTokenIndex', 'type': 'int'}, 'phrase': {'key': 'phrase', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[EntityPrediction]'}, } - def __init__(self, *, entity_name: str, start_token_index: int, end_token_index: int, phrase: str, **kwargs) -> None: + def __init__(self, *, entity_name: str, start_token_index: int, end_token_index: int, phrase: str, children=None, **kwargs) -> None: super(EntityPrediction, self).__init__(**kwargs) self.entity_name = entity_name self.start_token_index = start_token_index self.end_token_index = end_token_index self.phrase = phrase + self.children = children class EntityRole(Model): @@ -1618,6 +1633,9 @@ class JSONEntity(Model): :type entity: str :param role: The role the entity plays in the utterance. :type role: str + :param children: + :type children: + list[~azure.cognitiveservices.language.luis.authoring.models.JSONEntity] """ _validation = { @@ -1631,14 +1649,16 @@ class JSONEntity(Model): 'end_pos': {'key': 'endPos', 'type': 'int'}, 'entity': {'key': 'entity', 'type': 'str'}, 'role': {'key': 'role', 'type': 'str'}, + 'children': {'key': 'children', 'type': '[JSONEntity]'}, } - def __init__(self, *, start_pos: int, end_pos: int, entity: str, role: str=None, **kwargs) -> None: + def __init__(self, *, start_pos: int, end_pos: int, entity: str, role: str=None, children=None, **kwargs) -> None: super(JSONEntity, self).__init__(**kwargs) self.start_pos = start_pos self.end_pos = end_pos self.entity = entity self.role = role + self.children = children class JSONModelFeature(Model): @@ -1802,12 +1822,12 @@ class LabelExampleResponse(Model): :param utterance_text: The example utterance. :type utterance_text: str :param example_id: The newly created sample ID. - :type example_id: int + :type example_id: long """ _attribute_map = { 'utterance_text': {'key': 'UtteranceText', 'type': 'str'}, - 'example_id': {'key': 'ExampleId', 'type': 'int'}, + 'example_id': {'key': 'ExampleId', 'type': 'long'}, } def __init__(self, *, utterance_text: str=None, example_id: int=None, **kwargs) -> None: @@ -2045,17 +2065,21 @@ class ModelFeatureInformation(Model): :type model_name: str :param feature_name: The name of the feature used. :type feature_name: str + :param is_required: + :type is_required: bool """ _attribute_map = { 'model_name': {'key': 'modelName', 'type': 'str'}, 'feature_name': {'key': 'featureName', 'type': 'str'}, + 'is_required': {'key': 'isRequired', 'type': 'bool'}, } - def __init__(self, *, model_name: str=None, feature_name: str=None, **kwargs) -> None: + def __init__(self, *, model_name: str=None, feature_name: str=None, is_required: bool=None, **kwargs) -> None: super(ModelFeatureInformation, self).__init__(**kwargs) self.model_name = model_name self.feature_name = feature_name + self.is_required = is_required class ModelInfoResponse(Model): diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/__init__.py index afe29f0d3f6a..0d53c240e247 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/__init__.py @@ -15,7 +15,6 @@ from ._apps_operations import AppsOperations from ._versions_operations import VersionsOperations from ._train_operations import TrainOperations -from ._permissions_operations import PermissionsOperations from ._pattern_operations import PatternOperations from ._settings_operations import SettingsOperations from ._azure_accounts_operations import AzureAccountsOperations @@ -27,7 +26,6 @@ 'AppsOperations', 'VersionsOperations', 'TrainOperations', - 'PermissionsOperations', 'PatternOperations', 'SettingsOperations', 'AzureAccountsOperations', diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_examples_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_examples_operations.py index 444b3a037d5c..a25af3a63958 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_examples_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_examples_operations.py @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def add( - self, app_id, version_id, example_label_object, custom_headers=None, raw=False, **operation_config): + self, app_id, version_id, example_label_object, enable_nested_children=False, custom_headers=None, raw=False, **operation_config): """Adds a labeled example utterance in a version of the application. :param app_id: The application ID. @@ -47,6 +47,8 @@ def add( expected intent and entities. :type example_label_object: ~azure.cognitiveservices.language.luis.authoring.models.ExampleLabelObject + :param enable_nested_children: Toggles nested/flat format + :type enable_nested_children: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -70,6 +72,8 @@ def add( # Construct parameters query_parameters = {} + if enable_nested_children is not None: + query_parameters['enableNestedChildren'] = self._serialize.query("enable_nested_children", enable_nested_children, 'bool') # Construct headers header_parameters = {} @@ -100,7 +104,7 @@ def add( add.metadata = {'url': '/apps/{appId}/versions/{versionId}/example'} def batch( - self, app_id, version_id, example_label_object_array, custom_headers=None, raw=False, **operation_config): + self, app_id, version_id, example_label_object_array, enable_nested_children=False, custom_headers=None, raw=False, **operation_config): """Adds a batch of labeled example utterances to a version of the application. @@ -111,6 +115,8 @@ def batch( :param example_label_object_array: Array of example utterances. :type example_label_object_array: list[~azure.cognitiveservices.language.luis.authoring.models.ExampleLabelObject] + :param enable_nested_children: Toggles nested/flat format + :type enable_nested_children: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -134,6 +140,8 @@ def batch( # Construct parameters query_parameters = {} + if enable_nested_children is not None: + query_parameters['enableNestedChildren'] = self._serialize.query("enable_nested_children", enable_nested_children, 'bool') # Construct headers header_parameters = {} @@ -166,7 +174,7 @@ def batch( batch.metadata = {'url': '/apps/{appId}/versions/{versionId}/examples'} def list( - self, app_id, version_id, skip=0, take=100, custom_headers=None, raw=False, **operation_config): + self, app_id, version_id, skip=0, take=100, enable_nested_children=False, custom_headers=None, raw=False, **operation_config): """Returns example utterances to be reviewed from a version of the application. @@ -179,6 +187,8 @@ def list( :param take: The number of entries to return. Maximum page size is 500. Default is 100. :type take: int + :param enable_nested_children: Toggles nested/flat format + :type enable_nested_children: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -206,6 +216,8 @@ def list( query_parameters['skip'] = self._serialize.query("skip", skip, 'int', minimum=0) if take is not None: query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=500, minimum=0) + if enable_nested_children is not None: + query_parameters['enableNestedChildren'] = self._serialize.query("enable_nested_children", enable_nested_children, 'bool') # Construct headers header_parameters = {} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_features_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_features_operations.py index 1b7b477b3311..1843ed6e9d01 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_features_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_features_operations.py @@ -421,7 +421,7 @@ def delete_phrase_list( delete_phrase_list.metadata = {'url': '/apps/{appId}/versions/{versionId}/phraselists/{phraselistId}'} def add_intent_feature( - self, app_id, version_id, intent_id, model_name=None, feature_name=None, custom_headers=None, raw=False, **operation_config): + self, app_id, version_id, intent_id, feature_relation_create_object, custom_headers=None, raw=False, **operation_config): """Adds a new feature relation to be used by the intent in a version of the application. @@ -431,10 +431,10 @@ def add_intent_feature( :type version_id: str :param intent_id: The intent classifier ID. :type intent_id: str - :param model_name: The name of the model used. - :type model_name: str - :param feature_name: The name of the feature used. - :type feature_name: str + :param feature_relation_create_object: A Feature relation information + object. + :type feature_relation_create_object: + ~azure.cognitiveservices.language.luis.authoring.models.ModelFeatureInformation :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -447,8 +447,6 @@ def add_intent_feature( :raises: :class:`ErrorResponseException` """ - feature_relation_create_object = models.ModelFeatureInformation(model_name=model_name, feature_name=feature_name) - # Construct URL url = self.add_intent_feature.metadata['url'] path_format_arguments = { @@ -491,7 +489,7 @@ def add_intent_feature( add_intent_feature.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}/features'} def add_entity_feature( - self, app_id, version_id, entity_id, model_name=None, feature_name=None, custom_headers=None, raw=False, **operation_config): + self, app_id, version_id, entity_id, feature_relation_create_object, custom_headers=None, raw=False, **operation_config): """Adds a new feature relation to be used by the entity in a version of the application. @@ -501,10 +499,10 @@ def add_entity_feature( :type version_id: str :param entity_id: The entity extractor ID. :type entity_id: str - :param model_name: The name of the model used. - :type model_name: str - :param feature_name: The name of the feature used. - :type feature_name: str + :param feature_relation_create_object: A Feature relation information + object. + :type feature_relation_create_object: + ~azure.cognitiveservices.language.luis.authoring.models.ModelFeatureInformation :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -517,8 +515,6 @@ def add_entity_feature( :raises: :class:`ErrorResponseException` """ - feature_relation_create_object = models.ModelFeatureInformation(model_name=model_name, feature_name=feature_name) - # Construct URL url = self.add_entity_feature.metadata['url'] path_format_arguments = { diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_model_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_model_operations.py index d3ced6fec0c8..3cb9ff0f4208 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_model_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_model_operations.py @@ -1389,7 +1389,7 @@ def replace_intent_features( replace_intent_features.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}/features'} def delete_intent_feature( - self, app_id, version_id, intent_id, model_name=None, feature_name=None, custom_headers=None, raw=False, **operation_config): + self, app_id, version_id, intent_id, feature_relation_delete_object, custom_headers=None, raw=False, **operation_config): """Deletes a relation from the feature relations used by the intent in a version of the application. @@ -1399,10 +1399,10 @@ def delete_intent_feature( :type version_id: str :param intent_id: The intent classifier ID. :type intent_id: str - :param model_name: The name of the model used. - :type model_name: str - :param feature_name: The name of the feature used. - :type feature_name: str + :param feature_relation_delete_object: A feature information object + containing the feature relation to delete. + :type feature_relation_delete_object: + ~azure.cognitiveservices.language.luis.authoring.models.ModelFeatureInformation :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1415,8 +1415,6 @@ def delete_intent_feature( :raises: :class:`ErrorResponseException` """ - feature_relation_delete_object = models.ModelFeatureInformation(model_name=model_name, feature_name=feature_name) - # Construct URL url = self.delete_intent_feature.metadata['url'] path_format_arguments = { @@ -1587,7 +1585,7 @@ def replace_entity_features( replace_entity_features.metadata = {'url': '/apps/{appId}/versions/{versionId}/entities/{entityId}/features'} def delete_entity_feature( - self, app_id, version_id, entity_id, model_name=None, feature_name=None, custom_headers=None, raw=False, **operation_config): + self, app_id, version_id, entity_id, feature_relation_delete_object, custom_headers=None, raw=False, **operation_config): """Deletes a relation from the feature relations used by the entity in a version of the application. @@ -1597,10 +1595,10 @@ def delete_entity_feature( :type version_id: str :param entity_id: The entity extractor ID. :type entity_id: str - :param model_name: The name of the model used. - :type model_name: str - :param feature_name: The name of the feature used. - :type feature_name: str + :param feature_relation_delete_object: A feature information object + containing the feature relation to delete. + :type feature_relation_delete_object: + ~azure.cognitiveservices.language.luis.authoring.models.ModelFeatureInformation :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1613,8 +1611,6 @@ def delete_entity_feature( :raises: :class:`ErrorResponseException` """ - feature_relation_delete_object = models.ModelFeatureInformation(model_name=model_name, feature_name=feature_name) - # Construct URL url = self.delete_entity_feature.metadata['url'] path_format_arguments = { @@ -2544,7 +2540,7 @@ def update_sub_list( update_sub_list.metadata = {'url': '/apps/{appId}/versions/{versionId}/closedlists/{clEntityId}/sublists/{subListId}'} def list_intent_suggestions( - self, app_id, version_id, intent_id, take=100, custom_headers=None, raw=False, **operation_config): + self, app_id, version_id, intent_id, take=100, enable_nested_children=False, custom_headers=None, raw=False, **operation_config): """Suggests example utterances that would improve the accuracy of the intent model in a version of the application. @@ -2557,6 +2553,8 @@ def list_intent_suggestions( :param take: The number of entries to return. Maximum page size is 500. Default is 100. :type take: int + :param enable_nested_children: Toggles nested/flat format + :type enable_nested_children: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -2583,6 +2581,8 @@ def list_intent_suggestions( query_parameters = {} if take is not None: query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=500, minimum=0) + if enable_nested_children is not None: + query_parameters['enableNestedChildren'] = self._serialize.query("enable_nested_children", enable_nested_children, 'bool') # Construct headers header_parameters = {} @@ -2609,7 +2609,7 @@ def list_intent_suggestions( list_intent_suggestions.metadata = {'url': '/apps/{appId}/versions/{versionId}/intents/{intentId}/suggest'} def list_entity_suggestions( - self, app_id, version_id, entity_id, take=100, custom_headers=None, raw=False, **operation_config): + self, app_id, version_id, entity_id, take=100, enable_nested_children=False, custom_headers=None, raw=False, **operation_config): """Get suggested example utterances that would improve the accuracy of the entity model in a version of the application. @@ -2622,6 +2622,8 @@ def list_entity_suggestions( :param take: The number of entries to return. Maximum page size is 500. Default is 100. :type take: int + :param enable_nested_children: Toggles nested/flat format + :type enable_nested_children: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -2648,6 +2650,8 @@ def list_entity_suggestions( query_parameters = {} if take is not None: query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=500, minimum=0) + if enable_nested_children is not None: + query_parameters['enableNestedChildren'] = self._serialize.query("enable_nested_children", enable_nested_children, 'bool') # Construct headers header_parameters = {} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_permissions_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_permissions_operations.py deleted file mode 100644 index 2050f431a60d..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_permissions_operations.py +++ /dev/null @@ -1,277 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# 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. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.pipeline import ClientRawResponse - -from .. import models - - -class PermissionsOperations(object): - """PermissionsOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - - self.config = config - - def list( - self, app_id, custom_headers=None, raw=False, **operation_config): - """Gets the list of user emails that have permissions to access your - application. - - :param app_id: The application ID. - :type app_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: UserAccessList or ClientRawResponse if raw=true - :rtype: - ~azure.cognitiveservices.language.luis.authoring.models.UserAccessList - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), - 'appId': self._serialize.url("app_id", app_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('UserAccessList', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/apps/{appId}/permissions'} - - def add( - self, app_id, email=None, custom_headers=None, raw=False, **operation_config): - """Adds a user to the allowed list of users to access this LUIS - application. Users are added using their email address. - - :param app_id: The application ID. - :type app_id: str - :param email: The email address of the user. - :type email: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: OperationStatus or ClientRawResponse if raw=true - :rtype: - ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - user_to_add = models.UserCollaborator(email=email) - - # Construct URL - url = self.add.metadata['url'] - path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), - 'appId': self._serialize.url("app_id", app_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct body - body_content = self._serialize.body(user_to_add, 'UserCollaborator') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - add.metadata = {'url': '/apps/{appId}/permissions'} - - def delete( - self, app_id, email=None, custom_headers=None, raw=False, **operation_config): - """Removes a user from the allowed list of users to access this LUIS - application. Users are removed using their email address. - - :param app_id: The application ID. - :type app_id: str - :param email: The email address of the user. - :type email: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: OperationStatus or ClientRawResponse if raw=true - :rtype: - ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - user_to_delete = models.UserCollaborator(email=email) - - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), - 'appId': self._serialize.url("app_id", app_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct body - body_content = self._serialize.body(user_to_delete, 'UserCollaborator') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - delete.metadata = {'url': '/apps/{appId}/permissions'} - - def update( - self, app_id, emails=None, custom_headers=None, raw=False, **operation_config): - """Replaces the current user access list with the new list sent in the - body. If an empty list is sent, all access to other users will be - removed. - - :param app_id: The application ID. - :type app_id: str - :param emails: The email address of the users. - :type emails: list[str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: OperationStatus or ClientRawResponse if raw=true - :rtype: - ~azure.cognitiveservices.language.luis.authoring.models.OperationStatus - or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ - collaborators = models.CollaboratorsArray(emails=emails) - - # Construct URL - url = self.update.metadata['url'] - path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), - 'appId': self._serialize.url("app_id", app_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct body - body_content = self._serialize.body(collaborators, 'CollaboratorsArray') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.ErrorResponseException(self._deserialize, response) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('OperationStatus', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - update.metadata = {'url': '/apps/{appId}/permissions'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_train_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_train_operations.py index c48ed5feb317..cdfc2140a3bf 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_train_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/operations/_train_operations.py @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def train_version( - self, app_id, version_id, custom_headers=None, raw=False, **operation_config): + self, app_id, version_id, mode=None, custom_headers=None, raw=False, **operation_config): """Sends a training request for a version of a specified LUIS app. This POST request initiates a request asynchronously. To determine whether the training request is successful, submit a GET request to get @@ -49,6 +49,8 @@ def train_version( :type app_id: str :param version_id: The version ID. :type version_id: str + :param mode: An enum value specifying mode of training. + :type mode: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -72,6 +74,8 @@ def train_version( # Construct parameters query_parameters = {} + if mode is not None: + query_parameters['mode'] = self._serialize.query("mode", mode, 'str') # Construct headers header_parameters = {}