From 62a34dfe610de6f2bb9f0ed35279e7e9abaa9313 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Wed, 20 Jan 2021 13:54:49 -0500 Subject: [PATCH] regen and move code model specific args to metadata.json --- autorest/codegen/models/code_model.py | 6 ++ .../serializers/metadata_serializer.py | 2 + .../codegen/templates/metadata.json.jinja2 | 51 ++++++++++- .../templates/service_client.py.jinja2 | 4 +- autorest/multiapi/models/code_model.py | 2 +- autorest/multiapi/models/global_parameters.py | 86 ++++++------------- .../_polling_paging_example_operations.py | 9 +- .../_polling_paging_example_operations.py | 9 +- .../sample/_multiapi_service_client.py | 2 +- .../multiapi/sample/_operations_mixin.py | 8 +- .../multiapi/sample/aio/_operations_mixin.py | 8 +- .../azure/multiapi/sample/v1/_metadata.json | 52 +++++++++-- .../_multiapi_service_client_operations.py | 8 +- .../_multiapi_service_client_operations.py | 8 +- .../azure/multiapi/sample/v2/_metadata.json | 44 +++++++++- .../azure/multiapi/sample/v3/_metadata.json | 44 +++++++++- .../models/_multiapi_service_client_enums.py | 12 ++- .../multiapi/_multiapi_service_client.py | 2 +- .../Multiapi/multiapi/_operations_mixin.py | 37 ++++++++ .../multiapi/aio/_operations_mixin.py | 37 ++++++++ .../Multiapi/multiapi/v1/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 48 +++++++++++ .../_multiapi_service_client_operations.py | 49 +++++++++++ .../Multiapi/multiapi/v2/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 53 ++++++++++++ .../_multiapi_service_client_operations.py | 54 ++++++++++++ .../Multiapi/multiapi/v3/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 58 +++++++++++++ .../_multiapi_service_client_operations.py | 59 +++++++++++++ .../_multiapi_service_client.py | 2 +- .../_operations_mixin.py | 37 ++++++++ .../aio/_operations_mixin.py | 37 ++++++++ .../v1/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 48 +++++++++++ .../_multiapi_service_client_operations.py | 49 +++++++++++ .../v2/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 53 ++++++++++++ .../_multiapi_service_client_operations.py | 54 ++++++++++++ .../v3/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 58 +++++++++++++ .../_multiapi_service_client_operations.py | 59 +++++++++++++ .../multiapicustombaseurl/v1/_metadata.json | 32 ++++++- .../multiapicustombaseurl/v2/_metadata.json | 32 ++++++- .../_multiapi_service_client.py | 2 +- .../multiapidataplane/_operations_mixin.py | 37 ++++++++ .../aio/_operations_mixin.py | 37 ++++++++ .../multiapidataplane/v1/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 48 +++++++++++ .../_multiapi_service_client_operations.py | 49 +++++++++++ .../multiapidataplane/v2/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 53 ++++++++++++ .../_multiapi_service_client_operations.py | 54 ++++++++++++ .../multiapidataplane/v3/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 58 +++++++++++++ .../_multiapi_service_client_operations.py | 59 +++++++++++++ .../_multiapi_service_client.py | 2 +- .../multiapinoasync/_operations_mixin.py | 37 ++++++++ .../multiapinoasync/v1/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 49 +++++++++++ .../multiapinoasync/v2/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 54 ++++++++++++ .../multiapinoasync/v3/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 59 +++++++++++++ .../submodule/_multiapi_service_client.py | 2 +- .../submodule/_operations_mixin.py | 37 ++++++++ .../submodule/aio/_operations_mixin.py | 37 ++++++++ .../submodule/v1/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 48 +++++++++++ .../_multiapi_service_client_operations.py | 49 +++++++++++ .../submodule/v2/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 53 ++++++++++++ .../_multiapi_service_client_operations.py | 54 ++++++++++++ .../submodule/v3/_metadata.json | 56 +++++++++++- .../_multiapi_service_client_operations.py | 58 +++++++++++++ .../_multiapi_service_client_operations.py | 59 +++++++++++++ .../aio/operations/_dictionary_operations.py | 56 ++++++------ .../operations/_dictionary_operations.py | 56 ++++++------ 77 files changed, 2978 insertions(+), 182 deletions(-) diff --git a/autorest/codegen/models/code_model.py b/autorest/codegen/models/code_model.py index c021f5ea6ba..3956580bada 100644 --- a/autorest/codegen/models/code_model.py +++ b/autorest/codegen/models/code_model.py @@ -339,3 +339,9 @@ def has_lro_operations(self) -> bool: for operation_group in self.operation_groups for operation in operation_group.operations ]) + + @staticmethod + def base_url_method_signature(async_mode: bool) -> str: + if async_mode: + return "base_url: Optional[str] = None," + return "base_url=None, # type: Optional[str]" diff --git a/autorest/codegen/serializers/metadata_serializer.py b/autorest/codegen/serializers/metadata_serializer.py index 0796af2b41a..f94fa4c3865 100644 --- a/autorest/codegen/serializers/metadata_serializer.py +++ b/autorest/codegen/serializers/metadata_serializer.py @@ -161,6 +161,8 @@ def _is_paging(operation): # setting to true, because for multiapi we always generate with a version file with version 0.1.0 self.code_model.options['package_version'] = '0.1.0' + if self.code_model.options['azure_arm'] and not self.code_model.base_url: + self.code_model.base_url = 'https://management.azure.com' return template.render( chosen_version=chosen_version, total_api_version_list=total_api_version_list, diff --git a/autorest/codegen/templates/metadata.json.jinja2 b/autorest/codegen/templates/metadata.json.jinja2 index 52265d393ec..ded15ff00ff 100644 --- a/autorest/codegen/templates/metadata.json.jinja2 +++ b/autorest/codegen/templates/metadata.json.jinja2 @@ -7,8 +7,7 @@ "name": {{ code_model.class_name | tojson }}, "filename": {{ ("_" + code_model.module_name) | tojson }}, "description": {{ code_model.description | tojson }}, - {% set base_url = code_model.base_url if code_model.base_url else ('https://management.azure.com' if code_model.options["azure_arm"] else None )%} - "base_url": {{ (keywords.escape_str(base_url) if base_url else None) | tojson }}, + "base_url": {{ (keywords.escape_str(code_model.base_url) if code_model.base_url else None) | tojson }}, "custom_base_url": {{ (keywords.escape_str(code_model.custom_base_url) if code_model.custom_base_url else None) | tojson }}, "azure_arm": {{ code_model.options["azure_arm"] | tojson }}, "has_lro_operations": {{ code_model.has_lro_operations | tojson }}, @@ -42,7 +41,53 @@ {{ gp.serialized_name | tojson }}: {{ gp.constant_declaration | tojson }}{{ "," if not loop.last else "" }} {% endfor %} }, - "call": {{ code_model.global_parameters.method | map(attribute="serialized_name") | join(', ') | tojson }} + "call": {{ code_model.global_parameters.method | map(attribute="serialized_name") | join(', ') | tojson }}, + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + {% if not code_model.custom_base_url %} + "base_url": { + "signature": {{ code_model.base_url_method_signature(False) | tojson }}, + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + {% endif %} + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + {% if not code_model.custom_base_url %} + "base_url": { + "signature": {{ code_model.base_url_method_signature(True) | tojson }}, + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + {% endif %} + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": {{ code_model.options['credential'] | tojson }}, diff --git a/autorest/codegen/templates/service_client.py.jinja2 b/autorest/codegen/templates/service_client.py.jinja2 index a11734a9bf0..73caea9ff6f 100644 --- a/autorest/codegen/templates/service_client.py.jinja2 +++ b/autorest/codegen/templates/service_client.py.jinja2 @@ -8,7 +8,7 @@ def __init__( {{ param_signature }}, {% endfor %} {% if code_model.base_url %} - base_url: Optional[str] = None, + {{ code_model.base_url_method_signature(True) }} {% endif %} **kwargs: Any {% else %} @@ -16,7 +16,7 @@ def __init__( {{ param_signature }} {% endfor %} {% if code_model.base_url %} - base_url=None, # type: Optional[str] + {{ code_model.base_url_method_signature(False) }} {% endif %} **kwargs # type: Any {% endif %} diff --git a/autorest/multiapi/models/code_model.py b/autorest/multiapi/models/code_model.py index 6326ba5977e..d8f8d39b2cc 100644 --- a/autorest/multiapi/models/code_model.py +++ b/autorest/multiapi/models/code_model.py @@ -37,7 +37,7 @@ def __init__( self.config = Config(default_version_metadata) self.operation_mixin_group = OperationMixinGroup(version_path_to_metadata, default_api_version) self.global_parameters = GlobalParameters( - default_version_metadata["global_parameters"], self.service_client.base_url + default_version_metadata["global_parameters"] ) self.user_specified_default_api = user_specified_default_api diff --git a/autorest/multiapi/models/global_parameters.py b/autorest/multiapi/models/global_parameters.py index c9222b9d0f9..0f28127eaa7 100644 --- a/autorest/multiapi/models/global_parameters.py +++ b/autorest/multiapi/models/global_parameters.py @@ -3,85 +3,51 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List from .global_parameter import GlobalParameter from .constant_global_parameter import ConstantGlobalParameter +def _convert_global_parameters(sync_metadata, async_metadata): + global_parameters = [ + GlobalParameter( + name=parameter_name, + global_parameter_metadata_sync=gp_sync, + global_parameter_metadata_async=async_metadata[parameter_name] + ) + for parameter_name, gp_sync in sync_metadata.items() + ] + return global_parameters + class GlobalParameters: - def __init__(self, global_parameters_metadata: Dict[str, Any], service_client_base_url: Optional[str]): + def __init__( + self, + global_parameters_metadata: Dict[str, Any], + ): self.call = global_parameters_metadata["call"] self.global_parameters_metadata = global_parameters_metadata - self.service_client_base_url = service_client_base_url @property def service_client_specific_global_parameters(self) -> List[GlobalParameter]: """Return global params specific to multiapi service client + config api_version, base_url (re-adding it in specific are), and profile """ - api_version_param = GlobalParameter( - name="api_version", - global_parameter_metadata_sync={ - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": False - }, - global_parameter_metadata_async={ - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": False - }, - ) - base_url_param = None - if self.service_client_base_url: - base_url_param = GlobalParameter( - name="base_url", - global_parameter_metadata_sync={ - "signature": "base_url=None, # type: Optional[str]", - "description": "Service URL", - "docstring_type": "str", - "required": False - }, - global_parameter_metadata_async={ - "signature": "base_url: Optional[str] = None,", - "description": "Service URL", - "docstring_type": "str", - "required": False - }, - ) - profile_param = GlobalParameter( - name="profile", - global_parameter_metadata_sync={ - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": False - }, - global_parameter_metadata_async={ - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": False - }, + service_client_params_sync = self.global_parameters_metadata["service_client_specific"]["sync"] + service_client_params_async = self.global_parameters_metadata["service_client_specific"]["async"] + + return _convert_global_parameters( + service_client_params_sync, + service_client_params_async ) - # return non-None members - return [p for p in [api_version_param, base_url_param, profile_param] if p] @property def parameters(self) -> List[GlobalParameter]: global_parameters_metadata_sync = self.global_parameters_metadata["sync"] global_parameters_metadata_async = self.global_parameters_metadata["async"] - global_parameters = [ - GlobalParameter( - name=parameter_name, - global_parameter_metadata_sync=gp_sync, - global_parameter_metadata_async=global_parameters_metadata_async[parameter_name] - ) - for parameter_name, gp_sync in global_parameters_metadata_sync.items() - ] - return global_parameters + return _convert_global_parameters( + global_parameters_metadata_sync, + global_parameters_metadata_async + ) @property def constant_parameters(self) -> List[ConstantGlobalParameter]: diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py b/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py index 76f58041030..110d7e15d14 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py @@ -13,8 +13,7 @@ from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncNoPolling, AsyncPollingMethod -from azure.core.polling.async_base_polling import AsyncLROBasePolling -from my.library.aio import AsyncCustomPager, AsyncCustomPoller +from my.library.aio import AsyncCustomDefaultPollingMethod, AsyncCustomPager, AsyncCustomPoller from ... import models as _models @@ -83,8 +82,8 @@ async def begin_basic_polling( :type product: ~azure.directives.sample.models.Product :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncCustomDefaultPollingMethod polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncCustomPoller that returns either Product or the result of cls(response) @@ -115,7 +114,7 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncLROBasePolling(lro_delay, **kwargs) + if polling is True: polling_method = AsyncCustomDefaultPollingMethod(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py b/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py index a128968390f..bfedfeae15f 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py @@ -12,8 +12,7 @@ from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import NoPolling, PollingMethod -from azure.core.polling.base_polling import LROBasePolling -from my.library import CustomPager, CustomPoller +from my.library import CustomDefaultPollingMethod, CustomPager, CustomPoller from .. import models as _models @@ -88,8 +87,8 @@ def begin_basic_polling( :type product: ~azure.directives.sample.models.Product :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the CustomDefaultPollingMethod polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of CustomPoller that returns either Product or the result of cls(response) @@ -120,7 +119,7 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = LROBasePolling(lro_delay, **kwargs) + if polling is True: polling_method = CustomDefaultPollingMethod(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_multiapi_service_client.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_multiapi_service_client.py index 19206a00bf4..64c0e839758 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_multiapi_service_client.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_multiapi_service_client.py @@ -70,7 +70,7 @@ def __init__( self, credential, # type: "TokenCredential" api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url=None, # type: Optional[str] profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_operations_mixin.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_operations_mixin.py index 0b5e0b1f51b..8c3c48af91c 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_operations_mixin.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_operations_mixin.py @@ -38,8 +38,8 @@ def begin_test_lro( :type product: ~azure.multiapi.sample.models.Product :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either Product or the result of cls(response) @@ -73,8 +73,8 @@ def begin_test_lro_and_paging( :type test_lro_and_paging_options: ~azure.multiapi.sample.models.TestLroAndPagingOptions :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of either PagingResult or the result of cls(response) diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/aio/_operations_mixin.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/aio/_operations_mixin.py index 877924e7421..82a23291c9f 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/aio/_operations_mixin.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/aio/_operations_mixin.py @@ -34,8 +34,8 @@ async def begin_test_lro( :type product: ~azure.multiapi.sample.models.Product :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) @@ -69,8 +69,8 @@ def begin_test_lro_and_paging( :type test_lro_and_paging_options: ~azure.multiapi.sample.models.TestLroAndPagingOptions :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns an iterator like instance of either PagingResult or the result of cls(response) diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_metadata.json b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_metadata.json index a33e25965b8..5255ff98e91 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_metadata.json +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -77,12 +119,12 @@ "begin_test_lro" : { "sync": { "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[\"_models.Product\"]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put.\n:type product: ~azure.multiapi.sample.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: True for ARMPolling, False for no polling, or a\n polling object for personal polling strategy\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either Product or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.multiapi.sample.models.Product]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put.\n:type product: ~azure.multiapi.sample.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the ARMPolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either Product or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.multiapi.sample.models.Product]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_test_lro(\n self,\n product: Optional[\"_models.Product\"] = None,\n **kwargs\n) -\u003e AsyncLROPoller[\"_models.Product\"]:\n", - "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put.\n:type product: ~azure.multiapi.sample.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: True for ARMPolling, False for no polling, or a\n polling object for personal polling strategy\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either Product or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.multiapi.sample.models.Product]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put.\n:type product: ~azure.multiapi.sample.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncARMPolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either Product or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.multiapi.sample.models.Product]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "product" }, @@ -101,12 +143,12 @@ "begin_test_lro_and_paging" : { "sync": { "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[\"_models.TestLroAndPagingOptions\"]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id:\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group.\n:type test_lro_and_paging_options: ~azure.multiapi.sample.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: True for ARMPolling, False for no polling, or a\n polling object for personal polling strategy\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.multiapi.sample.models.PagingResult]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id:\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group.\n:type test_lro_and_paging_options: ~azure.multiapi.sample.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the ARMPolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.multiapi.sample.models.PagingResult]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": false, "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[\"_models.TestLroAndPagingOptions\"] = None,\n **kwargs\n) -\u003e AsyncLROPoller[AsyncItemPaged[\"_models.PagingResult\"]]:\n", - "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id:\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group.\n:type test_lro_and_paging_options: ~azure.multiapi.sample.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: True for ARMPolling, False for no polling, or a\n polling object for personal polling strategy\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns an iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.multiapi.sample.models.PagingResult]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id:\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group.\n:type test_lro_and_paging_options: ~azure.multiapi.sample.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncARMPolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns an iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~azure.multiapi.sample.models.PagingResult]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "client_request_id, test_lro_and_paging_options" }, diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py index cfd00145e75..d3d44882d2a 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py @@ -136,8 +136,8 @@ async def begin_test_lro( :type product: ~azure.multiapi.sample.models.Product :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) @@ -247,8 +247,8 @@ async def begin_test_lro_and_paging( :type test_lro_and_paging_options: ~azure.multiapi.sample.models.TestLroAndPagingOptions :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns an iterator like instance of either PagingResult or the result of cls(response) diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py index be8c231b24a..0f679a112b2 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py @@ -143,8 +143,8 @@ def begin_test_lro( :type product: ~azure.multiapi.sample.models.Product :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either Product or the result of cls(response) @@ -256,8 +256,8 @@ def begin_test_lro_and_paging( :type test_lro_and_paging_options: ~azure.multiapi.sample.models.TestLroAndPagingOptions :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns an iterator like instance of either PagingResult or the result of cls(response) diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_metadata.json b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_metadata.json index 762f0b455c4..bf39e335b32 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_metadata.json +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_metadata.json b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_metadata.json index 040954580b9..5907dc23b37 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_metadata.json +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/_multiapi_service_client_enums.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/_multiapi_service_client_enums.py index 0666ddf8a0b..20227bf7255 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/_multiapi_service_client_enums.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/_multiapi_service_client_enums.py @@ -30,7 +30,11 @@ class ContentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Content type for upload """ - APPLICATION_PDF = "application/pdf" #: Content Type 'application/pdf'. - IMAGE_JPEG = "image/jpeg" #: Content Type 'image/jpeg'. - IMAGE_PNG = "image/png" #: Content Type 'image/png'. - IMAGE_TIFF = "image/tiff" #: Content Type 'image/tiff'. + #: Content Type 'application/pdf'. + APPLICATION_PDF = "application/pdf" + #: Content Type 'image/jpeg'. + IMAGE_JPEG = "image/jpeg" + #: Content Type 'image/png'. + IMAGE_PNG = "image/png" + #: Content Type 'image/tiff'. + IMAGE_TIFF = "image/tiff" diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_multiapi_service_client.py index 803c93344bd..0a4d67eed69 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_multiapi_service_client.py @@ -70,7 +70,7 @@ def __init__( self, credential, # type: "TokenCredential" api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url=None, # type: Optional[str] profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py index ff2c491ec30..3a2656fd4d4 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py @@ -94,6 +94,43 @@ def begin_test_lro_and_paging( mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs) + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + greeting_in_french=None, # type: Optional[str] + **kwargs # type: Any + ): + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('test_different_calls') + if api_version == '1.0.0': + from .v1.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '2.0.0': + from .v2.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '3.0.0': + from .v3.operations import MultiapiServiceClientOperationsMixin as OperationClass + else: + raise ValueError("API version {} does not have operation 'test_different_calls'".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._serialize.client_side_validation = False + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.test_different_calls(greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs) + def test_one( self, id, # type: int diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin.py index 9da82b4c68f..33e2d3b621a 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin.py @@ -90,6 +90,43 @@ def begin_test_lro_and_paging( mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs) + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('test_different_calls') + if api_version == '1.0.0': + from ..v1.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '2.0.0': + from ..v2.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '3.0.0': + from ..v3.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + else: + raise ValueError("API version {} does not have operation 'test_different_calls'".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._serialize.client_side_validation = False + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.test_different_calls(greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs) + async def test_one( self, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json index 3399a9712f4..9f96612a882 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -109,6 +151,18 @@ "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id:\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group.\n:type test_lro_and_paging_options: ~multiapi.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncARMPolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns an iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~multiapi.v1.models.PagingResult]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "client_request_id, test_lro_and_paging_options" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py index 3bd2e191904..641fff82f7e 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py @@ -351,3 +351,51 @@ async def internal_get_next(next_link=None): else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py index eec5b2cf81e..4e31fc821a1 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py @@ -360,3 +360,52 @@ def internal_get_next(next_link=None): else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json index d31f059352f..15e7d8d6dc5 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -62,6 +104,18 @@ "doc": "\"\"\"TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo.\n\n:param id: An int parameter.\n:type id: int\n:param message: An optional string parameter.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ModelTwo, or the result of cls(response)\n:rtype: ~multiapi.v2.models.ModelTwo\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "id, message" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english, greeting_in_chinese" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py index 7b58e2d72b6..9cab2e9371c 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py @@ -75,3 +75,56 @@ async def test_one( return deserialized test_one.metadata = {'url': '/multiapi/testOneEndpoint'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py index 0ecd976c20c..1433a3e3e50 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py @@ -80,3 +80,57 @@ def test_one( return deserialized test_one.metadata = {'url': '/multiapi/testOneEndpoint'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json index e14154944b8..83a5d7ceb76 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -62,6 +104,18 @@ "doc": "\"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~multiapi.v3.models.PagingResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n greeting_in_french=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n greeting_in_french: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english, greeting_in_chinese, greeting_in_french" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py index fe2e29297be..030d258ccc0 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py @@ -80,3 +80,61 @@ async def get_next(next_link=None): get_next, extract_data ) test_paging.metadata = {'url': '/multiapi/paging'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "3.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + if greeting_in_french is not None: + header_parameters['greetingInFrench'] = self._serialize.header("greeting_in_french", greeting_in_french, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py index e7cbd128f2a..3d7c604d642 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py @@ -85,3 +85,62 @@ def get_next(next_link=None): get_next, extract_data ) test_paging.metadata = {'url': '/multiapi/paging'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + greeting_in_french=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "3.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + if greeting_in_french is not None: + header_parameters['greetingInFrench'] = self._serialize.header("greeting_in_french", greeting_in_french, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_multiapi_service_client.py index 4ef364bef06..9067086b7bd 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_multiapi_service_client.py @@ -70,7 +70,7 @@ def __init__( self, credential, # type: AzureKeyCredential api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url=None, # type: Optional[str] profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_operations_mixin.py index b0fd55e530b..8d8a03e8476 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_operations_mixin.py @@ -94,6 +94,43 @@ def begin_test_lro_and_paging( mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs) + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + greeting_in_french=None, # type: Optional[str] + **kwargs # type: Any + ): + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('test_different_calls') + if api_version == '1.0.0': + from .v1.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '2.0.0': + from .v2.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '3.0.0': + from .v3.operations import MultiapiServiceClientOperationsMixin as OperationClass + else: + raise ValueError("API version {} does not have operation 'test_different_calls'".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._serialize.client_side_validation = False + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.test_different_calls(greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs) + def test_one( self, id, # type: int diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/aio/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/aio/_operations_mixin.py index 224a66a26a3..13396ccb87d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/aio/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/aio/_operations_mixin.py @@ -90,6 +90,43 @@ def begin_test_lro_and_paging( mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs) + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('test_different_calls') + if api_version == '1.0.0': + from ..v1.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '2.0.0': + from ..v2.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '3.0.0': + from ..v3.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + else: + raise ValueError("API version {} does not have operation 'test_different_calls'".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._serialize.client_side_validation = False + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.test_different_calls(greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs) + async def test_one( self, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_metadata.json index c89ca583608..274d0b7d505 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -109,6 +151,18 @@ "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id:\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group.\n:type test_lro_and_paging_options: ~multiapicredentialdefaultpolicy.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncARMPolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns an iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~multiapicredentialdefaultpolicy.v1.models.PagingResult]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "client_request_id, test_lro_and_paging_options" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py index 128aacb683a..3b9613d4bcb 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py @@ -351,3 +351,51 @@ async def internal_get_next(next_link=None): else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py index d2676255942..589a7f427d6 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py @@ -360,3 +360,52 @@ def internal_get_next(next_link=None): else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_metadata.json index ed3b13a2ddb..a0c37792c6b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -62,6 +104,18 @@ "doc": "\"\"\"TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo.\n\n:param id: An int parameter.\n:type id: int\n:param message: An optional string parameter.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ModelTwo, or the result of cls(response)\n:rtype: ~multiapicredentialdefaultpolicy.v2.models.ModelTwo\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "id, message" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english, greeting_in_chinese" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py index 44adccdbf51..d10ef391baf 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py @@ -75,3 +75,56 @@ async def test_one( return deserialized test_one.metadata = {'url': '/multiapi/testOneEndpoint'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py index a539c5cdd57..332dd5f94de 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py @@ -80,3 +80,57 @@ def test_one( return deserialized test_one.metadata = {'url': '/multiapi/testOneEndpoint'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_metadata.json index 2cf3b3af30d..13b8b57410d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -62,6 +104,18 @@ "doc": "\"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~multiapicredentialdefaultpolicy.v3.models.PagingResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n greeting_in_french=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n greeting_in_french: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english, greeting_in_chinese, greeting_in_french" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py index 22f084ab3ff..483b67993a2 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py @@ -80,3 +80,61 @@ async def get_next(next_link=None): get_next, extract_data ) test_paging.metadata = {'url': '/multiapi/paging'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "3.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + if greeting_in_french is not None: + header_parameters['greetingInFrench'] = self._serialize.header("greeting_in_french", greeting_in_french, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py index 916245a09fc..5ae5ca68fa1 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py @@ -85,3 +85,62 @@ def get_next(next_link=None): get_next, extract_data ) test_paging.metadata = {'url': '/multiapi/paging'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + greeting_in_french=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "3.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + if greeting_in_french is not None: + header_parameters['greetingInFrench'] = self._serialize.header("greeting_in_french", greeting_in_french, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_metadata.json index 53e7a6081cc..60bc8d3394e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_metadata.json @@ -44,7 +44,37 @@ }, "constant": { }, - "call": "credential, endpoint" + "call": "credential, endpoint", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_metadata.json index 84708fa8bf7..9848b1c594c 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_metadata.json @@ -44,7 +44,37 @@ }, "constant": { }, - "call": "credential, endpoint" + "call": "credential, endpoint", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_multiapi_service_client.py index 02b924061b1..4a1f4671cc0 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_multiapi_service_client.py @@ -70,7 +70,7 @@ def __init__( self, credential, # type: "TokenCredential" api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url=None, # type: Optional[str] profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_operations_mixin.py index 47f96a48822..f6f33152dc6 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_operations_mixin.py @@ -93,6 +93,43 @@ def begin_test_lro_and_paging( mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs) + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + greeting_in_french=None, # type: Optional[str] + **kwargs # type: Any + ): + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('test_different_calls') + if api_version == '1.0.0': + from .v1.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '2.0.0': + from .v2.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '3.0.0': + from .v3.operations import MultiapiServiceClientOperationsMixin as OperationClass + else: + raise ValueError("API version {} does not have operation 'test_different_calls'".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._serialize.client_side_validation = False + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.test_different_calls(greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs) + def test_one( self, id, # type: int diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/aio/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/aio/_operations_mixin.py index 3cb36aa06c6..93ec55dad49 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/aio/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/aio/_operations_mixin.py @@ -89,6 +89,43 @@ def begin_test_lro_and_paging( mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs) + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('test_different_calls') + if api_version == '1.0.0': + from ..v1.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '2.0.0': + from ..v2.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '3.0.0': + from ..v3.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + else: + raise ValueError("API version {} does not have operation 'test_different_calls'".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._serialize.client_side_validation = False + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.test_different_calls(greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs) + async def test_one( self, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_metadata.json index cd95e40ecac..00ffc97900e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -109,6 +151,18 @@ "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id:\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group.\n:type test_lro_and_paging_options: ~multiapidataplane.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns an iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~multiapidataplane.v1.models.PagingResult]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "client_request_id, test_lro_and_paging_options" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py index 51ccbc668fc..58adf58feb8 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py @@ -350,3 +350,51 @@ async def internal_get_next(next_link=None): else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py index cd680aa426f..43713bd712e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py @@ -359,3 +359,52 @@ def internal_get_next(next_link=None): else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_metadata.json index f04414efe22..135f8a43c1e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -62,6 +104,18 @@ "doc": "\"\"\"TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo.\n\n:param id: An int parameter.\n:type id: int\n:param message: An optional string parameter.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ModelTwo, or the result of cls(response)\n:rtype: ~multiapidataplane.v2.models.ModelTwo\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "id, message" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english, greeting_in_chinese" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py index b77ff5d5aed..5d3f452e204 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py @@ -74,3 +74,56 @@ async def test_one( return deserialized test_one.metadata = {'url': '/multiapi/testOneEndpoint'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py index 791aeded24e..b96f2b42094 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py @@ -79,3 +79,57 @@ def test_one( return deserialized test_one.metadata = {'url': '/multiapi/testOneEndpoint'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_metadata.json index 960f8674482..218d0d4b6b8 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -62,6 +104,18 @@ "doc": "\"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~multiapidataplane.v3.models.PagingResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n greeting_in_french=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n greeting_in_french: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english, greeting_in_chinese, greeting_in_french" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py index 5f2f9416e62..fee8756eadf 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py @@ -79,3 +79,61 @@ async def get_next(next_link=None): get_next, extract_data ) test_paging.metadata = {'url': '/multiapi/paging'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "3.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + if greeting_in_french is not None: + header_parameters['greetingInFrench'] = self._serialize.header("greeting_in_french", greeting_in_french, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py index 0763ecd9a9a..4e5eaadd522 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py @@ -84,3 +84,62 @@ def get_next(next_link=None): get_next, extract_data ) test_paging.metadata = {'url': '/multiapi/paging'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + greeting_in_french=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "3.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + if greeting_in_french is not None: + header_parameters['greetingInFrench'] = self._serialize.header("greeting_in_french", greeting_in_french, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_multiapi_service_client.py index 32e3361f585..62f41a83d96 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_multiapi_service_client.py @@ -70,7 +70,7 @@ def __init__( self, credential, # type: "TokenCredential" api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url=None, # type: Optional[str] profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py index 07149fe8383..4b944a14624 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py @@ -94,6 +94,43 @@ def begin_test_lro_and_paging( mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs) + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + greeting_in_french=None, # type: Optional[str] + **kwargs # type: Any + ): + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('test_different_calls') + if api_version == '1.0.0': + from .v1.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '2.0.0': + from .v2.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '3.0.0': + from .v3.operations import MultiapiServiceClientOperationsMixin as OperationClass + else: + raise ValueError("API version {} does not have operation 'test_different_calls'".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._serialize.client_side_validation = False + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.test_different_calls(greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs) + def test_one( self, id, # type: int diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json index 52d16bef6b8..c086e21c4a3 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -109,6 +151,18 @@ "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id:\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group.\n:type test_lro_and_paging_options: ~multiapinoasync.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncARMPolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns an iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~multiapinoasync.v1.models.PagingResult]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "client_request_id, test_lro_and_paging_options" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py index 9da2920bb25..c6177935399 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py @@ -360,3 +360,52 @@ def internal_get_next(next_link=None): else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json index a93a254612f..efbb0a241a8 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -62,6 +104,18 @@ "doc": "\"\"\"TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo.\n\n:param id: An int parameter.\n:type id: int\n:param message: An optional string parameter.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ModelTwo, or the result of cls(response)\n:rtype: ~multiapinoasync.v2.models.ModelTwo\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "id, message" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english, greeting_in_chinese" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py index 3183783f827..6479f115fec 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py @@ -80,3 +80,57 @@ def test_one( return deserialized test_one.metadata = {'url': '/multiapi/testOneEndpoint'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json index 4acdf0a48db..c6a3df252ff 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -62,6 +104,18 @@ "doc": "\"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~multiapinoasync.v3.models.PagingResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n greeting_in_french=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n greeting_in_french: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english, greeting_in_chinese, greeting_in_french" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py index 243bee3c3ff..279abe65910 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py @@ -85,3 +85,62 @@ def get_next(next_link=None): get_next, extract_data ) test_paging.metadata = {'url': '/multiapi/paging'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + greeting_in_french=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "3.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + if greeting_in_french is not None: + header_parameters['greetingInFrench'] = self._serialize.header("greeting_in_french", greeting_in_french, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_multiapi_service_client.py index bbd8ad789d1..7c9affa6840 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_multiapi_service_client.py @@ -70,7 +70,7 @@ def __init__( self, credential, # type: "TokenCredential" api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url=None, # type: Optional[str] profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py index 97f46e9809c..8bb7c0fef19 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py @@ -94,6 +94,43 @@ def begin_test_lro_and_paging( mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs) + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + greeting_in_french=None, # type: Optional[str] + **kwargs # type: Any + ): + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('test_different_calls') + if api_version == '1.0.0': + from .v1.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '2.0.0': + from .v2.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '3.0.0': + from .v3.operations import MultiapiServiceClientOperationsMixin as OperationClass + else: + raise ValueError("API version {} does not have operation 'test_different_calls'".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._serialize.client_side_validation = False + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.test_different_calls(greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs) + def test_one( self, id, # type: int diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin.py index 9d7aae038a6..10d89e2f520 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin.py @@ -90,6 +90,43 @@ def begin_test_lro_and_paging( mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) return mixin_instance.begin_test_lro_and_paging(client_request_id, test_lro_and_paging_options, **kwargs) + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('test_different_calls') + if api_version == '1.0.0': + from ..v1.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '2.0.0': + from ..v2.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + elif api_version == '3.0.0': + from ..v3.aio.operations import MultiapiServiceClientOperationsMixin as OperationClass + else: + raise ValueError("API version {} does not have operation 'test_different_calls'".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._serialize.client_side_validation = False + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.test_different_calls(greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs) + async def test_one( self, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json index 542d5542953..fc5abf89788 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -109,6 +151,18 @@ "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id:\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group.\n:type test_lro_and_paging_options: ~multiapiwithsubmodule.submodule.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncARMPolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns an iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[~azure.core.async_paging.AsyncItemPaged[~multiapiwithsubmodule.submodule.v1.models.PagingResult]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "client_request_id, test_lro_and_paging_options" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py index ab7211c4baf..6b1801e76d5 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py @@ -351,3 +351,51 @@ async def internal_get_next(next_link=None): else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py index 4546a5cca03..2d77366f757 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py @@ -360,3 +360,52 @@ def internal_get_next(next_link=None): else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro_and_paging.metadata = {'url': '/multiapi/lroAndPaging'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json index d74b4144718..00281e01554 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -62,6 +104,18 @@ "doc": "\"\"\"TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo.\n\n:param id: An int parameter.\n:type id: int\n:param message: An optional string parameter.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ModelTwo, or the result of cls(response)\n:rtype: ~multiapiwithsubmodule.submodule.v2.models.ModelTwo\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "id, message" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english, greeting_in_chinese" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py index 8dd5d64f0b9..0f45c7c516e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py @@ -75,3 +75,56 @@ async def test_one( return deserialized test_one.metadata = {'url': '/multiapi/testOneEndpoint'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py index 91049ff9180..b1896d7062b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py @@ -80,3 +80,57 @@ def test_one( return deserialized test_one.metadata = {'url': '/multiapi/testOneEndpoint'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json index 86bbc1db040..247ac2647d9 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json @@ -32,7 +32,49 @@ }, "constant": { }, - "call": "credential" + "call": "credential", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, @@ -62,6 +104,18 @@ "doc": "\"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either PagingResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~multiapiwithsubmodule.submodule.v3.models.PagingResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "" + }, + "test_different_calls" : { + "sync": { + "signature": "def test_different_calls(\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n greeting_in_french=None, # type: Optional[str]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def test_different_calls(\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n greeting_in_french: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "greeting_in_english, greeting_in_chinese, greeting_in_french" } } } diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py index 8ea551a3c08..b5de7e881fc 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py @@ -80,3 +80,61 @@ async def get_next(next_link=None): get_next, extract_data ) test_paging.metadata = {'url': '/multiapi/paging'} # type: ignore + + async def test_different_calls( + self, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs + ) -> None: + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "3.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + if greeting_in_french is not None: + header_parameters['greetingInFrench'] = self._serialize.header("greeting_in_french", greeting_in_french, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py index b60d307eb41..3671fda546b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py @@ -85,3 +85,62 @@ def get_next(next_link=None): get_next, extract_data ) test_paging.metadata = {'url': '/multiapi/paging'} # type: ignore + + def test_different_calls( + self, + greeting_in_english, # type: str + greeting_in_chinese=None, # type: Optional[str] + greeting_in_french=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + """Has added parameters across the API versions. + + :param greeting_in_english: pass in 'hello' to pass test. + :type greeting_in_english: str + :param greeting_in_chinese: pass in 'nihao' to pass test. + :type greeting_in_chinese: str + :param greeting_in_french: pass in 'bonjour' to pass test. + :type greeting_in_french: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "3.0.0" + accept = "application/json" + + # Construct URL + url = self.test_different_calls.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['greetingInEnglish'] = self._serialize.header("greeting_in_english", greeting_in_english, 'str') + if greeting_in_chinese is not None: + header_parameters['greetingInChinese'] = self._serialize.header("greeting_in_chinese", greeting_in_chinese, 'str') + if greeting_in_french is not None: + header_parameters['greetingInFrench'] = self._serialize.header("greeting_in_french", greeting_in_french, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.Error, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + test_different_calls.metadata = {'url': '/multiapi/testDifferentCalls'} # type: ignore diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py index a17474ea057..8cf62bb8325 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py @@ -2583,15 +2583,15 @@ async def put_array_valid(self, array_body: Dict[str, List[str]], **kwargs) -> N put_array_valid.metadata = {"url": "/dictionary/array/valid"} # type: ignore @distributed_trace_async - async def get_dictionary_null(self, **kwargs) -> Dict[str, object]: + async def get_dictionary_null(self, **kwargs) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries with value null. :keyword callable cls: A custom type or function that will be passed the direct response - :return: dict mapping str to object, or the result of cls(response) - :rtype: dict[str, object] + :return: dict mapping str to dict mapping str to str, or the result of cls(response) + :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) accept = "application/json" @@ -2615,7 +2615,7 @@ async def get_dictionary_null(self, **kwargs) -> Dict[str, object]: error = self._deserialize(_models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{object}", pipeline_response) + deserialized = self._deserialize("{{str}}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -2625,15 +2625,15 @@ async def get_dictionary_null(self, **kwargs) -> Dict[str, object]: get_dictionary_null.metadata = {"url": "/dictionary/dictionary/null"} # type: ignore @distributed_trace_async - async def get_dictionary_empty(self, **kwargs) -> Dict[str, object]: + async def get_dictionary_empty(self, **kwargs) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {}. :keyword callable cls: A custom type or function that will be passed the direct response - :return: dict mapping str to object, or the result of cls(response) - :rtype: dict[str, object] + :return: dict mapping str to dict mapping str to str, or the result of cls(response) + :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) accept = "application/json" @@ -2657,7 +2657,7 @@ async def get_dictionary_empty(self, **kwargs) -> Dict[str, object]: error = self._deserialize(_models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{object}", pipeline_response) + deserialized = self._deserialize("{{str}}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -2667,16 +2667,16 @@ async def get_dictionary_empty(self, **kwargs) -> Dict[str, object]: get_dictionary_empty.metadata = {"url": "/dictionary/dictionary/empty"} # type: ignore @distributed_trace_async - async def get_dictionary_item_null(self, **kwargs) -> Dict[str, object]: + async def get_dictionary_item_null(self, **kwargs) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": null, "2": {"7": "seven", "8": "eight", "9": "nine"}}. :keyword callable cls: A custom type or function that will be passed the direct response - :return: dict mapping str to object, or the result of cls(response) - :rtype: dict[str, object] + :return: dict mapping str to dict mapping str to str, or the result of cls(response) + :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) accept = "application/json" @@ -2700,7 +2700,7 @@ async def get_dictionary_item_null(self, **kwargs) -> Dict[str, object]: error = self._deserialize(_models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{object}", pipeline_response) + deserialized = self._deserialize("{{str}}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -2710,16 +2710,16 @@ async def get_dictionary_item_null(self, **kwargs) -> Dict[str, object]: get_dictionary_item_null.metadata = {"url": "/dictionary/dictionary/itemnull"} # type: ignore @distributed_trace_async - async def get_dictionary_item_empty(self, **kwargs) -> Dict[str, object]: + async def get_dictionary_item_empty(self, **kwargs) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. :keyword callable cls: A custom type or function that will be passed the direct response - :return: dict mapping str to object, or the result of cls(response) - :rtype: dict[str, object] + :return: dict mapping str to dict mapping str to str, or the result of cls(response) + :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) accept = "application/json" @@ -2743,7 +2743,7 @@ async def get_dictionary_item_empty(self, **kwargs) -> Dict[str, object]: error = self._deserialize(_models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{object}", pipeline_response) + deserialized = self._deserialize("{{str}}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -2753,17 +2753,17 @@ async def get_dictionary_item_empty(self, **kwargs) -> Dict[str, object]: get_dictionary_item_empty.metadata = {"url": "/dictionary/dictionary/itemempty"} # type: ignore @distributed_trace_async - async def get_dictionary_valid(self, **kwargs) -> Dict[str, object]: + async def get_dictionary_valid(self, **kwargs) -> Dict[str, Dict[str, str]]: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. :keyword callable cls: A custom type or function that will be passed the direct response - :return: dict mapping str to object, or the result of cls(response) - :rtype: dict[str, object] + :return: dict mapping str to dict mapping str to str, or the result of cls(response) + :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) accept = "application/json" @@ -2787,7 +2787,7 @@ async def get_dictionary_valid(self, **kwargs) -> Dict[str, object]: error = self._deserialize(_models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{object}", pipeline_response) + deserialized = self._deserialize("{{str}}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -2797,13 +2797,13 @@ async def get_dictionary_valid(self, **kwargs) -> Dict[str, object]: get_dictionary_valid.metadata = {"url": "/dictionary/dictionary/valid"} # type: ignore @distributed_trace_async - async def put_dictionary_valid(self, array_body: Dict[str, object], **kwargs) -> None: + async def put_dictionary_valid(self, array_body: Dict[str, Dict[str, str]], **kwargs) -> None: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. :param array_body: - :type array_body: dict[str, object] + :type array_body: dict[str, dict[str, str]] :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2827,7 +2827,7 @@ async def put_dictionary_valid(self, array_body: Dict[str, object], **kwargs) -> header_parameters["Accept"] = self._serialize.header("accept", accept, "str") body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(array_body, "{object}") + body_content = self._serialize.body(array_body, "{{str}}") body_content_kwargs["content"] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py index e0f89e68ae2..8b45cd26335 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py @@ -2795,15 +2795,15 @@ def put_array_valid( def get_dictionary_null( self, **kwargs # type: Any ): - # type: (...) -> Dict[str, object] + # type: (...) -> Dict[str, Dict[str, str]] """Get an dictionaries of dictionaries with value null. :keyword callable cls: A custom type or function that will be passed the direct response - :return: dict mapping str to object, or the result of cls(response) - :rtype: dict[str, object] + :return: dict mapping str to dict mapping str to str, or the result of cls(response) + :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) accept = "application/json" @@ -2827,7 +2827,7 @@ def get_dictionary_null( error = self._deserialize(_models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{object}", pipeline_response) + deserialized = self._deserialize("{{str}}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -2840,15 +2840,15 @@ def get_dictionary_null( def get_dictionary_empty( self, **kwargs # type: Any ): - # type: (...) -> Dict[str, object] + # type: (...) -> Dict[str, Dict[str, str]] """Get an dictionaries of dictionaries of type with value {}. :keyword callable cls: A custom type or function that will be passed the direct response - :return: dict mapping str to object, or the result of cls(response) - :rtype: dict[str, object] + :return: dict mapping str to dict mapping str to str, or the result of cls(response) + :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) accept = "application/json" @@ -2872,7 +2872,7 @@ def get_dictionary_empty( error = self._deserialize(_models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{object}", pipeline_response) + deserialized = self._deserialize("{{str}}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -2885,16 +2885,16 @@ def get_dictionary_empty( def get_dictionary_item_null( self, **kwargs # type: Any ): - # type: (...) -> Dict[str, object] + # type: (...) -> Dict[str, Dict[str, str]] """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": null, "2": {"7": "seven", "8": "eight", "9": "nine"}}. :keyword callable cls: A custom type or function that will be passed the direct response - :return: dict mapping str to object, or the result of cls(response) - :rtype: dict[str, object] + :return: dict mapping str to dict mapping str to str, or the result of cls(response) + :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) accept = "application/json" @@ -2918,7 +2918,7 @@ def get_dictionary_item_null( error = self._deserialize(_models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{object}", pipeline_response) + deserialized = self._deserialize("{{str}}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -2931,16 +2931,16 @@ def get_dictionary_item_null( def get_dictionary_item_empty( self, **kwargs # type: Any ): - # type: (...) -> Dict[str, object] + # type: (...) -> Dict[str, Dict[str, str]] """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. :keyword callable cls: A custom type or function that will be passed the direct response - :return: dict mapping str to object, or the result of cls(response) - :rtype: dict[str, object] + :return: dict mapping str to dict mapping str to str, or the result of cls(response) + :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) accept = "application/json" @@ -2964,7 +2964,7 @@ def get_dictionary_item_empty( error = self._deserialize(_models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{object}", pipeline_response) + deserialized = self._deserialize("{{str}}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -2977,17 +2977,17 @@ def get_dictionary_item_empty( def get_dictionary_valid( self, **kwargs # type: Any ): - # type: (...) -> Dict[str, object] + # type: (...) -> Dict[str, Dict[str, str]] """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. :keyword callable cls: A custom type or function that will be passed the direct response - :return: dict mapping str to object, or the result of cls(response) - :rtype: dict[str, object] + :return: dict mapping str to dict mapping str to str, or the result of cls(response) + :rtype: dict[str, dict[str, str]] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, object]] + cls = kwargs.pop("cls", None) # type: ClsType[Dict[str, Dict[str, str]]] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) accept = "application/json" @@ -3011,7 +3011,7 @@ def get_dictionary_valid( error = self._deserialize(_models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("{object}", pipeline_response) + deserialized = self._deserialize("{{str}}", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -3023,7 +3023,7 @@ def get_dictionary_valid( @distributed_trace def put_dictionary_valid( self, - array_body, # type: Dict[str, object] + array_body, # type: Dict[str, Dict[str, str]] **kwargs # type: Any ): # type: (...) -> None @@ -3032,7 +3032,7 @@ def put_dictionary_valid( "eight", "9": "nine"}}. :param array_body: - :type array_body: dict[str, object] + :type array_body: dict[str, dict[str, str]] :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -3056,7 +3056,7 @@ def put_dictionary_valid( header_parameters["Accept"] = self._serialize.header("accept", accept, "str") body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(array_body, "{object}") + body_content = self._serialize.body(array_body, "{{str}}") body_content_kwargs["content"] = body_content request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)