diff --git a/.chronus/changes/auto-microsoft-update-root-namespace-2025-2-24-17-7-15.md b/.chronus/changes/auto-microsoft-update-root-namespace-2025-2-24-17-7-15.md new file mode 100644 index 00000000000..9e5e04415f8 --- /dev/null +++ b/.chronus/changes/auto-microsoft-update-root-namespace-2025-2-24-17-7-15.md @@ -0,0 +1,8 @@ +--- +changeKind: feature +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Always respect namespace from TCGC \ No newline at end of file diff --git a/packages/autorest.python/package.json b/packages/autorest.python/package.json index 269c4fc3038..fbf7e093acc 100644 --- a/packages/autorest.python/package.json +++ b/packages/autorest.python/package.json @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/Azure/autorest.python/blob/main/README.md", "dependencies": { - "@typespec/http-client-python": "~0.8.1", + "@typespec/http-client-python": "~0.9.0-dev.1", "@autorest/system-requirements": "~1.0.2", "fs-extra": "~11.2.0", "tsx": "~4.19.1" diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py index 6786a9e747d..e0e86a47f02 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "azure-key-credential-sample" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/samples/specification/basic/generated/setup.py b/packages/autorest.python/samples/specification/basic/generated/setup.py index c8ca6c3bb33..5fe644cdffd 100644 --- a/packages/autorest.python/samples/specification/basic/generated/setup.py +++ b/packages/autorest.python/samples/specification/basic/generated/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "azure-basic-sample" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/samples/specification/directives/generated/setup.py b/packages/autorest.python/samples/specification/directives/generated/setup.py index f570ec897a7..8d902274493 100644 --- a/packages/autorest.python/samples/specification/directives/generated/setup.py +++ b/packages/autorest.python/samples/specification/directives/generated/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "azure-directives-sample" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/samples/specification/management/generated/setup.py b/packages/autorest.python/samples/specification/management/generated/setup.py index cd17a61ba91..f81a912e3a9 100644 --- a/packages/autorest.python/samples/specification/management/generated/setup.py +++ b/packages/autorest.python/samples/specification/management/generated/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "azure-mgmt-sample" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py index 441e3d62760..653729e614a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py index eba8c8bd77c..930f290fd8b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparametergroupingtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py index f19286fa333..46384eecbe4 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestreportserviceforazure" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py index 58451de6e36..f54528d9250 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestazurespecialparameterstestclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py index 0ff8110e540..22004f483ab 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py index 117ffcf6b2d..b7067f8233b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "custompollerpager" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py index 9ba0667f5d2..f2b7f75118f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparameterizedhosttestpagingclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py index a54bffd0e9f..afdaf860d46 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestheadtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py index a7b4392f2b0..71be2c94264 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestheadexceptiontestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py index a54bffd0e9f..afdaf860d46 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestheadtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py index ffa857cbb99..f26b652e808 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestlongrunningoperationtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py index e3b1a606992..8460633cb93 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "lrowithparamaterizedendpoints" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py index 63c81926f5b..257d90f7a5e 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "mixedapiversion" version = "1.0.0b1" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/MANIFEST.in b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/MANIFEST.in index 9bf1e7d2143..b27b04f8573 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/MANIFEST.in +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/MANIFEST.in @@ -4,4 +4,4 @@ include azure/packagemode/batch/py.typed recursive-include tests *.py recursive-include samples *.py *.md include azure/__init__.py -include azure/packagemode/__init__.py \ No newline at end of file +include azure/packagemode/__init__.py diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/MANIFEST.in b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/MANIFEST.in index f35a2d5f0f6..4821ff6342b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/MANIFEST.in +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/MANIFEST.in @@ -4,4 +4,4 @@ include azure/packagemode/dataplane/py.typed recursive-include tests *.py recursive-include samples *.py *.md include azure/__init__.py -include azure/packagemode/__init__.py \ No newline at end of file +include azure/packagemode/__init__.py diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/MANIFEST.in b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/MANIFEST.in index eb2912c3f98..398c6c8cc65 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/MANIFEST.in +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/MANIFEST.in @@ -4,4 +4,4 @@ include azure/package/mode/py.typed recursive-include tests *.py recursive-include samples *.py *.md include azure/__init__.py -include azure/package/__init__.py \ No newline at end of file +include azure/package/__init__.py diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py index 5920bfc3992..275d4f8746d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestpagingtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py index 27aa058cd53..5a8f5ce578d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestsecurityaad" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py index e8875781d77..3c25c8b6d22 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestsecuritykey" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py index c6ea32dace6..32647a8ea2b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "storagemanagementclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py index 52addf5dbf5..74c4f5d7dea 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "microsoftazuretesturl" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py index cca88fbe781..0b48e94577e 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py index 7d785b85b57..d4139cd7a38 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparametergroupingtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py index b6c62804fe8..b4a75e73a2d 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestreportserviceforazure" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py index 2697f1fb0ab..3af5949a7c6 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestazurespecialparameterstestclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py index 88ef6944b5f..ce19f60785a 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py index 7db9c0e09ff..da9be452d90 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "custompollerpagerversiontolerant" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py index 9dabe1d24f4..62a006517f1 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparameterizedhosttestpagingclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py index ea622886989..4964ebea298 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestheadexceptiontestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py index f73cb48104d..f3ab2b6688e 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestheadtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py index 86e99d8ba4e..f3812497628 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py @@ -12,6 +12,8 @@ PACKAGE_NAME = "lropagingversiontolerant" version = "1.0.0b1" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py index 514db224def..e2eb7738bda 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestlongrunningoperationtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py index 861804c70d6..1684b24f331 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "lrowithparamaterizedendpoints" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py index 77234b6b56d..3af7c093472 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestpagingtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py index b3467979e2b..e1e82c1649b 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "storagemanagementclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py index 405131fc562..98aa44b168d 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "microsoftazuretesturl" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py index b187c64f283..f53814b4864 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "dpgcustomizationcustomized" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py index 7cdd55dc669..cd7733e84ec 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "dpgcustomizationinitial" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py index 023eb858c36..48c3211b6ca 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "dpgservicedriveninitial" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py index 120f043bf3e..c9c07fabc07 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "dpgservicedrivenupdateone" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py index 12f0e3cc220..855b519d045 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "dpgtestmodels" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py index 6671109b377..1101f9e8369 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "additionalpropertiesclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py index e41f7d898bb..5d30c96ab4a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py @@ -12,6 +12,8 @@ PACKAGE_NAME = "anythingclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py index 583b02e9771..00711390d22 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatarrayservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py index 583b02e9771..00711390d22 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatarrayservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py index c3e608f2427..c0f7fd236a2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "binarywithcontenttypeapplicationjson" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py index 6c87ebda6fd..44de0762b9f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestbooltestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py index cb0037bdbad..aad1c893a0e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatbyteservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py index 60e4af61fa9..abcb8ee6d21 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "packagename" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py index a1ca38467fd..59d4ad72f1e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestcomplextestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py index a92ceb21961..81f6be58849 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestdatetestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py index b58234b0ae6..cc4c3af04c8 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestdatetimetestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py index 8267e670dde..0dd39e2f714 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestrfc1123datetimetestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py index 850884fef7b..de201d4cf15 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatdictionaryservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py index 441e3d62760..653729e614a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py index 387cd47a705..73ce262cd97 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatfileservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py index f69c4ef402f..183cf81c1dc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatformdataservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py index 7f6e24374ae..77a87faf7a4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "bodyformsdataurlencoded" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py index 0660084af71..d02f0c6503e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestintegertestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py index 430a6a54fb2..d7faa5e1d31 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestnumbertestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py index 387831716ea..5fea53a95a2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py index e0a7e4007fe..05ba1e1f291 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autoresttimetestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py index e40cfb21699..d390a994621 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "clientwithenum" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py index 4a00438195a..ee78a9ec946 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerconstantservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py index 0ff8110e540..22004f483ab 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py index 2e1f5e3b2fb..22a367fcda0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparameterizedcustomhosttestclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py index 6b9c5d6a185..94e0f6e7a56 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "errorwithsecrets" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py index 6988ac816bd..74afdf373f0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "petstoreinc" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py index 61942347121..9a17bfc037a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatheaderservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py index 43c3780f6c9..d8ed1cfdb1a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autoresthttpinfrastructuretestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py index 2b5fdeeeaad..3fbd5643e05 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "incorrectreturnederrormodel" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/MANIFEST.in b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/MANIFEST.in index 0a82b9a90db..ef7385f2c53 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/MANIFEST.in +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/MANIFEST.in @@ -2,4 +2,4 @@ include *.md include LICENSE include internaloperation/py.typed recursive-include tests *.py -recursive-include samples *.py *.md \ No newline at end of file +recursive-include samples *.py *.md diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py index b153e75fe0c..80c34395339 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "mediatypesclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py index 8a5b4b6c374..10e2149d23f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "mergepatchjsonclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py index 7e08548c3ed..458fd036f72 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestresourceflatteningtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py index 31dbf947f9a..f0b7729b56b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "multipleinheritanceserviceclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py index 0ebb700fb34..3fe3c52171a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "nooperationsserviceclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py index 56950a6abc5..8c4784605f1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "nonstringenumsclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py index 876a6d45dd9..d942416be41 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "objecttypeclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/MANIFEST.in b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/MANIFEST.in index 46f6b2959bc..7888b67399a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/MANIFEST.in +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/MANIFEST.in @@ -2,4 +2,4 @@ include *.md include LICENSE include packagemode/py.typed recursive-include tests *.py -recursive-include samples *.py *.md \ No newline at end of file +recursive-include samples *.py *.md diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py index f8f353cb2c6..6ade32429b9 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparameterflattening" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py index 105f8177a73..49973c9db48 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "parmaterizedendpointclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py index 8b5196b0446..50c657b65e5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestreportservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py index 229ebe1c0c0..7c93839e989 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestrequiredoptionaltestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py index 03ee14869d4..fe6808c4ebf 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "reservedwordsclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py index d178b62a467..b82dd13c5a5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestsecurityaad" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py index de06bd58ea5..cfd5df9ed7e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "securityaadswaggercredentialflag" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py index 297abb23fb7..61b66e5ebd4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestsecuritykey" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py index 2d7bcaeecc3..8954ecbf5ba 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "securitykeyswaggercredentialflag" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py index 0c6502e150b..fbe6a2a4c84 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autoresturltestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py index 3263402b1c9..4c37dddb78a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autoresturlmutlicollectionformattestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py index af4bf85fa0b..b9c595d56d5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestvalidationtest" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py index 552eaa045b7..6d8c60926f4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatxmlservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py index 6419d715a81..9c66e595c66 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "xmserrorresponseextensions" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py index bd569a68f73..9b65b921659 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "additionalpropertiesclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py index f06a9d2ede9..b42595e41e6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py @@ -12,6 +12,8 @@ PACKAGE_NAME = "anythingclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py index f0cc24e9820..d89dbaa6ed4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatarrayservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py index 5aac267f912..0f4fe64d504 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "binarywithcontenttypeapplicationjson" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py index 0d92a77a910..ed7c9b9f0f5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestbooltestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py index adc3719bcb8..02eeac214b6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatbyteservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py index 3ed7f5d2a55..d39bbe6c7a4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestcomplextestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py index 473afb2fb32..288b95743b2 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestrfc1123datetimetestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py index 87c051c7dfd..5d0effd6dad 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestdatetimetestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py index aea4ccce715..c2abaefcd12 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestdatetestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py index b027672bef4..362ddfc976f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatdictionaryservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py index cca88fbe781..0b48e94577e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py index ef14216fecf..b90888698b2 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatfileservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py index 3b4f72a503d..7ce1a4e540f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatformdataservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py index 384e3fe945c..e4361857ad7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "bodyformsdataurlencoded" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py index a7f0f977249..3c5c2054878 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestintegertestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py index 2829f296b86..7499a11a17c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestnumbertestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py index 525eeff1ef7..4137f6dc0f1 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py index 26e2f7026ae..a24232f172c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autoresttimetestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py index e3b44f60c21..2b088c2ed6c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "clientwithenum" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py index e2606285fcf..aeb55d9bab3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerconstantservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py index 513fd821095..950c93bde6f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparameterizedcustomhosttestclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py index 88ef6944b5f..ce19f60785a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py index 0b9b7736354..db3e586880c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "errorwithsecrets" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py index 32559b03bc6..80eed7d2130 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "petstoreinc" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py index 48a1b21276d..ce1d58eda56 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatheaderservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py index b485220c578..0b3eb23d89b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autoresthttpinfrastructuretestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py index ff8f4db03cf..95f2da98970 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "incorrectreturnederrormodel" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py index 239ecc92a0b..869749bcb27 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "mediatypesclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py index f46dd4186f2..83b2c4c83b7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "mergepatchjsonclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py index 8a3d295fef5..9a1cbdb117d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestresourceflatteningtestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py index 5e62651f194..46d4604799e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "multipleinheritanceserviceclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py index ae60df4bd12..9664313a7a3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py @@ -12,6 +12,8 @@ PACKAGE_NAME = "nonamespaceflag" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py index b3c6309d0a4..772f56735b3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "nooperationsserviceclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py index 84281a7cc40..19dc0f2e76a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "nonstringenumsclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py index 0bb595b434d..a5eeb94f9c3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "objecttypeclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py index 3392ff212c5..d8005e12ca8 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestparameterflattening" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py index 628deb35f60..d3f6d58d3ff 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "parmaterizedendpointclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py index 8a77a321b01..3650da12d0d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestreportservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py index 0e1f19cd83c..5d35a52c686 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestrequiredoptionaltestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py index d62285225d7..b326ebd2b8f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "reservedwordsclient" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py index e8ba4995ab2..716dd5a6464 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestsecurityaad" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py index dd75e96a997..ccda2f6a4db 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestsecuritykey" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py index 84c437caa76..68107ff06d2 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autoresturlmutlicollectionformattestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py index d78ad3d05bd..469275ab8be 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autoresturltestservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py index e1ba5c6a8d8..525e6884ee0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestvalidationtest" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py index a57a714208c..a3a6fb55ebe 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "autorestswaggerbatxmlservice" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py index c0688ebdecd..ec653b77580 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py @@ -11,6 +11,8 @@ PACKAGE_NAME = "xmserrorresponseextensions" version = "0.1.0" + + setup( name=PACKAGE_NAME, version=version, diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index ea0762d84f8..71caf5fd160 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -54,13 +54,13 @@ "@azure-tools/typespec-azure-resource-manager": ">=0.53.0 <1.0.0", "@azure-tools/typespec-autorest": ">=0.53.0 <1.0.0", "@azure-tools/typespec-azure-rulesets": ">=0.53.0 <3.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.53.0 <1.0.0" + "@azure-tools/typespec-client-generator-core": ">=0.53.1 <1.0.0" }, "dependencies": { "js-yaml": "~4.1.0", "semver": "~7.6.2", "tsx": "~4.19.1", - "@typespec/http-client-python": "~0.8.1", + "@typespec/http-client-python": "~0.9.0-dev.1", "fs-extra": "~11.2.0" }, "devDependencies": { @@ -73,7 +73,7 @@ "@azure-tools/typespec-azure-core": "~0.53.0", "@azure-tools/typespec-azure-rulesets": "~0.53.0", "@azure-tools/typespec-autorest": "~0.53.0", - "@azure-tools/typespec-client-generator-core": "~0.53.0", + "@azure-tools/typespec-client-generator-core": "~0.53.1", "@azure-tools/azure-http-specs": "0.1.0-alpha.10", "@typespec/http-specs": "0.1.0-alpha.15-dev.3", "@types/js-yaml": "~4.0.5", diff --git a/packages/typespec-python/scripts/eng/regenerate.ts b/packages/typespec-python/scripts/eng/regenerate.ts index 677578c9139..e56cb6906d2 100644 --- a/packages/typespec-python/scripts/eng/regenerate.ts +++ b/packages/typespec-python/scripts/eng/regenerate.ts @@ -19,94 +19,185 @@ interface TspCommand { command: string; } +const AZURE_EMITTER_OPTIONS: Record | Record[]> = { + "azure/example/basic": { + namespace: "specs.azure.example.basic", + }, + "azure/client-generator-core/access": { + namespace: "specs.azure.clientgenerator.core.access", + }, + "azure/client-generator-core/usage": { + namespace: "specs.azure.clientgenerator.core.usage", + }, + "azure/core/lro/rpc": { + "package-name": "azurecore-lro-rpc", + "namespace": "azurecore.lro.rpc", + }, + "client/structure/default": { + namespace: "client.structure.service", + }, + "client/structure/multi-client": { + "package-name": "client-structure-multiclient", + "namespace": "client.structure.multiclient", + }, + "client/structure/renamed-operation": { + "package-name": "client-structure-renamedoperation", + "namespace": "client.structure.renamedoperation", + }, + "client/structure/two-operation-group": { + "package-name": "client-structure-twooperationgroup", + "namespace": "client.structure.twooperationgroup", + }, + "client/naming": { + namespace: "client.naming", + }, + "encode/duration": { + namespace: "encode.duration", + }, + "encode/numeric": { + namespace: "encode.numeric", + }, + "parameters/basic": { + namespace: "parameters.basic", + }, + "parameters/spread": { + namespace: "parameters.spread", + }, + "payload/content-negotiation": { + namespace: "payload.contentnegotiation", + }, + "payload/multipart": { + namespace: "payload.multipart", + }, + "serialization/encoded-name/json": { + namespace: "serialization.encodedname.json", + }, + "special-words": { + namespace: "specialwords", + }, +}; + const EMITTER_OPTIONS: Record | Record[]> = { "resiliency/srv-driven/old.tsp": { "package-name": "resiliency-srv-driven1", + "namespace": "resiliency.srv.driven1", "package-mode": "azure-dataplane", "package-pprint-name": "ResiliencySrvDriven1", }, "resiliency/srv-driven": { "package-name": "resiliency-srv-driven2", + "namespace": "resiliency.srv.driven2", "package-mode": "azure-dataplane", "package-pprint-name": "ResiliencySrvDriven2", }, "authentication/http/custom": { "package-name": "authentication-http-custom", - "package-pprint-name": "Authentication Http Custom Service", + "namespace": "authentication.http.custom", + "package-pprint-name": "Authentication Http Custom", }, "authentication/union": { "package-name": "authentication-union", + "namespace": "authentication.union", }, "type/array": { "package-name": "typetest-array", + "namespace": "typetest.array", }, "type/dictionary": { "package-name": "typetest-dictionary", + "namespace": "typetest.dictionary", }, "type/enum/extensible": { "package-name": "typetest-enum-extensible", + "namespace": "typetest.enum.extensible", }, "type/enum/fixed": { "package-name": "typetest-enum-fixed", + "namespace": "typetest.enum.fixed", }, "type/model/empty": { "package-name": "typetest-model-empty", + "namespace": "typetest.model.empty", }, "type/model/inheritance/enum-discriminator": { "package-name": "typetest-model-enumdiscriminator", + "namespace": "typetest.model.enumdiscriminator", }, "type/model/inheritance/nested-discriminator": { "package-name": "typetest-model-nesteddiscriminator", + "namespace": "typetest.model.nesteddiscriminator", }, "type/model/inheritance/not-discriminated": { "package-name": "typetest-model-notdiscriminated", + "namespace": "typetest.model.notdiscriminated", }, "type/model/inheritance/single-discriminator": { "package-name": "typetest-model-singlediscriminator", + "namespace": "typetest.model.singlediscriminator", }, "type/model/inheritance/recursive": { "package-name": "typetest-model-recursive", + "namespace": "typetest.model.recursive", }, "type/model/usage": { "package-name": "typetest-model-usage", + "namespace": "typetest.model.usage", }, "type/model/visibility": [ - { "package-name": "typetest-model-visibility" }, - { "package-name": "headasbooleantrue", "head-as-boolean": "true" }, - { "package-name": "headasbooleanfalse", "head-as-boolean": "false" }, + { + "package-name": "typetest-model-visibility", + "namespace": "typetest.model.visibility", + }, + { + "package-name": "headasbooleantrue", + "namespace": "headasbooleantrue", + "head-as-boolean": "true", + }, + { + "package-name": "headasbooleanfalse", + "namespace": "headasbooleanfalse", + "head-as-boolean": "false", + }, ], "type/property/nullable": { "package-name": "typetest-property-nullable", + "namespace": "typetest.property.nullable", }, "type/property/optionality": { "package-name": "typetest-property-optional", + "namespace": "typetest.property.optional", }, "type/property/additional-properties": { "package-name": "typetest-property-additionalproperties", + "namespace": "typetest.property.additionalproperties", }, "type/scalar": { "package-name": "typetest-scalar", + "namespace": "typetest.scalar", }, "type/property/value-types": { "package-name": "typetest-property-valuetypes", + "namespace": "typetest.property.valuetypes", }, "type/union": { "package-name": "typetest-union", + "namespace": "typetest.union", }, "azure/core/lro/rpc": { "package-name": "azurecore-lro-rpc", + "namespace": "azurecore.lro.rpc", }, "client/structure/multi-client": { "package-name": "client-structure-multiclient", + "namespace": "client.structure.multiclient", }, "client/structure/renamed-operation": { "package-name": "client-structure-renamedoperation", + "namespace": "client.structure.renamedoperation", }, "client/structure/two-operation-group": { "package-name": "client-structure-twooperationgroup", - }, - "client/namespace": { - "enable-typespec-namespace": "true", + "namespace": "client.structure.twooperationgroup", }, }; @@ -118,7 +209,7 @@ function getEmitterOption(spec: string, flavor: string): Record[ const specDir = spec.includes("azure") ? AZURE_HTTP_SPECS : HTTP_SPECS; const relativeSpec = toPosix(relative(specDir, spec)); const key = relativeSpec.includes("resiliency/srv-driven/old.tsp") ? relativeSpec : dirname(relativeSpec); - const emitter_options = EMITTER_OPTIONS[key] || [{}]; + const emitter_options = EMITTER_OPTIONS[key] || (flavor === "azure" ? AZURE_EMITTER_OPTIONS[key] : [{}]) || [{}]; const result = Array.isArray(emitter_options) ? emitter_options : [emitter_options]; function updateOptions(options: Record): void { diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/MANIFEST.in b/packages/typespec-python/test/azure/generated/authentication-api-key/MANIFEST.in index 84258db3b15..805328d742a 100644 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/authentication-api-key/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include authentication/apikey/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include authentication/__init__.py \ No newline at end of file +include authentication/__init__.py diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/README.md b/packages/typespec-python/test/azure/generated/authentication-api-key/README.md index 3fb13d287de..97cda271782 100644 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/README.md +++ b/packages/typespec-python/test/azure/generated/authentication-api-key/README.md @@ -1,5 +1,3 @@ - - # Authentication Apikey client library for Python @@ -17,6 +15,7 @@ python -m pip install authentication-apikey - You need an [Azure subscription][azure_sub] to use this package. - An existing Authentication Apikey instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/MANIFEST.in b/packages/typespec-python/test/azure/generated/authentication-http-custom/MANIFEST.in index b61198cfa7f..6f9c2254b26 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/MANIFEST.in @@ -4,4 +4,4 @@ include authentication/http/custom/py.typed recursive-include tests *.py recursive-include samples *.py *.md include authentication/__init__.py -include authentication/http/__init__.py \ No newline at end of file +include authentication/http/__init__.py diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/README.md b/packages/typespec-python/test/azure/generated/authentication-http-custom/README.md index 293fb16a01f..f6c6d0c5fef 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/README.md +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/README.md @@ -1,6 +1,4 @@ - - -# Authentication Http Custom Service client library for Python +# Authentication Http Custom client library for Python ## Getting started @@ -15,7 +13,8 @@ python -m pip install authentication-http-custom - Python 3.8 or later is required to use this package. - You need an [Azure subscription][azure_sub] to use this package. -- An existing Authentication Http Custom Service instance. +- An existing Authentication Http Custom instance. + ## Contributing @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/setup.py b/packages/typespec-python/test/azure/generated/authentication-http-custom/setup.py index 4fab1b452fb..759dbb04636 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/setup.py +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/setup.py @@ -13,7 +13,7 @@ PACKAGE_NAME = "authentication-http-custom" -PACKAGE_PPRINT_NAME = "Authentication Http Custom Service" +PACKAGE_PPRINT_NAME = "Authentication Http Custom" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace("-", "/") diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/MANIFEST.in b/packages/typespec-python/test/azure/generated/authentication-oauth2/MANIFEST.in index 9c73f66d6b1..9bb1ed4315f 100644 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/authentication-oauth2/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include authentication/oauth2/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include authentication/__init__.py \ No newline at end of file +include authentication/__init__.py diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/README.md b/packages/typespec-python/test/azure/generated/authentication-oauth2/README.md index fb30f67510c..46850484b4a 100644 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/README.md +++ b/packages/typespec-python/test/azure/generated/authentication-oauth2/README.md @@ -1,5 +1,3 @@ - - # Authentication Oauth2 client library for Python @@ -16,6 +14,7 @@ python -m pip install authentication-oauth2 - Python 3.8 or later is required to use this package. - You need an [Azure subscription][azure_sub] to use this package. - An existing Authentication Oauth2 instance. + #### Create with an Azure Active Directory Credential To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], provide an instance of the desired credential type obtained from the @@ -77,4 +76,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/authentication-union/MANIFEST.in b/packages/typespec-python/test/azure/generated/authentication-union/MANIFEST.in index 83649fb608a..a8e19db2766 100644 --- a/packages/typespec-python/test/azure/generated/authentication-union/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/authentication-union/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include authentication/union/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include authentication/__init__.py \ No newline at end of file +include authentication/__init__.py diff --git a/packages/typespec-python/test/azure/generated/authentication-union/README.md b/packages/typespec-python/test/azure/generated/authentication-union/README.md index 3e07ec9cd59..674d710c3fa 100644 --- a/packages/typespec-python/test/azure/generated/authentication-union/README.md +++ b/packages/typespec-python/test/azure/generated/authentication-union/README.md @@ -1,5 +1,3 @@ - - # Authentication Union client library for Python @@ -17,6 +15,7 @@ python -m pip install authentication-union - You need an [Azure subscription][azure_sub] to use this package. - An existing Authentication Union instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/MANIFEST.in index dca3d6574ff..7c79aa9f273 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/MANIFEST.in @@ -6,4 +6,4 @@ recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py include specs/azure/clientgenerator/__init__.py -include specs/azure/clientgenerator/core/__init__.py \ No newline at end of file +include specs/azure/clientgenerator/core/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/README.md b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/README.md index 70d89528117..2fc5bbd2b9f 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/README.md +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Clientgenerator Core Access client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-clientgenerator-core-access - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Clientgenerator Core Access instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten-property/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten-property/MANIFEST.in index 4d1bfd40f79..483cd2ac3e0 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten-property/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten-property/MANIFEST.in @@ -6,4 +6,4 @@ recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py include specs/azure/clientgenerator/__init__.py -include specs/azure/clientgenerator/core/__init__.py \ No newline at end of file +include specs/azure/clientgenerator/core/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten-property/README.md b/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten-property/README.md index 3174317b475..5f983d2f26e 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten-property/README.md +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten-property/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Clientgenerator Core Flattenproperty client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-clientgenerator-core-flattenproperty - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Clientgenerator Core Flattenproperty instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/MANIFEST.in index 16f4ad95a3f..a9f8e33e3c5 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/MANIFEST.in @@ -6,4 +6,4 @@ recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py include specs/azure/clientgenerator/__init__.py -include specs/azure/clientgenerator/core/__init__.py \ No newline at end of file +include specs/azure/clientgenerator/core/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/README.md b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/README.md index c211c3e8f86..16fe3886401 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/README.md +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Clientgenerator Core Usage client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-clientgenerator-core-usage - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Clientgenerator Core Usage instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-core-basic/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-core-basic/MANIFEST.in index 4e049874b25..97c68dbc2c6 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-basic/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-core-basic/MANIFEST.in @@ -5,4 +5,4 @@ recursive-include tests *.py recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py -include specs/azure/core/__init__.py \ No newline at end of file +include specs/azure/core/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-core-basic/README.md b/packages/typespec-python/test/azure/generated/azure-core-basic/README.md index 1feab0c61bd..3f713ddc99e 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-basic/README.md +++ b/packages/typespec-python/test/azure/generated/azure-core-basic/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Core Basic client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-core-basic - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Core Basic instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/MANIFEST.in index d504b28b9ed..c17ad5a4013 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/MANIFEST.in @@ -6,4 +6,4 @@ recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py include specs/azure/core/__init__.py -include specs/azure/core/lro/__init__.py \ No newline at end of file +include specs/azure/core/lro/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/README.md b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/README.md index 661ab3f6f2b..3bdc77038ff 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/README.md +++ b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Core Lro Standard client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-core-lro-standard - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Core Lro Standard instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-core-model/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-core-model/MANIFEST.in index a4fb967a0c4..0020facc5ec 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-model/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-core-model/MANIFEST.in @@ -5,4 +5,4 @@ recursive-include tests *.py recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py -include specs/azure/core/__init__.py \ No newline at end of file +include specs/azure/core/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-core-model/README.md b/packages/typespec-python/test/azure/generated/azure-core-model/README.md index 20dd98320a7..eeefc6a47f9 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-model/README.md +++ b/packages/typespec-python/test/azure/generated/azure-core-model/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Core Model client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-core-model - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Core Model instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-core-page/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-core-page/MANIFEST.in index 76928ba51d9..8e8c1848412 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-page/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-core-page/MANIFEST.in @@ -5,4 +5,4 @@ recursive-include tests *.py recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py -include specs/azure/core/__init__.py \ No newline at end of file +include specs/azure/core/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-core-page/README.md b/packages/typespec-python/test/azure/generated/azure-core-page/README.md index a37788ef567..ce2d6724321 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-page/README.md +++ b/packages/typespec-python/test/azure/generated/azure-core-page/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Core Page client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-core-page - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Core Page instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-core-scalar/MANIFEST.in index 49876ec2108..295f0550778 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-scalar/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/MANIFEST.in @@ -5,4 +5,4 @@ recursive-include tests *.py recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py -include specs/azure/core/__init__.py \ No newline at end of file +include specs/azure/core/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/README.md b/packages/typespec-python/test/azure/generated/azure-core-scalar/README.md index 47715611192..301847f06bd 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-scalar/README.md +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Core Scalar client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-core-scalar - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Core Scalar instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-core-traits/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-core-traits/MANIFEST.in index c4559c2de10..52c9896c808 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-traits/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-core-traits/MANIFEST.in @@ -5,4 +5,4 @@ recursive-include tests *.py recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py -include specs/azure/core/__init__.py \ No newline at end of file +include specs/azure/core/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-core-traits/README.md b/packages/typespec-python/test/azure/generated/azure-core-traits/README.md index 99e19bc29f4..da7436fed5d 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-traits/README.md +++ b/packages/typespec-python/test/azure/generated/azure-core-traits/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Core Traits client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-core-traits - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Core Traits instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-encode-duration/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-encode-duration/MANIFEST.in index d3512263cc7..863d0757e13 100644 --- a/packages/typespec-python/test/azure/generated/azure-encode-duration/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-encode-duration/MANIFEST.in @@ -5,4 +5,4 @@ recursive-include tests *.py recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py -include specs/azure/encode/__init__.py \ No newline at end of file +include specs/azure/encode/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-encode-duration/README.md b/packages/typespec-python/test/azure/generated/azure-encode-duration/README.md index 59b9ef07693..fd039aca147 100644 --- a/packages/typespec-python/test/azure/generated/azure-encode-duration/README.md +++ b/packages/typespec-python/test/azure/generated/azure-encode-duration/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Encode Duration client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-encode-duration - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Encode Duration instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-example-basic/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-example-basic/MANIFEST.in index 8c010cbe4ea..e0a4f8f51dd 100644 --- a/packages/typespec-python/test/azure/generated/azure-example-basic/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-example-basic/MANIFEST.in @@ -5,4 +5,4 @@ recursive-include tests *.py recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py -include specs/azure/example/__init__.py \ No newline at end of file +include specs/azure/example/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-example-basic/README.md b/packages/typespec-python/test/azure/generated/azure-example-basic/README.md index aac41c59d3c..b3b60b80069 100644 --- a/packages/typespec-python/test/azure/generated/azure-example-basic/README.md +++ b/packages/typespec-python/test/azure/generated/azure-example-basic/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Example Basic client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-example-basic - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Example Basic instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-payload-pageable/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-payload-pageable/MANIFEST.in index 839bc06fb1e..fd0f30e0133 100644 --- a/packages/typespec-python/test/azure/generated/azure-payload-pageable/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-payload-pageable/MANIFEST.in @@ -5,4 +5,4 @@ recursive-include tests *.py recursive-include samples *.py *.md include specs/__init__.py include specs/azure/__init__.py -include specs/azure/payload/__init__.py \ No newline at end of file +include specs/azure/payload/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-payload-pageable/README.md b/packages/typespec-python/test/azure/generated/azure-payload-pageable/README.md index 437f7dbef6f..57255e1503f 100644 --- a/packages/typespec-python/test/azure/generated/azure-payload-pageable/README.md +++ b/packages/typespec-python/test/azure/generated/azure-payload-pageable/README.md @@ -1,5 +1,3 @@ - - # Specs Azure Payload Pageable client library for Python @@ -17,6 +15,7 @@ python -m pip install specs-azure-payload-pageable - You need an [Azure subscription][azure_sub] to use this package. - An existing Specs Azure Payload Pageable instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-resource-manager-common-properties/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-resource-manager-common-properties/MANIFEST.in index a0f57f8f826..7a746f67c5c 100644 --- a/packages/typespec-python/test/azure/generated/azure-resource-manager-common-properties/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-resource-manager-common-properties/MANIFEST.in @@ -4,4 +4,4 @@ include azure/resourcemanager/commonproperties/py.typed recursive-include tests *.py recursive-include samples *.py *.md include azure/__init__.py -include azure/resourcemanager/__init__.py \ No newline at end of file +include azure/resourcemanager/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-resource-manager-common-properties/README.md b/packages/typespec-python/test/azure/generated/azure-resource-manager-common-properties/README.md index e4ab35d16ca..48cc6bca302 100644 --- a/packages/typespec-python/test/azure/generated/azure-resource-manager-common-properties/README.md +++ b/packages/typespec-python/test/azure/generated/azure-resource-manager-common-properties/README.md @@ -1,5 +1,3 @@ - - # Azure Resourcemanager Commonproperties client library for Python @@ -16,6 +14,7 @@ python -m pip install azure-resourcemanager-commonproperties - Python 3.8 or later is required to use this package. - You need an [Azure subscription][azure_sub] to use this package. - An existing Azure Resourcemanager Commonproperties instance. + #### Create with an Azure Active Directory Credential To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], provide an instance of the desired credential type obtained from the @@ -77,4 +76,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/MANIFEST.in index 2927e9da325..07365352828 100644 --- a/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/MANIFEST.in @@ -4,4 +4,4 @@ include azure/resourcemanager/operationtemplates/py.typed recursive-include tests *.py recursive-include samples *.py *.md include azure/__init__.py -include azure/resourcemanager/__init__.py \ No newline at end of file +include azure/resourcemanager/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/README.md b/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/README.md index 809efaf9315..53bcfc7c7df 100644 --- a/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/README.md +++ b/packages/typespec-python/test/azure/generated/azure-resource-manager-operation-templates/README.md @@ -1,5 +1,3 @@ - - # Azure Resourcemanager Operationtemplates client library for Python @@ -16,6 +14,7 @@ python -m pip install azure-resourcemanager-operationtemplates - Python 3.8 or later is required to use this package. - You need an [Azure subscription][azure_sub] to use this package. - An existing Azure Resourcemanager Operationtemplates instance. + #### Create with an Azure Active Directory Credential To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], provide an instance of the desired credential type obtained from the @@ -77,4 +76,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-resource-manager-resources/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-resource-manager-resources/MANIFEST.in index e21224becd5..cf76444d775 100644 --- a/packages/typespec-python/test/azure/generated/azure-resource-manager-resources/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-resource-manager-resources/MANIFEST.in @@ -4,4 +4,4 @@ include azure/resourcemanager/resources/py.typed recursive-include tests *.py recursive-include samples *.py *.md include azure/__init__.py -include azure/resourcemanager/__init__.py \ No newline at end of file +include azure/resourcemanager/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-resource-manager-resources/README.md b/packages/typespec-python/test/azure/generated/azure-resource-manager-resources/README.md index cd5ed676609..3da3b9e6961 100644 --- a/packages/typespec-python/test/azure/generated/azure-resource-manager-resources/README.md +++ b/packages/typespec-python/test/azure/generated/azure-resource-manager-resources/README.md @@ -1,5 +1,3 @@ - - # Azure Resourcemanager Resources client library for Python @@ -16,6 +14,7 @@ python -m pip install azure-resourcemanager-resources - Python 3.8 or later is required to use this package. - You need an [Azure subscription][azure_sub] to use this package. - An existing Azure Resourcemanager Resources instance. + #### Create with an Azure Active Directory Credential To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], provide an instance of the desired credential type obtained from the @@ -77,4 +76,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/MANIFEST.in index beed8344015..27df710116d 100644 --- a/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/MANIFEST.in @@ -4,4 +4,4 @@ include azure/specialheaders/xmsclientrequestid/py.typed recursive-include tests *.py recursive-include samples *.py *.md include azure/__init__.py -include azure/specialheaders/__init__.py \ No newline at end of file +include azure/specialheaders/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/README.md b/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/README.md index 9043e7ec7da..f9d2ce6b04f 100644 --- a/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/README.md +++ b/packages/typespec-python/test/azure/generated/azure-special-headers-client-request-id/README.md @@ -1,5 +1,3 @@ - - # Azure Specialheaders Xmsclientrequestid client library for Python @@ -17,6 +15,7 @@ python -m pip install azure-specialheaders-xmsclientrequestid - You need an [Azure subscription][azure_sub] to use this package. - An existing Azure Specialheaders Xmsclientrequestid instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/MANIFEST.in b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/MANIFEST.in index 22469ecc129..0e0b6259b7f 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/MANIFEST.in @@ -4,4 +4,4 @@ include azurecore/lro/rpc/py.typed recursive-include tests *.py recursive-include samples *.py *.md include azurecore/__init__.py -include azurecore/lro/__init__.py \ No newline at end of file +include azurecore/lro/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/README.md b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/README.md index 05cd95edd34..b3fbc9ac0b1 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/README.md +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/README.md @@ -1,5 +1,3 @@ - - # Azurecore Lro Rpc client library for Python @@ -17,6 +15,7 @@ python -m pip install azurecore-lro-rpc - You need an [Azure subscription][azure_sub] to use this package. - An existing Azurecore Lro Rpc instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/client-namespace/MANIFEST.in b/packages/typespec-python/test/azure/generated/client-namespace/MANIFEST.in index 276d7d1b1dd..381b472228a 100644 --- a/packages/typespec-python/test/azure/generated/client-namespace/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/client-namespace/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include client/clientnamespace/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include client/__init__.py \ No newline at end of file +include client/__init__.py diff --git a/packages/typespec-python/test/azure/generated/client-namespace/README.md b/packages/typespec-python/test/azure/generated/client-namespace/README.md index ead84bb0c3f..ae107e7adb9 100644 --- a/packages/typespec-python/test/azure/generated/client-namespace/README.md +++ b/packages/typespec-python/test/azure/generated/client-namespace/README.md @@ -1,5 +1,3 @@ - - # Client Clientnamespace client library for Python @@ -17,6 +15,7 @@ python -m pip install client-clientnamespace - You need an [Azure subscription][azure_sub] to use this package. - An existing Client Clientnamespace instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/client-naming/MANIFEST.in b/packages/typespec-python/test/azure/generated/client-naming/MANIFEST.in index aa54588bce0..bd52233e27f 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/client-naming/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include client/naming/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include client/__init__.py \ No newline at end of file +include client/__init__.py diff --git a/packages/typespec-python/test/azure/generated/client-naming/README.md b/packages/typespec-python/test/azure/generated/client-naming/README.md index 622cac7dd9f..a8d74fedab6 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/README.md +++ b/packages/typespec-python/test/azure/generated/client-naming/README.md @@ -1,5 +1,3 @@ - - # Client Naming client library for Python @@ -17,6 +15,7 @@ python -m pip install client-naming - You need an [Azure subscription][azure_sub] to use this package. - An existing Client Naming instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/client-structure-default/MANIFEST.in b/packages/typespec-python/test/azure/generated/client-structure-default/MANIFEST.in index 934e192d9bd..11fe6edde9b 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-default/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/client-structure-default/MANIFEST.in @@ -4,4 +4,4 @@ include client/structure/service/py.typed recursive-include tests *.py recursive-include samples *.py *.md include client/__init__.py -include client/structure/__init__.py \ No newline at end of file +include client/structure/__init__.py diff --git a/packages/typespec-python/test/azure/generated/client-structure-default/README.md b/packages/typespec-python/test/azure/generated/client-structure-default/README.md index 6779c61e802..7a4af6bd987 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-default/README.md +++ b/packages/typespec-python/test/azure/generated/client-structure-default/README.md @@ -1,5 +1,3 @@ - - # Client Structure Service client library for Python @@ -17,6 +15,7 @@ python -m pip install client-structure-service - You need an [Azure subscription][azure_sub] to use this package. - An existing Client Structure Service instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/client-structure-multiclient/MANIFEST.in b/packages/typespec-python/test/azure/generated/client-structure-multiclient/MANIFEST.in index 4bb00a0079d..66f32f4018a 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-multiclient/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/client-structure-multiclient/MANIFEST.in @@ -4,4 +4,4 @@ include client/structure/multiclient/py.typed recursive-include tests *.py recursive-include samples *.py *.md include client/__init__.py -include client/structure/__init__.py \ No newline at end of file +include client/structure/__init__.py diff --git a/packages/typespec-python/test/azure/generated/client-structure-multiclient/README.md b/packages/typespec-python/test/azure/generated/client-structure-multiclient/README.md index 035a5f541c0..52ef7204406 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-multiclient/README.md +++ b/packages/typespec-python/test/azure/generated/client-structure-multiclient/README.md @@ -1,5 +1,3 @@ - - # Client Structure Multiclient client library for Python @@ -17,6 +15,7 @@ python -m pip install client-structure-multiclient - You need an [Azure subscription][azure_sub] to use this package. - An existing Client Structure Multiclient instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/MANIFEST.in b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/MANIFEST.in index 3a4391bd1d3..a4594a808a8 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/MANIFEST.in @@ -4,4 +4,4 @@ include client/structure/renamedoperation/py.typed recursive-include tests *.py recursive-include samples *.py *.md include client/__init__.py -include client/structure/__init__.py \ No newline at end of file +include client/structure/__init__.py diff --git a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/README.md b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/README.md index ed5e29b0a6a..9f59c5cd008 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/README.md +++ b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/README.md @@ -1,5 +1,3 @@ - - # Client Structure Renamedoperation client library for Python @@ -17,6 +15,7 @@ python -m pip install client-structure-renamedoperation - You need an [Azure subscription][azure_sub] to use this package. - An existing Client Structure Renamedoperation instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/MANIFEST.in b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/MANIFEST.in index 9c5717d6a5d..9d712ef0e08 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/MANIFEST.in @@ -4,4 +4,4 @@ include client/structure/twooperationgroup/py.typed recursive-include tests *.py recursive-include samples *.py *.md include client/__init__.py -include client/structure/__init__.py \ No newline at end of file +include client/structure/__init__.py diff --git a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/README.md b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/README.md index f721cf35cf3..48a8a6e43b4 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/README.md +++ b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/README.md @@ -1,5 +1,3 @@ - - # Client Structure Twooperationgroup client library for Python @@ -17,6 +15,7 @@ python -m pip install client-structure-twooperationgroup - You need an [Azure subscription][azure_sub] to use this package. - An existing Client Structure Twooperationgroup instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/MANIFEST.in b/packages/typespec-python/test/azure/generated/encode-bytes/MANIFEST.in index 75b3ca6eac0..8b0e3efbc6c 100644 --- a/packages/typespec-python/test/azure/generated/encode-bytes/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/encode-bytes/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include encode/bytes/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include encode/__init__.py \ No newline at end of file +include encode/__init__.py diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/README.md b/packages/typespec-python/test/azure/generated/encode-bytes/README.md index 3fe91d2d5e5..7478d6fa50b 100644 --- a/packages/typespec-python/test/azure/generated/encode-bytes/README.md +++ b/packages/typespec-python/test/azure/generated/encode-bytes/README.md @@ -1,5 +1,3 @@ - - # Encode Bytes client library for Python @@ -17,6 +15,7 @@ python -m pip install encode-bytes - You need an [Azure subscription][azure_sub] to use this package. - An existing Encode Bytes instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/_client.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/_client.py index 9aa25b58d3d..4d979e2f6ef 100644 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/_client.py +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/_client.py @@ -16,13 +16,11 @@ from ._configuration import BytesClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import ( - HeaderOperations, - PropertyOperations, - QueryOperations, - RequestBodyOperations, - ResponseBodyOperations, -) +from .header.operations import HeaderOperations +from .property.operations import PropertyOperations +from .query.operations import QueryOperations +from .requestbody.operations import RequestBodyOperations +from .responsebody.operations import ResponseBodyOperations class BytesClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/_client.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/_client.py index 570eae35b69..8926193e032 100644 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/_client.py @@ -15,14 +15,12 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer +from ..header.aio.operations import HeaderOperations +from ..property.aio.operations import PropertyOperations +from ..query.aio.operations import QueryOperations +from ..requestbody.aio.operations import RequestBodyOperations +from ..responsebody.aio.operations import ResponseBodyOperations from ._configuration import BytesClientConfiguration -from .operations import ( - HeaderOperations, - PropertyOperations, - QueryOperations, - RequestBodyOperations, - ResponseBodyOperations, -) class BytesClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/__init__.py deleted file mode 100644 index a19ae0a5209..00000000000 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import QueryOperations # type: ignore -from ._operations import PropertyOperations # type: ignore -from ._operations import HeaderOperations # type: ignore -from ._operations import RequestBodyOperations # type: ignore -from ._operations import ResponseBodyOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "QueryOperations", - "PropertyOperations", - "HeaderOperations", - "RequestBodyOperations", - "ResponseBodyOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_operations.py deleted file mode 100644 index e84915c1d29..00000000000 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_operations.py +++ /dev/null @@ -1,1546 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import json -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict - -from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize -from ..._serialization import Deserializer, Serializer -from ...operations._operations import ( - build_header_base64_request, - build_header_base64_url_array_request, - build_header_base64_url_request, - build_header_default_request, - build_property_base64_request, - build_property_base64_url_array_request, - build_property_base64_url_request, - build_property_default_request, - build_query_base64_request, - build_query_base64_url_array_request, - build_query_base64_url_request, - build_query_default_request, - build_request_body_base64_request, - build_request_body_base64_url_request, - build_request_body_custom_content_type_request, - build_request_body_default_request, - build_request_body_octet_stream_request, - build_response_body_base64_request, - build_response_body_base64_url_request, - build_response_body_custom_content_type_request, - build_response_body_default_request, - build_response_body_octet_stream_request, -) -from .._configuration import BytesClientConfiguration - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class QueryOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.bytes.aio.BytesClient`'s - :attr:`query` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def default(self, *, value: bytes, **kwargs: Any) -> None: - """default. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_default_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def base64(self, *, value: bytes, **kwargs: Any) -> None: - """base64. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_base64_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def base64_url(self, *, value: bytes, **kwargs: Any) -> None: - """base64_url. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_base64_url_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def base64_url_array(self, *, value: List[bytes], **kwargs: Any) -> None: - """base64_url_array. - - :keyword value: Required. - :paramtype value: list[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_base64_url_array_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PropertyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.bytes.aio.BytesClient`'s - :attr:`property` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def default( - self, body: _models.DefaultBytesProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultBytesProperty: - """default. - - :param body: Required. - :type body: ~encode.bytes.models.DefaultBytesProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.DefaultBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def default( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultBytesProperty: - """default. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.DefaultBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def default( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultBytesProperty: - """default. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.DefaultBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def default( - self, body: Union[_models.DefaultBytesProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.DefaultBytesProperty: - """default. - - :param body: Is one of the following types: DefaultBytesProperty, JSON, IO[bytes] Required. - :type body: ~encode.bytes.models.DefaultBytesProperty or JSON or IO[bytes] - :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.DefaultBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DefaultBytesProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_default_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DefaultBytesProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def base64( - self, body: _models.Base64BytesProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64BytesProperty: - """base64. - - :param body: Required. - :type body: ~encode.bytes.models.Base64BytesProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64BytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def base64( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64BytesProperty: - """base64. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64BytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def base64( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64BytesProperty: - """base64. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64BytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def base64( - self, body: Union[_models.Base64BytesProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Base64BytesProperty: - """base64. - - :param body: Is one of the following types: Base64BytesProperty, JSON, IO[bytes] Required. - :type body: ~encode.bytes.models.Base64BytesProperty or JSON or IO[bytes] - :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64BytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Base64BytesProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_base64_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Base64BytesProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def base64_url( - self, body: _models.Base64urlBytesProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlBytesProperty: - """base64_url. - - :param body: Required. - :type body: ~encode.bytes.models.Base64urlBytesProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64urlBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def base64_url( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlBytesProperty: - """base64_url. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64urlBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def base64_url( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlBytesProperty: - """base64_url. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64urlBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def base64_url( - self, body: Union[_models.Base64urlBytesProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Base64urlBytesProperty: - """base64_url. - - :param body: Is one of the following types: Base64urlBytesProperty, JSON, IO[bytes] Required. - :type body: ~encode.bytes.models.Base64urlBytesProperty or JSON or IO[bytes] - :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64urlBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Base64urlBytesProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_base64_url_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Base64urlBytesProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def base64_url_array( - self, body: _models.Base64urlArrayBytesProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlArrayBytesProperty: - """base64_url_array. - - :param body: Required. - :type body: ~encode.bytes.models.Base64urlArrayBytesProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with - MutableMapping - :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def base64_url_array( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlArrayBytesProperty: - """base64_url_array. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with - MutableMapping - :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def base64_url_array( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlArrayBytesProperty: - """base64_url_array. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with - MutableMapping - :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def base64_url_array( - self, body: Union[_models.Base64urlArrayBytesProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Base64urlArrayBytesProperty: - """base64_url_array. - - :param body: Is one of the following types: Base64urlArrayBytesProperty, JSON, IO[bytes] - Required. - :type body: ~encode.bytes.models.Base64urlArrayBytesProperty or JSON or IO[bytes] - :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with - MutableMapping - :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Base64urlArrayBytesProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_base64_url_array_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Base64urlArrayBytesProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class HeaderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.bytes.aio.BytesClient`'s - :attr:`header` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def default(self, *, value: bytes, **kwargs: Any) -> None: - """default. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_default_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def base64(self, *, value: bytes, **kwargs: Any) -> None: - """base64. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_base64_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def base64_url(self, *, value: bytes, **kwargs: Any) -> None: - """base64_url. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_base64_url_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def base64_url_array(self, *, value: List[bytes], **kwargs: Any) -> None: - """base64_url_array. - - :keyword value: Required. - :paramtype value: list[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_base64_url_array_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class RequestBodyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.bytes.aio.BytesClient`'s - :attr:`request_body` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def default(self, value: bytes, **kwargs: Any) -> None: - """default. - - :param value: Required. - :type value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = value - - _request = build_request_body_default_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def octet_stream(self, value: bytes, **kwargs: Any) -> None: - """octet_stream. - - :param value: Required. - :type value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = value - - _request = build_request_body_octet_stream_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def custom_content_type(self, value: bytes, **kwargs: Any) -> None: - """custom_content_type. - - :param value: Required. - :type value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "image/png")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = value - - _request = build_request_body_custom_content_type_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def base64(self, value: bytes, **kwargs: Any) -> None: - """base64. - - :param value: Required. - :type value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = json.dumps(value, cls=SdkJSONEncoder, exclude_readonly=True, format="base64") # type: ignore - - _request = build_request_body_base64_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def base64_url(self, value: bytes, **kwargs: Any) -> None: - """base64_url. - - :param value: Required. - :type value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = json.dumps(value, cls=SdkJSONEncoder, exclude_readonly=True, format="base64url") # type: ignore - - _request = build_request_body_base64_url_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ResponseBodyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.bytes.aio.BytesClient`'s - :attr:`response_body` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def default(self, **kwargs: Any) -> AsyncIterator[bytes]: - """default. - - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_response_body_default_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def octet_stream(self, **kwargs: Any) -> AsyncIterator[bytes]: - """octet_stream. - - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_response_body_octet_stream_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def custom_content_type(self, **kwargs: Any) -> AsyncIterator[bytes]: - """custom_content_type. - - :return: AsyncIterator[bytes] - :rtype: AsyncIterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_response_body_custom_content_type_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def base64(self, **kwargs: Any) -> bytes: - """base64. - - :return: bytes - :rtype: bytes - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[bytes] = kwargs.pop("cls", None) - - _request = build_response_body_base64_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(bytes, response.json(), format="base64") - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def base64_url(self, **kwargs: Any) -> bytes: - """base64_url. - - :return: bytes - :rtype: bytes - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[bytes] = kwargs.pop("cls", None) - - _request = build_response_body_base64_url_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(bytes, response.json(), format="base64") - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/aio/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/aio/operations/__init__.py similarity index 92% rename from packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/__init__.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/aio/operations/__init__.py index 72a7d58cf05..1ab30f60268 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/aio/operations/__init__.py @@ -12,7 +12,6 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import QueryOperations # type: ignore from ._operations import HeaderOperations # type: ignore from ._patch import __all__ as _patch_all @@ -20,7 +19,6 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "QueryOperations", "HeaderOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/aio/operations/_operations.py new file mode 100644 index 00000000000..a3ca2196205 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/aio/operations/_operations.py @@ -0,0 +1,244 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import BytesClientConfiguration +from ...operations._operations import ( + build_header_base64_request, + build_header_base64_url_array_request, + build_header_base64_url_request, + build_header_default_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class HeaderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.bytes.aio.BytesClient`'s + :attr:`header` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def default(self, *, value: bytes, **kwargs: Any) -> None: + """default. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_default_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def base64(self, *, value: bytes, **kwargs: Any) -> None: + """base64. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_base64_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def base64_url(self, *, value: bytes, **kwargs: Any) -> None: + """base64_url. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_base64_url_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def base64_url_array(self, *, value: List[bytes], **kwargs: Any) -> None: + """base64_url_array. + + :keyword value: Required. + :paramtype value: list[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_base64_url_array_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/aio/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/aio/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/operations/__init__.py similarity index 92% rename from packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/__init__.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/operations/__init__.py index 72a7d58cf05..1ab30f60268 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/operations/__init__.py @@ -12,7 +12,6 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import QueryOperations # type: ignore from ._operations import HeaderOperations # type: ignore from ._patch import __all__ as _patch_all @@ -20,7 +19,6 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "QueryOperations", "HeaderOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/operations/_operations.py new file mode 100644 index 00000000000..949a7f2c551 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/operations/_operations.py @@ -0,0 +1,292 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ..._configuration import BytesClientConfiguration +from ..._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_header_default_request(*, value: bytes, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + # Construct URL + _url = "/encode/bytes/header/default" + + # Construct headers + _headers["value"] = _SERIALIZER.header("value", value, "bytearray") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_header_base64_request(*, value: bytes, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + # Construct URL + _url = "/encode/bytes/header/base64" + + # Construct headers + _headers["value"] = _SERIALIZER.header("value", value, "bytearray") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_header_base64_url_request(*, value: bytes, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + # Construct URL + _url = "/encode/bytes/header/base64url" + + # Construct headers + _headers["value"] = _SERIALIZER.header("value", value, "base64") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_header_base64_url_array_request(*, value: List[bytes], **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + # Construct URL + _url = "/encode/bytes/header/base64url-array" + + # Construct headers + _headers["value"] = _SERIALIZER.header("value", value, "[base64]", div=",") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +class HeaderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.bytes.BytesClient`'s + :attr:`header` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """default. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_default_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """base64. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_base64_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def base64_url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """base64_url. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_base64_url_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def base64_url_array( # pylint: disable=inconsistent-return-statements + self, *, value: List[bytes], **kwargs: Any + ) -> None: + """base64_url_array. + + :keyword value: Required. + :paramtype value: list[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_base64_url_array_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/header/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/__init__.py deleted file mode 100644 index a19ae0a5209..00000000000 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import QueryOperations # type: ignore -from ._operations import PropertyOperations # type: ignore -from ._operations import HeaderOperations # type: ignore -from ._operations import RequestBodyOperations # type: ignore -from ._operations import ResponseBodyOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "QueryOperations", - "PropertyOperations", - "HeaderOperations", - "RequestBodyOperations", - "ResponseBodyOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_operations.py deleted file mode 100644 index 51afaca22b0..00000000000 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_operations.py +++ /dev/null @@ -1,1830 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import json -import sys -from typing import Any, Callable, Dict, IO, Iterator, List, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models -from .._configuration import BytesClientConfiguration -from .._model_base import SdkJSONEncoder, _deserialize -from .._serialization import Deserializer, Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_query_default_request(*, value: bytes, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/encode/bytes/query/default" - - # Construct parameters - _params["value"] = _SERIALIZER.query("value", value, "bytearray") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_base64_request(*, value: bytes, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/encode/bytes/query/base64" - - # Construct parameters - _params["value"] = _SERIALIZER.query("value", value, "bytearray") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_base64_url_request(*, value: bytes, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/encode/bytes/query/base64url" - - # Construct parameters - _params["value"] = _SERIALIZER.query("value", value, "base64") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_base64_url_array_request(*, value: List[bytes], **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/encode/bytes/query/base64url-array" - - # Construct parameters - _params["value"] = _SERIALIZER.query("value", value, "[base64]", div=",") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_property_default_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/encode/bytes/property/default" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_property_base64_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/encode/bytes/property/base64" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_property_base64_url_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/encode/bytes/property/base64url" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_property_base64_url_array_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/encode/bytes/property/base64url-array" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_header_default_request(*, value: bytes, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - # Construct URL - _url = "/encode/bytes/header/default" - - # Construct headers - _headers["value"] = _SERIALIZER.header("value", value, "bytearray") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_header_base64_request(*, value: bytes, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - # Construct URL - _url = "/encode/bytes/header/base64" - - # Construct headers - _headers["value"] = _SERIALIZER.header("value", value, "bytearray") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_header_base64_url_request(*, value: bytes, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - # Construct URL - _url = "/encode/bytes/header/base64url" - - # Construct headers - _headers["value"] = _SERIALIZER.header("value", value, "base64") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_header_base64_url_array_request(*, value: List[bytes], **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - # Construct URL - _url = "/encode/bytes/header/base64url-array" - - # Construct headers - _headers["value"] = _SERIALIZER.header("value", value, "[base64]", div=",") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_request_body_default_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: str = kwargs.pop("content_type") - # Construct URL - _url = "/encode/bytes/body/request/default" - - # Construct headers - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_request_body_octet_stream_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: str = kwargs.pop("content_type") - # Construct URL - _url = "/encode/bytes/body/request/octet-stream" - - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_request_body_custom_content_type_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: str = kwargs.pop("content_type") - # Construct URL - _url = "/encode/bytes/body/request/custom-content-type" - - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_request_body_base64_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: str = kwargs.pop("content_type") - # Construct URL - _url = "/encode/bytes/body/request/base64" - - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_request_body_base64_url_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: str = kwargs.pop("content_type") - # Construct URL - _url = "/encode/bytes/body/request/base64url" - - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_response_body_default_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/octet-stream") - - # Construct URL - _url = "/encode/bytes/body/response/default" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_response_body_octet_stream_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/octet-stream") - - # Construct URL - _url = "/encode/bytes/body/response/octet-stream" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_response_body_custom_content_type_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "image/png") - - # Construct URL - _url = "/encode/bytes/body/response/custom-content-type" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_response_body_base64_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/encode/bytes/body/response/base64" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_response_body_base64_url_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/encode/bytes/body/response/base64url" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -class QueryOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.bytes.BytesClient`'s - :attr:`query` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """default. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_default_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """base64. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_base64_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def base64_url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """base64_url. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_base64_url_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def base64_url_array( # pylint: disable=inconsistent-return-statements - self, *, value: List[bytes], **kwargs: Any - ) -> None: - """base64_url_array. - - :keyword value: Required. - :paramtype value: list[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_base64_url_array_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PropertyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.bytes.BytesClient`'s - :attr:`property` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def default( - self, body: _models.DefaultBytesProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultBytesProperty: - """default. - - :param body: Required. - :type body: ~encode.bytes.models.DefaultBytesProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.DefaultBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def default( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultBytesProperty: - """default. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.DefaultBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def default( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultBytesProperty: - """default. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.DefaultBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def default( - self, body: Union[_models.DefaultBytesProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.DefaultBytesProperty: - """default. - - :param body: Is one of the following types: DefaultBytesProperty, JSON, IO[bytes] Required. - :type body: ~encode.bytes.models.DefaultBytesProperty or JSON or IO[bytes] - :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.DefaultBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DefaultBytesProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_default_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DefaultBytesProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def base64( - self, body: _models.Base64BytesProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64BytesProperty: - """base64. - - :param body: Required. - :type body: ~encode.bytes.models.Base64BytesProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64BytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def base64( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64BytesProperty: - """base64. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64BytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def base64( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64BytesProperty: - """base64. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64BytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def base64( - self, body: Union[_models.Base64BytesProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Base64BytesProperty: - """base64. - - :param body: Is one of the following types: Base64BytesProperty, JSON, IO[bytes] Required. - :type body: ~encode.bytes.models.Base64BytesProperty or JSON or IO[bytes] - :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64BytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Base64BytesProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_base64_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Base64BytesProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def base64_url( - self, body: _models.Base64urlBytesProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlBytesProperty: - """base64_url. - - :param body: Required. - :type body: ~encode.bytes.models.Base64urlBytesProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64urlBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def base64_url( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlBytesProperty: - """base64_url. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64urlBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def base64_url( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlBytesProperty: - """base64_url. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64urlBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def base64_url( - self, body: Union[_models.Base64urlBytesProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Base64urlBytesProperty: - """base64_url. - - :param body: Is one of the following types: Base64urlBytesProperty, JSON, IO[bytes] Required. - :type body: ~encode.bytes.models.Base64urlBytesProperty or JSON or IO[bytes] - :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping - :rtype: ~encode.bytes.models.Base64urlBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Base64urlBytesProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_base64_url_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Base64urlBytesProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def base64_url_array( - self, body: _models.Base64urlArrayBytesProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlArrayBytesProperty: - """base64_url_array. - - :param body: Required. - :type body: ~encode.bytes.models.Base64urlArrayBytesProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with - MutableMapping - :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def base64_url_array( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlArrayBytesProperty: - """base64_url_array. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with - MutableMapping - :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def base64_url_array( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Base64urlArrayBytesProperty: - """base64_url_array. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with - MutableMapping - :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def base64_url_array( - self, body: Union[_models.Base64urlArrayBytesProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Base64urlArrayBytesProperty: - """base64_url_array. - - :param body: Is one of the following types: Base64urlArrayBytesProperty, JSON, IO[bytes] - Required. - :type body: ~encode.bytes.models.Base64urlArrayBytesProperty or JSON or IO[bytes] - :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with - MutableMapping - :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Base64urlArrayBytesProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_base64_url_array_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Base64urlArrayBytesProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class HeaderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.bytes.BytesClient`'s - :attr:`header` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """default. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_default_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """base64. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_base64_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def base64_url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """base64_url. - - :keyword value: Required. - :paramtype value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_base64_url_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def base64_url_array( # pylint: disable=inconsistent-return-statements - self, *, value: List[bytes], **kwargs: Any - ) -> None: - """base64_url_array. - - :keyword value: Required. - :paramtype value: list[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_base64_url_array_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class RequestBodyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.bytes.BytesClient`'s - :attr:`request_body` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """default. - - :param value: Required. - :type value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = value - - _request = build_request_body_default_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """octet_stream. - - :param value: Required. - :type value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = value - - _request = build_request_body_octet_stream_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def custom_content_type( # pylint: disable=inconsistent-return-statements - self, value: bytes, **kwargs: Any - ) -> None: - """custom_content_type. - - :param value: Required. - :type value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "image/png")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = value - - _request = build_request_body_custom_content_type_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def base64(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """base64. - - :param value: Required. - :type value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = json.dumps(value, cls=SdkJSONEncoder, exclude_readonly=True, format="base64") # type: ignore - - _request = build_request_body_base64_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def base64_url(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """base64_url. - - :param value: Required. - :type value: bytes - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _content = json.dumps(value, cls=SdkJSONEncoder, exclude_readonly=True, format="base64url") # type: ignore - - _request = build_request_body_base64_url_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ResponseBodyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.bytes.BytesClient`'s - :attr:`response_body` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def default(self, **kwargs: Any) -> Iterator[bytes]: - """default. - - :return: Iterator[bytes] - :rtype: Iterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_response_body_default_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def octet_stream(self, **kwargs: Any) -> Iterator[bytes]: - """octet_stream. - - :return: Iterator[bytes] - :rtype: Iterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_response_body_octet_stream_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def custom_content_type(self, **kwargs: Any) -> Iterator[bytes]: - """custom_content_type. - - :return: Iterator[bytes] - :rtype: Iterator[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_response_body_custom_content_type_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", True) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - deserialized = response.iter_bytes() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def base64(self, **kwargs: Any) -> bytes: - """base64. - - :return: bytes - :rtype: bytes - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[bytes] = kwargs.pop("cls", None) - - _request = build_response_body_base64_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(bytes, response.json(), format="base64") - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def base64_url(self, **kwargs: Any) -> bytes: - """base64_url. - - :return: bytes - :rtype: bytes - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[bytes] = kwargs.pop("cls", None) - - _request = build_response_body_base64_url_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(bytes, response.json(), format="base64") - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/aio/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/aio/operations/__init__.py new file mode 100644 index 00000000000..22f11074013 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import PropertyOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "PropertyOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/aio/operations/_operations.py similarity index 53% rename from packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/aio/operations/_operations.py index 0f233986f81..4c106bca77a 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -18,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -25,17 +26,16 @@ from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict -from ... import models as _models -from ..._model_base import SdkJSONEncoder -from ..._serialization import Deserializer, Serializer +from .... import models as _models3 +from ...._model_base import SdkJSONEncoder, _deserialize +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import BytesClientConfiguration from ...operations._operations import ( - build_body_optionality_required_explicit_request, - build_body_optionality_required_implicit_request, - build_optional_explicit_omit_request, - build_optional_explicit_set_request, + build_property_base64_request, + build_property_base64_url_array_request, + build_property_base64_url_request, + build_property_default_request, ) -from .._configuration import BodyOptionalityClientConfiguration -from .._vendor import BodyOptionalityClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -44,80 +44,83 @@ JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -_Unset: Any = object() -class OptionalExplicitOperations: +class PropertyOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~parameters.bodyoptionality.aio.BodyOptionalityClient`'s - :attr:`optional_explicit` attribute. + :class:`~encode.bytes.aio.BytesClient`'s + :attr:`property` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BodyOptionalityClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - async def set( - self, body: Optional[_models.BodyModel] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """set. + async def default( + self, body: _models3.DefaultBytesProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.DefaultBytesProperty: + """default. - :param body: Default value is None. - :type body: ~parameters.bodyoptionality.models.BodyModel + :param body: Required. + :type body: ~encode.bytes.models.DefaultBytesProperty :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.DefaultBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def set(self, body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: - """set. + async def default( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.DefaultBytesProperty: + """default. - :param body: Default value is None. + :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.DefaultBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def set( - self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """set. + async def default( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.DefaultBytesProperty: + """default. - :param body: Default value is None. + :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.DefaultBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def set(self, body: Optional[Union[_models.BodyModel, JSON, IO[bytes]]] = None, **kwargs: Any) -> None: - """set. - - :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Default value is None. - :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] - :return: None - :rtype: None + async def default( + self, body: Union[_models3.DefaultBytesProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models3.DefaultBytesProperty: + """default. + + :param body: Is one of the following types: DefaultBytesProperty, JSON, IO[bytes] Required. + :type body: ~encode.bytes.models.DefaultBytesProperty or JSON or IO[bytes] + :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.DefaultBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -132,19 +135,16 @@ async def set(self, body: Optional[Union[_models.BodyModel, JSON, IO[bytes]]] = _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models3.DefaultBytesProperty] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_optional_explicit_set_request( + _request = build_property_default_request( content_type=content_type, content=_content, headers=_headers, @@ -155,74 +155,90 @@ async def set(self, body: Optional[Union[_models.BodyModel, JSON, IO[bytes]]] = } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models3.DefaultBytesProperty, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload - async def omit( - self, body: Optional[_models.BodyModel] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """omit. + async def base64( + self, body: _models3.Base64BytesProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Base64BytesProperty: + """base64. - :param body: Default value is None. - :type body: ~parameters.bodyoptionality.models.BodyModel + :param body: Required. + :type body: ~encode.bytes.models.Base64BytesProperty :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64BytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def omit(self, body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: - """omit. + async def base64( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Base64BytesProperty: + """base64. - :param body: Default value is None. + :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64BytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def omit( - self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """omit. + async def base64( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Base64BytesProperty: + """base64. - :param body: Default value is None. + :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64BytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def omit(self, body: Optional[Union[_models.BodyModel, JSON, IO[bytes]]] = None, **kwargs: Any) -> None: - """omit. - - :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Default value is None. - :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] - :return: None - :rtype: None + async def base64( + self, body: Union[_models3.Base64BytesProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models3.Base64BytesProperty: + """base64. + + :param body: Is one of the following types: Base64BytesProperty, JSON, IO[bytes] Required. + :type body: ~encode.bytes.models.Base64BytesProperty or JSON or IO[bytes] + :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64BytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -237,19 +253,16 @@ async def omit(self, body: Optional[Union[_models.BodyModel, JSON, IO[bytes]]] = _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models3.Base64BytesProperty] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_optional_explicit_omit_request( + _request = build_property_base64_request( content_type=content_type, content=_content, headers=_headers, @@ -260,77 +273,90 @@ async def omit(self, body: Optional[Union[_models.BodyModel, JSON, IO[bytes]]] = } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models3.Base64BytesProperty, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore -class BodyOptionalityClientOperationsMixin(BodyOptionalityClientMixinABC): + return deserialized # type: ignore @overload - async def required_explicit( - self, body: _models.BodyModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """required_explicit. + async def base64_url( + self, body: _models3.Base64urlBytesProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Base64urlBytesProperty: + """base64_url. :param body: Required. - :type body: ~parameters.bodyoptionality.models.BodyModel + :type body: ~encode.bytes.models.Base64urlBytesProperty :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64urlBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def required_explicit(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: - """required_explicit. + async def base64_url( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Base64urlBytesProperty: + """base64_url. :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64urlBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def required_explicit( + async def base64_url( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """required_explicit. + ) -> _models3.Base64urlBytesProperty: + """base64_url. :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64urlBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def required_explicit(self, body: Union[_models.BodyModel, JSON, IO[bytes]], **kwargs: Any) -> None: - """required_explicit. - - :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Required. - :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] - :return: None - :rtype: None + async def base64_url( + self, body: Union[_models3.Base64urlBytesProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models3.Base64urlBytesProperty: + """base64_url. + + :param body: Is one of the following types: Base64urlBytesProperty, JSON, IO[bytes] Required. + :type body: ~encode.bytes.models.Base64urlBytesProperty or JSON or IO[bytes] + :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64urlBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -345,7 +371,7 @@ async def required_explicit(self, body: Union[_models.BodyModel, JSON, IO[bytes] _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models3.Base64urlBytesProperty] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -354,7 +380,7 @@ async def required_explicit(self, body: Union[_models.BodyModel, JSON, IO[bytes] else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_body_optionality_required_explicit_request( + _request = build_property_base64_url_request( content_type=content_type, content=_content, headers=_headers, @@ -365,76 +391,95 @@ async def required_explicit(self, body: Union[_models.BodyModel, JSON, IO[bytes] } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models3.Base64urlBytesProperty, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload - async def required_implicit(self, *, name: str, content_type: str = "application/json", **kwargs: Any) -> None: - """required_implicit. + async def base64_url_array( + self, body: _models3.Base64urlArrayBytesProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Base64urlArrayBytesProperty: + """base64_url_array. - :keyword name: Required. - :paramtype name: str + :param body: Required. + :type body: ~encode.bytes.models.Base64urlArrayBytesProperty :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with + MutableMapping + :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def required_implicit(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: - """required_implicit. + async def base64_url_array( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Base64urlArrayBytesProperty: + """base64_url_array. :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with + MutableMapping + :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def required_implicit( + async def base64_url_array( self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """required_implicit. + ) -> _models3.Base64urlArrayBytesProperty: + """base64_url_array. :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with + MutableMapping + :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def required_implicit( - self, body: Union[JSON, IO[bytes]] = _Unset, *, name: str = _Unset, **kwargs: Any - ) -> None: - """required_implicit. - - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword name: Required. - :paramtype name: str - :return: None - :rtype: None + async def base64_url_array( + self, body: Union[_models3.Base64urlArrayBytesProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models3.Base64urlArrayBytesProperty: + """base64_url_array. + + :param body: Is one of the following types: Base64urlArrayBytesProperty, JSON, IO[bytes] + Required. + :type body: ~encode.bytes.models.Base64urlArrayBytesProperty or JSON or IO[bytes] + :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with + MutableMapping + :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -449,13 +494,8 @@ async def required_implicit( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models3.Base64urlArrayBytesProperty] = kwargs.pop("cls", None) - if body is _Unset: - if name is _Unset: - raise TypeError("missing required argument: name") - body = {"name": name} - body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): @@ -463,7 +503,7 @@ async def required_implicit( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_body_optionality_required_implicit_request( + _request = build_property_base64_url_array_request( content_type=content_type, content=_content, headers=_headers, @@ -474,16 +514,28 @@ async def required_implicit( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models3.Base64urlArrayBytesProperty, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/aio/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/aio/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/operations/__init__.py new file mode 100644 index 00000000000..22f11074013 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import PropertyOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "PropertyOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/operations/_operations.py similarity index 54% rename from packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/operations/_operations.py index b303047b25e..d6453ec92c3 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/operations/_operations.py @@ -17,6 +17,8 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -24,11 +26,10 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict -from .. import models as _models -from .._configuration import BodyOptionalityClientConfiguration -from .._model_base import SdkJSONEncoder -from .._serialization import Deserializer, Serializer -from .._vendor import BodyOptionalityClientMixinABC +from ... import models as _models2 +from ..._configuration import BytesClientConfiguration +from ..._model_base import SdkJSONEncoder, _deserialize +from ..._serialization import Deserializer, Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -37,139 +38,154 @@ JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -_Unset: Any = object() _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_optional_explicit_set_request(**kwargs: Any) -> HttpRequest: +def build_property_default_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/parameters/body-optionality/optional-explicit/set" + _url = "/encode/bytes/property/default" # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_optional_explicit_omit_request(**kwargs: Any) -> HttpRequest: +def build_property_base64_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/parameters/body-optionality/optional-explicit/omit" + _url = "/encode/bytes/property/base64" # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_body_optionality_required_explicit_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_property_base64_url_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/parameters/body-optionality/required-explicit" + _url = "/encode/bytes/property/base64url" # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_body_optionality_required_implicit_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_property_base64_url_array_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/parameters/body-optionality/required-implicit" + _url = "/encode/bytes/property/base64url-array" # Construct headers if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -class OptionalExplicitOperations: +class PropertyOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~parameters.bodyoptionality.BodyOptionalityClient`'s - :attr:`optional_explicit` attribute. + :class:`~encode.bytes.BytesClient`'s + :attr:`property` attribute. """ def __init__(self, *args, **kwargs): input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: BodyOptionalityClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - def set( - self, body: Optional[_models.BodyModel] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """set. + def default( + self, body: _models2.DefaultBytesProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.DefaultBytesProperty: + """default. - :param body: Default value is None. - :type body: ~parameters.bodyoptionality.models.BodyModel + :param body: Required. + :type body: ~encode.bytes.models.DefaultBytesProperty :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.DefaultBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def set(self, body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: - """set. + def default( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.DefaultBytesProperty: + """default. - :param body: Default value is None. + :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.DefaultBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def set(self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: - """set. + def default( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.DefaultBytesProperty: + """default. - :param body: Default value is None. + :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.DefaultBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def set( # pylint: disable=inconsistent-return-statements - self, body: Optional[Union[_models.BodyModel, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> None: - """set. - - :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Default value is None. - :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] - :return: None - :rtype: None + def default( + self, body: Union[_models2.DefaultBytesProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models2.DefaultBytesProperty: + """default. + + :param body: Is one of the following types: DefaultBytesProperty, JSON, IO[bytes] Required. + :type body: ~encode.bytes.models.DefaultBytesProperty or JSON or IO[bytes] + :return: DefaultBytesProperty. The DefaultBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.DefaultBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -184,19 +200,16 @@ def set( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models2.DefaultBytesProperty] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_optional_explicit_set_request( + _request = build_property_default_request( content_type=content_type, content=_content, headers=_headers, @@ -207,74 +220,90 @@ def set( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models2.DefaultBytesProperty, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload - def omit( - self, body: Optional[_models.BodyModel] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """omit. + def base64( + self, body: _models2.Base64BytesProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Base64BytesProperty: + """base64. - :param body: Default value is None. - :type body: ~parameters.bodyoptionality.models.BodyModel + :param body: Required. + :type body: ~encode.bytes.models.Base64BytesProperty :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64BytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def omit(self, body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: - """omit. + def base64( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Base64BytesProperty: + """base64. - :param body: Default value is None. + :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64BytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def omit(self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: - """omit. + def base64( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Base64BytesProperty: + """base64. - :param body: Default value is None. + :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64BytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def omit( # pylint: disable=inconsistent-return-statements - self, body: Optional[Union[_models.BodyModel, JSON, IO[bytes]]] = None, **kwargs: Any - ) -> None: - """omit. - - :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Default value is None. - :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] - :return: None - :rtype: None + def base64( + self, body: Union[_models2.Base64BytesProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models2.Base64BytesProperty: + """base64. + + :param body: Is one of the following types: Base64BytesProperty, JSON, IO[bytes] Required. + :type body: ~encode.bytes.models.Base64BytesProperty or JSON or IO[bytes] + :return: Base64BytesProperty. The Base64BytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64BytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -289,19 +318,16 @@ def omit( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models2.Base64BytesProperty] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): _content = body else: - if body is not None: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - else: - _content = None + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_optional_explicit_omit_request( + _request = build_property_base64_request( content_type=content_type, content=_content, headers=_headers, @@ -312,77 +338,90 @@ def omit( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, None, {}) # type: ignore + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models2.Base64BytesProperty, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore -class BodyOptionalityClientOperationsMixin(BodyOptionalityClientMixinABC): + return deserialized # type: ignore @overload - def required_explicit( - self, body: _models.BodyModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """required_explicit. + def base64_url( + self, body: _models2.Base64urlBytesProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Base64urlBytesProperty: + """base64_url. :param body: Required. - :type body: ~parameters.bodyoptionality.models.BodyModel + :type body: ~encode.bytes.models.Base64urlBytesProperty :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64urlBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def required_explicit(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: - """required_explicit. + def base64_url( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Base64urlBytesProperty: + """base64_url. :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64urlBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def required_explicit(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """required_explicit. + def base64_url( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Base64urlBytesProperty: + """base64_url. :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64urlBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def required_explicit( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.BodyModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """required_explicit. - - :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Required. - :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] - :return: None - :rtype: None + def base64_url( + self, body: Union[_models2.Base64urlBytesProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models2.Base64urlBytesProperty: + """base64_url. + + :param body: Is one of the following types: Base64urlBytesProperty, JSON, IO[bytes] Required. + :type body: ~encode.bytes.models.Base64urlBytesProperty or JSON or IO[bytes] + :return: Base64urlBytesProperty. The Base64urlBytesProperty is compatible with MutableMapping + :rtype: ~encode.bytes.models.Base64urlBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -397,7 +436,7 @@ def required_explicit( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models2.Base64urlBytesProperty] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -406,7 +445,7 @@ def required_explicit( # pylint: disable=inconsistent-return-statements else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_body_optionality_required_explicit_request( + _request = build_property_base64_url_request( content_type=content_type, content=_content, headers=_headers, @@ -417,74 +456,95 @@ def required_explicit( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models2.Base64urlBytesProperty, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload - def required_implicit(self, *, name: str, content_type: str = "application/json", **kwargs: Any) -> None: - """required_implicit. + def base64_url_array( + self, body: _models2.Base64urlArrayBytesProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Base64urlArrayBytesProperty: + """base64_url_array. - :keyword name: Required. - :paramtype name: str + :param body: Required. + :type body: ~encode.bytes.models.Base64urlArrayBytesProperty :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with + MutableMapping + :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def required_implicit(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: - """required_implicit. + def base64_url_array( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Base64urlArrayBytesProperty: + """base64_url_array. :param body: Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with + MutableMapping + :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def required_implicit(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: - """required_implicit. + def base64_url_array( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Base64urlArrayBytesProperty: + """base64_url_array. :param body: Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: None - :rtype: None + :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with + MutableMapping + :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def required_implicit( # pylint: disable=inconsistent-return-statements - self, body: Union[JSON, IO[bytes]] = _Unset, *, name: str = _Unset, **kwargs: Any - ) -> None: - """required_implicit. - - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] - :keyword name: Required. - :paramtype name: str - :return: None - :rtype: None + def base64_url_array( + self, body: Union[_models2.Base64urlArrayBytesProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models2.Base64urlArrayBytesProperty: + """base64_url_array. + + :param body: Is one of the following types: Base64urlArrayBytesProperty, JSON, IO[bytes] + Required. + :type body: ~encode.bytes.models.Base64urlArrayBytesProperty or JSON or IO[bytes] + :return: Base64urlArrayBytesProperty. The Base64urlArrayBytesProperty is compatible with + MutableMapping + :rtype: ~encode.bytes.models.Base64urlArrayBytesProperty :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -499,13 +559,8 @@ def required_implicit( # pylint: disable=inconsistent-return-statements _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models2.Base64urlArrayBytesProperty] = kwargs.pop("cls", None) - if body is _Unset: - if name is _Unset: - raise TypeError("missing required argument: name") - body = {"name": name} - body = {k: v for k, v in body.items() if v is not None} content_type = content_type or "application/json" _content = None if isinstance(body, (IOBase, bytes)): @@ -513,7 +568,7 @@ def required_implicit( # pylint: disable=inconsistent-return-statements else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_body_optionality_required_implicit_request( + _request = build_property_base64_url_array_request( content_type=content_type, content=_content, headers=_headers, @@ -524,16 +579,28 @@ def required_implicit( # pylint: disable=inconsistent-return-statements } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [204]: + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models2.Base64urlArrayBytesProperty, response.json()) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/property/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/aio/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/aio/operations/__init__.py new file mode 100644 index 00000000000..97d3de4f9b2 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import QueryOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "QueryOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/aio/operations/_operations.py new file mode 100644 index 00000000000..304c091da52 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/aio/operations/_operations.py @@ -0,0 +1,244 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import BytesClientConfiguration +from ...operations._operations import ( + build_query_base64_request, + build_query_base64_url_array_request, + build_query_base64_url_request, + build_query_default_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class QueryOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.bytes.aio.BytesClient`'s + :attr:`query` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def default(self, *, value: bytes, **kwargs: Any) -> None: + """default. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_default_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def base64(self, *, value: bytes, **kwargs: Any) -> None: + """base64. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_base64_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def base64_url(self, *, value: bytes, **kwargs: Any) -> None: + """base64_url. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_base64_url_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def base64_url_array(self, *, value: List[bytes], **kwargs: Any) -> None: + """base64_url_array. + + :keyword value: Required. + :paramtype value: list[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_base64_url_array_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/aio/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/aio/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/operations/__init__.py new file mode 100644 index 00000000000..97d3de4f9b2 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import QueryOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "QueryOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/operations/_operations.py new file mode 100644 index 00000000000..a70db0f7f6e --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/operations/_operations.py @@ -0,0 +1,292 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ..._configuration import BytesClientConfiguration +from ..._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_query_default_request(*, value: bytes, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/encode/bytes/query/default" + + # Construct parameters + _params["value"] = _SERIALIZER.query("value", value, "bytearray") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_base64_request(*, value: bytes, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/encode/bytes/query/base64" + + # Construct parameters + _params["value"] = _SERIALIZER.query("value", value, "bytearray") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_base64_url_request(*, value: bytes, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/encode/bytes/query/base64url" + + # Construct parameters + _params["value"] = _SERIALIZER.query("value", value, "base64") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_base64_url_array_request(*, value: List[bytes], **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/encode/bytes/query/base64url-array" + + # Construct parameters + _params["value"] = _SERIALIZER.query("value", value, "[base64]", div=",") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +class QueryOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.bytes.BytesClient`'s + :attr:`query` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """default. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_default_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """base64. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_base64_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def base64_url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """base64_url. + + :keyword value: Required. + :paramtype value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_base64_url_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def base64_url_array( # pylint: disable=inconsistent-return-statements + self, *, value: List[bytes], **kwargs: Any + ) -> None: + """base64_url_array. + + :keyword value: Required. + :paramtype value: list[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_base64_url_array_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/query/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/aio/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/aio/operations/__init__.py new file mode 100644 index 00000000000..4b425cb03d6 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import RequestBodyOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "RequestBodyOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/aio/operations/_operations.py new file mode 100644 index 00000000000..6d312998c80 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/aio/operations/_operations.py @@ -0,0 +1,315 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import json +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict + +from ...._model_base import SdkJSONEncoder +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import BytesClientConfiguration +from ...operations._operations import ( + build_request_body_base64_request, + build_request_body_base64_url_request, + build_request_body_custom_content_type_request, + build_request_body_default_request, + build_request_body_octet_stream_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RequestBodyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.bytes.aio.BytesClient`'s + :attr:`request_body` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def default(self, value: bytes, **kwargs: Any) -> None: + """default. + + :param value: Required. + :type value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = value + + _request = build_request_body_default_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def octet_stream(self, value: bytes, **kwargs: Any) -> None: + """octet_stream. + + :param value: Required. + :type value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = value + + _request = build_request_body_octet_stream_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def custom_content_type(self, value: bytes, **kwargs: Any) -> None: + """custom_content_type. + + :param value: Required. + :type value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "image/png")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = value + + _request = build_request_body_custom_content_type_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def base64(self, value: bytes, **kwargs: Any) -> None: + """base64. + + :param value: Required. + :type value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(value, cls=SdkJSONEncoder, exclude_readonly=True, format="base64") # type: ignore + + _request = build_request_body_base64_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def base64_url(self, value: bytes, **kwargs: Any) -> None: + """base64_url. + + :param value: Required. + :type value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(value, cls=SdkJSONEncoder, exclude_readonly=True, format="base64url") # type: ignore + + _request = build_request_body_base64_url_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/operations/__init__.py new file mode 100644 index 00000000000..4b425cb03d6 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import RequestBodyOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "RequestBodyOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/operations/_operations.py new file mode 100644 index 00000000000..7ea809f3b60 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/operations/_operations.py @@ -0,0 +1,378 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import json +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ..._configuration import BytesClientConfiguration +from ..._model_base import SdkJSONEncoder +from ..._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_request_body_default_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/encode/bytes/body/request/default" + + # Construct headers + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_request_body_octet_stream_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/encode/bytes/body/request/octet-stream" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_request_body_custom_content_type_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/encode/bytes/body/request/custom-content-type" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_request_body_base64_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/encode/bytes/body/request/base64" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_request_body_base64_url_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/encode/bytes/body/request/base64url" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +class RequestBodyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.bytes.BytesClient`'s + :attr:`request_body` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """default. + + :param value: Required. + :type value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = value + + _request = build_request_body_default_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """octet_stream. + + :param value: Required. + :type value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = value + + _request = build_request_body_octet_stream_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def custom_content_type( # pylint: disable=inconsistent-return-statements + self, value: bytes, **kwargs: Any + ) -> None: + """custom_content_type. + + :param value: Required. + :type value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "image/png")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = value + + _request = build_request_body_custom_content_type_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def base64(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """base64. + + :param value: Required. + :type value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(value, cls=SdkJSONEncoder, exclude_readonly=True, format="base64") # type: ignore + + _request = build_request_body_base64_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def base64_url(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """base64_url. + + :param value: Required. + :type value: bytes + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(value, cls=SdkJSONEncoder, exclude_readonly=True, format="base64url") # type: ignore + + _request = build_request_body_base64_url_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/requestbody/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/aio/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/aio/operations/__init__.py new file mode 100644 index 00000000000..903f00096e2 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import ResponseBodyOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ResponseBodyOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/aio/operations/_operations.py new file mode 100644 index 00000000000..0654fef00ba --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/aio/operations/_operations.py @@ -0,0 +1,343 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterator, Callable, Dict, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...._model_base import _deserialize +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import BytesClientConfiguration +from ...operations._operations import ( + build_response_body_base64_request, + build_response_body_base64_url_request, + build_response_body_custom_content_type_request, + build_response_body_default_request, + build_response_body_octet_stream_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ResponseBodyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.bytes.aio.BytesClient`'s + :attr:`response_body` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def default(self, **kwargs: Any) -> AsyncIterator[bytes]: + """default. + + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_response_body_default_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def octet_stream(self, **kwargs: Any) -> AsyncIterator[bytes]: + """octet_stream. + + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_response_body_octet_stream_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def custom_content_type(self, **kwargs: Any) -> AsyncIterator[bytes]: + """custom_content_type. + + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_response_body_custom_content_type_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def base64(self, **kwargs: Any) -> bytes: + """base64. + + :return: bytes + :rtype: bytes + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[bytes] = kwargs.pop("cls", None) + + _request = build_response_body_base64_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(bytes, response.json(), format="base64") + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def base64_url(self, **kwargs: Any) -> bytes: + """base64_url. + + :return: bytes + :rtype: bytes + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[bytes] = kwargs.pop("cls", None) + + _request = build_response_body_base64_url_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(bytes, response.json(), format="base64") + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/operations/__init__.py new file mode 100644 index 00000000000..903f00096e2 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import ResponseBodyOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ResponseBodyOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/operations/_operations.py new file mode 100644 index 00000000000..7d36a54df63 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/operations/_operations.py @@ -0,0 +1,410 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterator, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ..._configuration import BytesClientConfiguration +from ..._model_base import _deserialize +from ..._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_response_body_default_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/octet-stream") + + # Construct URL + _url = "/encode/bytes/body/response/default" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_response_body_octet_stream_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/octet-stream") + + # Construct URL + _url = "/encode/bytes/body/response/octet-stream" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_response_body_custom_content_type_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "image/png") + + # Construct URL + _url = "/encode/bytes/body/response/custom-content-type" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_response_body_base64_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/encode/bytes/body/response/base64" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_response_body_base64_url_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/encode/bytes/body/response/base64url" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +class ResponseBodyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.bytes.BytesClient`'s + :attr:`response_body` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BytesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def default(self, **kwargs: Any) -> Iterator[bytes]: + """default. + + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_response_body_default_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def octet_stream(self, **kwargs: Any) -> Iterator[bytes]: + """octet_stream. + + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_response_body_octet_stream_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def custom_content_type(self, **kwargs: Any) -> Iterator[bytes]: + """custom_content_type. + + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_response_body_custom_content_type_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def base64(self, **kwargs: Any) -> bytes: + """base64. + + :return: bytes + :rtype: bytes + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[bytes] = kwargs.pop("cls", None) + + _request = build_response_body_base64_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(bytes, response.json(), format="base64") + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def base64_url(self, **kwargs: Any) -> bytes: + """base64_url. + + :return: bytes + :rtype: bytes + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[bytes] = kwargs.pop("cls", None) + + _request = build_response_body_base64_url_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(bytes, response.json(), format="base64") + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/responsebody/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/MANIFEST.in b/packages/typespec-python/test/azure/generated/encode-datetime/MANIFEST.in index 63254f8a20e..d686e124bfd 100644 --- a/packages/typespec-python/test/azure/generated/encode-datetime/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/encode-datetime/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include encode/datetime/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include encode/__init__.py \ No newline at end of file +include encode/__init__.py diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/README.md b/packages/typespec-python/test/azure/generated/encode-datetime/README.md index d278743310d..28e62626bc3 100644 --- a/packages/typespec-python/test/azure/generated/encode-datetime/README.md +++ b/packages/typespec-python/test/azure/generated/encode-datetime/README.md @@ -1,5 +1,3 @@ - - # Encode Datetime client library for Python @@ -17,6 +15,7 @@ python -m pip install encode-datetime - You need an [Azure subscription][azure_sub] to use this package. - An existing Encode Datetime instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/_client.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/_client.py index 7ac54f958ea..19b86c9b1df 100644 --- a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/_client.py +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/_client.py @@ -16,7 +16,10 @@ from ._configuration import DatetimeClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import HeaderOperations, PropertyOperations, QueryOperations, ResponseHeaderOperations +from .header.operations import HeaderOperations +from .property.operations import PropertyOperations +from .query.operations import QueryOperations +from .responseheader.operations import ResponseHeaderOperations class DatetimeClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/_client.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/_client.py index d831b20a0c6..6eacd70de08 100644 --- a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/_client.py @@ -15,8 +15,11 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer +from ..header.aio.operations import HeaderOperations +from ..property.aio.operations import PropertyOperations +from ..query.aio.operations import QueryOperations +from ..responseheader.aio.operations import ResponseHeaderOperations from ._configuration import DatetimeClientConfiguration -from .operations import HeaderOperations, PropertyOperations, QueryOperations, ResponseHeaderOperations class DatetimeClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_operations.py deleted file mode 100644 index 8516bc107eb..00000000000 --- a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_operations.py +++ /dev/null @@ -1,1393 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from io import IOBase -import json -import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict - -from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize -from ..._serialization import Deserializer, Serializer -from ...operations._operations import ( - build_header_default_request, - build_header_rfc3339_request, - build_header_rfc7231_request, - build_header_unix_timestamp_array_request, - build_header_unix_timestamp_request, - build_property_default_request, - build_property_rfc3339_request, - build_property_rfc7231_request, - build_property_unix_timestamp_array_request, - build_property_unix_timestamp_request, - build_query_default_request, - build_query_rfc3339_request, - build_query_rfc7231_request, - build_query_unix_timestamp_array_request, - build_query_unix_timestamp_request, - build_response_header_default_request, - build_response_header_rfc3339_request, - build_response_header_rfc7231_request, - build_response_header_unix_timestamp_request, -) -from .._configuration import DatetimeClientConfiguration - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class QueryOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.datetime.aio.DatetimeClient`'s - :attr:`query` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def default(self, *, value: datetime.datetime, **kwargs: Any) -> None: - """default. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_default_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def rfc3339(self, *, value: datetime.datetime, **kwargs: Any) -> None: - """rfc3339. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_rfc3339_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def rfc7231(self, *, value: datetime.datetime, **kwargs: Any) -> None: - """rfc7231. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_rfc7231_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def unix_timestamp(self, *, value: datetime.datetime, **kwargs: Any) -> None: - """unix_timestamp. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_unix_timestamp_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def unix_timestamp_array(self, *, value: List[datetime.datetime], **kwargs: Any) -> None: - """unix_timestamp_array. - - :keyword value: Required. - :paramtype value: list[~datetime.datetime] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_unix_timestamp_array_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PropertyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.datetime.aio.DatetimeClient`'s - :attr:`property` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def default( - self, body: _models.DefaultDatetimeProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultDatetimeProperty: - """default. - - :param body: Required. - :type body: ~encode.datetime.models.DefaultDatetimeProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.DefaultDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def default( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultDatetimeProperty: - """default. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.DefaultDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def default( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultDatetimeProperty: - """default. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.DefaultDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def default( - self, body: Union[_models.DefaultDatetimeProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.DefaultDatetimeProperty: - """default. - - :param body: Is one of the following types: DefaultDatetimeProperty, JSON, IO[bytes] Required. - :type body: ~encode.datetime.models.DefaultDatetimeProperty or JSON or IO[bytes] - :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.DefaultDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DefaultDatetimeProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_default_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DefaultDatetimeProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def rfc3339( - self, body: _models.Rfc3339DatetimeProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc3339DatetimeProperty: - """rfc3339. - - :param body: Required. - :type body: ~encode.datetime.models.Rfc3339DatetimeProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def rfc3339( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc3339DatetimeProperty: - """rfc3339. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def rfc3339( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc3339DatetimeProperty: - """rfc3339. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def rfc3339( - self, body: Union[_models.Rfc3339DatetimeProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Rfc3339DatetimeProperty: - """rfc3339. - - :param body: Is one of the following types: Rfc3339DatetimeProperty, JSON, IO[bytes] Required. - :type body: ~encode.datetime.models.Rfc3339DatetimeProperty or JSON or IO[bytes] - :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Rfc3339DatetimeProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_rfc3339_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Rfc3339DatetimeProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def rfc7231( - self, body: _models.Rfc7231DatetimeProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc7231DatetimeProperty: - """rfc7231. - - :param body: Required. - :type body: ~encode.datetime.models.Rfc7231DatetimeProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def rfc7231( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc7231DatetimeProperty: - """rfc7231. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def rfc7231( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc7231DatetimeProperty: - """rfc7231. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def rfc7231( - self, body: Union[_models.Rfc7231DatetimeProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Rfc7231DatetimeProperty: - """rfc7231. - - :param body: Is one of the following types: Rfc7231DatetimeProperty, JSON, IO[bytes] Required. - :type body: ~encode.datetime.models.Rfc7231DatetimeProperty or JSON or IO[bytes] - :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Rfc7231DatetimeProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_rfc7231_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Rfc7231DatetimeProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def unix_timestamp( - self, body: _models.UnixTimestampDatetimeProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampDatetimeProperty: - """unix_timestamp. - - :param body: Required. - :type body: ~encode.datetime.models.UnixTimestampDatetimeProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with - MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def unix_timestamp( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampDatetimeProperty: - """unix_timestamp. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with - MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def unix_timestamp( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampDatetimeProperty: - """unix_timestamp. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with - MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def unix_timestamp( - self, body: Union[_models.UnixTimestampDatetimeProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.UnixTimestampDatetimeProperty: - """unix_timestamp. - - :param body: Is one of the following types: UnixTimestampDatetimeProperty, JSON, IO[bytes] - Required. - :type body: ~encode.datetime.models.UnixTimestampDatetimeProperty or JSON or IO[bytes] - :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with - MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UnixTimestampDatetimeProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_unix_timestamp_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.UnixTimestampDatetimeProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def unix_timestamp_array( - self, body: _models.UnixTimestampArrayDatetimeProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampArrayDatetimeProperty: - """unix_timestamp_array. - - :param body: Required. - :type body: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is - compatible with MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def unix_timestamp_array( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampArrayDatetimeProperty: - """unix_timestamp_array. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is - compatible with MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def unix_timestamp_array( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampArrayDatetimeProperty: - """unix_timestamp_array. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is - compatible with MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def unix_timestamp_array( - self, body: Union[_models.UnixTimestampArrayDatetimeProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.UnixTimestampArrayDatetimeProperty: - """unix_timestamp_array. - - :param body: Is one of the following types: UnixTimestampArrayDatetimeProperty, JSON, IO[bytes] - Required. - :type body: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty or JSON or IO[bytes] - :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is - compatible with MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UnixTimestampArrayDatetimeProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_unix_timestamp_array_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.UnixTimestampArrayDatetimeProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class HeaderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.datetime.aio.DatetimeClient`'s - :attr:`header` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def default(self, *, value: datetime.datetime, **kwargs: Any) -> None: - """default. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_default_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def rfc3339(self, *, value: datetime.datetime, **kwargs: Any) -> None: - """rfc3339. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_rfc3339_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def rfc7231(self, *, value: datetime.datetime, **kwargs: Any) -> None: - """rfc7231. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_rfc7231_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def unix_timestamp(self, *, value: datetime.datetime, **kwargs: Any) -> None: - """unix_timestamp. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_unix_timestamp_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def unix_timestamp_array(self, *, value: List[datetime.datetime], **kwargs: Any) -> None: - """unix_timestamp_array. - - :keyword value: Required. - :paramtype value: list[~datetime.datetime] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_unix_timestamp_array_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ResponseHeaderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.datetime.aio.DatetimeClient`'s - :attr:`response_header` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def default(self, **kwargs: Any) -> None: - """default. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_response_header_default_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def rfc3339(self, **kwargs: Any) -> None: - """rfc3339. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_response_header_rfc3339_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["value"] = self._deserialize("iso-8601", response.headers.get("value")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def rfc7231(self, **kwargs: Any) -> None: - """rfc7231. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_response_header_rfc7231_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace_async - async def unix_timestamp(self, **kwargs: Any) -> None: - """unix_timestamp. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_response_header_unix_timestamp_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["value"] = self._deserialize("unix-time", response.headers.get("value")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/aio/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/aio/operations/__init__.py new file mode 100644 index 00000000000..1ab30f60268 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import HeaderOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "HeaderOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/aio/operations/_operations.py new file mode 100644 index 00000000000..d8f3f86b207 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/aio/operations/_operations.py @@ -0,0 +1,293 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import DatetimeClientConfiguration +from ...operations._operations import ( + build_header_default_request, + build_header_rfc3339_request, + build_header_rfc7231_request, + build_header_unix_timestamp_array_request, + build_header_unix_timestamp_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class HeaderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.datetime.aio.DatetimeClient`'s + :attr:`header` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def default(self, *, value: datetime.datetime, **kwargs: Any) -> None: + """default. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_default_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def rfc3339(self, *, value: datetime.datetime, **kwargs: Any) -> None: + """rfc3339. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_rfc3339_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def rfc7231(self, *, value: datetime.datetime, **kwargs: Any) -> None: + """rfc7231. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_rfc7231_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def unix_timestamp(self, *, value: datetime.datetime, **kwargs: Any) -> None: + """unix_timestamp. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_unix_timestamp_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def unix_timestamp_array(self, *, value: List[datetime.datetime], **kwargs: Any) -> None: + """unix_timestamp_array. + + :keyword value: Required. + :paramtype value: list[~datetime.datetime] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_unix_timestamp_array_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/aio/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/aio/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/operations/__init__.py new file mode 100644 index 00000000000..1ab30f60268 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import HeaderOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "HeaderOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/operations/_operations.py new file mode 100644 index 00000000000..0446836ba5c --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/operations/_operations.py @@ -0,0 +1,362 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ..._configuration import DatetimeClientConfiguration +from ..._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_header_default_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + # Construct URL + _url = "/encode/datetime/header/default" + + # Construct headers + _headers["value"] = _SERIALIZER.header("value", value, "rfc-1123") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_header_rfc3339_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + # Construct URL + _url = "/encode/datetime/header/rfc3339" + + # Construct headers + _headers["value"] = _SERIALIZER.header("value", value, "iso-8601") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_header_rfc7231_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + # Construct URL + _url = "/encode/datetime/header/rfc7231" + + # Construct headers + _headers["value"] = _SERIALIZER.header("value", value, "rfc-1123") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_header_unix_timestamp_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + # Construct URL + _url = "/encode/datetime/header/unix-timestamp" + + # Construct headers + _headers["value"] = _SERIALIZER.header("value", value, "unix-time") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_header_unix_timestamp_array_request( # pylint: disable=name-too-long + *, value: List[datetime.datetime], **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + # Construct URL + _url = "/encode/datetime/header/unix-timestamp-array" + + # Construct headers + _headers["value"] = _SERIALIZER.header("value", value, "[unix-time]", div=",") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +class HeaderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.datetime.DatetimeClient`'s + :attr:`header` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def default( # pylint: disable=inconsistent-return-statements + self, *, value: datetime.datetime, **kwargs: Any + ) -> None: + """default. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_default_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def rfc3339( # pylint: disable=inconsistent-return-statements + self, *, value: datetime.datetime, **kwargs: Any + ) -> None: + """rfc3339. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_rfc3339_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def rfc7231( # pylint: disable=inconsistent-return-statements + self, *, value: datetime.datetime, **kwargs: Any + ) -> None: + """rfc7231. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_rfc7231_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def unix_timestamp( # pylint: disable=inconsistent-return-statements + self, *, value: datetime.datetime, **kwargs: Any + ) -> None: + """unix_timestamp. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_unix_timestamp_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def unix_timestamp_array( # pylint: disable=inconsistent-return-statements + self, *, value: List[datetime.datetime], **kwargs: Any + ) -> None: + """unix_timestamp_array. + + :keyword value: Required. + :paramtype value: list[~datetime.datetime] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_unix_timestamp_array_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/header/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_operations.py deleted file mode 100644 index 3d36cf24872..00000000000 --- a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_operations.py +++ /dev/null @@ -1,1630 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from io import IOBase -import json -import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models -from .._configuration import DatetimeClientConfiguration -from .._model_base import SdkJSONEncoder, _deserialize -from .._serialization import Deserializer, Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_query_default_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/encode/datetime/query/default" - - # Construct parameters - _params["value"] = _SERIALIZER.query("value", value, "iso-8601") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_rfc3339_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/encode/datetime/query/rfc3339" - - # Construct parameters - _params["value"] = _SERIALIZER.query("value", value, "iso-8601") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_rfc7231_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/encode/datetime/query/rfc7231" - - # Construct parameters - _params["value"] = _SERIALIZER.query("value", value, "rfc-1123") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_unix_timestamp_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/encode/datetime/query/unix-timestamp" - - # Construct parameters - _params["value"] = _SERIALIZER.query("value", value, "unix-time") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_unix_timestamp_array_request(*, value: List[datetime.datetime], **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/encode/datetime/query/unix-timestamp-array" - - # Construct parameters - _params["value"] = _SERIALIZER.query("value", value, "[unix-time]", div=",") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_property_default_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/encode/datetime/property/default" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_property_rfc3339_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/encode/datetime/property/rfc3339" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_property_rfc7231_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/encode/datetime/property/rfc7231" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_property_unix_timestamp_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/encode/datetime/property/unix-timestamp" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_property_unix_timestamp_array_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/encode/datetime/property/unix-timestamp-array" - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) - - -def build_header_default_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - # Construct URL - _url = "/encode/datetime/header/default" - - # Construct headers - _headers["value"] = _SERIALIZER.header("value", value, "rfc-1123") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_header_rfc3339_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - # Construct URL - _url = "/encode/datetime/header/rfc3339" - - # Construct headers - _headers["value"] = _SERIALIZER.header("value", value, "iso-8601") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_header_rfc7231_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - # Construct URL - _url = "/encode/datetime/header/rfc7231" - - # Construct headers - _headers["value"] = _SERIALIZER.header("value", value, "rfc-1123") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_header_unix_timestamp_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - # Construct URL - _url = "/encode/datetime/header/unix-timestamp" - - # Construct headers - _headers["value"] = _SERIALIZER.header("value", value, "unix-time") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_header_unix_timestamp_array_request( # pylint: disable=name-too-long - *, value: List[datetime.datetime], **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - # Construct URL - _url = "/encode/datetime/header/unix-timestamp-array" - - # Construct headers - _headers["value"] = _SERIALIZER.header("value", value, "[unix-time]", div=",") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_response_header_default_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/encode/datetime/responseheader/default" - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_response_header_rfc3339_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/encode/datetime/responseheader/rfc3339" - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_response_header_rfc7231_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/encode/datetime/responseheader/rfc7231" - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_response_header_unix_timestamp_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - # Construct URL - _url = "/encode/datetime/responseheader/unix-timestamp" - - return HttpRequest(method="GET", url=_url, **kwargs) - - -class QueryOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.datetime.DatetimeClient`'s - :attr:`query` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def default( # pylint: disable=inconsistent-return-statements - self, *, value: datetime.datetime, **kwargs: Any - ) -> None: - """default. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_default_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def rfc3339( # pylint: disable=inconsistent-return-statements - self, *, value: datetime.datetime, **kwargs: Any - ) -> None: - """rfc3339. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_rfc3339_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def rfc7231( # pylint: disable=inconsistent-return-statements - self, *, value: datetime.datetime, **kwargs: Any - ) -> None: - """rfc7231. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_rfc7231_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def unix_timestamp( # pylint: disable=inconsistent-return-statements - self, *, value: datetime.datetime, **kwargs: Any - ) -> None: - """unix_timestamp. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_unix_timestamp_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def unix_timestamp_array( # pylint: disable=inconsistent-return-statements - self, *, value: List[datetime.datetime], **kwargs: Any - ) -> None: - """unix_timestamp_array. - - :keyword value: Required. - :paramtype value: list[~datetime.datetime] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_unix_timestamp_array_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PropertyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.datetime.DatetimeClient`'s - :attr:`property` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def default( - self, body: _models.DefaultDatetimeProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultDatetimeProperty: - """default. - - :param body: Required. - :type body: ~encode.datetime.models.DefaultDatetimeProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.DefaultDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def default( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultDatetimeProperty: - """default. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.DefaultDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def default( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DefaultDatetimeProperty: - """default. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.DefaultDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def default( - self, body: Union[_models.DefaultDatetimeProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.DefaultDatetimeProperty: - """default. - - :param body: Is one of the following types: DefaultDatetimeProperty, JSON, IO[bytes] Required. - :type body: ~encode.datetime.models.DefaultDatetimeProperty or JSON or IO[bytes] - :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.DefaultDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DefaultDatetimeProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_default_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.DefaultDatetimeProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def rfc3339( - self, body: _models.Rfc3339DatetimeProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc3339DatetimeProperty: - """rfc3339. - - :param body: Required. - :type body: ~encode.datetime.models.Rfc3339DatetimeProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def rfc3339( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc3339DatetimeProperty: - """rfc3339. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def rfc3339( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc3339DatetimeProperty: - """rfc3339. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def rfc3339( - self, body: Union[_models.Rfc3339DatetimeProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Rfc3339DatetimeProperty: - """rfc3339. - - :param body: Is one of the following types: Rfc3339DatetimeProperty, JSON, IO[bytes] Required. - :type body: ~encode.datetime.models.Rfc3339DatetimeProperty or JSON or IO[bytes] - :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Rfc3339DatetimeProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_rfc3339_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Rfc3339DatetimeProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def rfc7231( - self, body: _models.Rfc7231DatetimeProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc7231DatetimeProperty: - """rfc7231. - - :param body: Required. - :type body: ~encode.datetime.models.Rfc7231DatetimeProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def rfc7231( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc7231DatetimeProperty: - """rfc7231. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def rfc7231( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Rfc7231DatetimeProperty: - """rfc7231. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def rfc7231( - self, body: Union[_models.Rfc7231DatetimeProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.Rfc7231DatetimeProperty: - """rfc7231. - - :param body: Is one of the following types: Rfc7231DatetimeProperty, JSON, IO[bytes] Required. - :type body: ~encode.datetime.models.Rfc7231DatetimeProperty or JSON or IO[bytes] - :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping - :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Rfc7231DatetimeProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_rfc7231_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.Rfc7231DatetimeProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def unix_timestamp( - self, body: _models.UnixTimestampDatetimeProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampDatetimeProperty: - """unix_timestamp. - - :param body: Required. - :type body: ~encode.datetime.models.UnixTimestampDatetimeProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with - MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def unix_timestamp( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampDatetimeProperty: - """unix_timestamp. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with - MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def unix_timestamp( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampDatetimeProperty: - """unix_timestamp. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with - MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def unix_timestamp( - self, body: Union[_models.UnixTimestampDatetimeProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.UnixTimestampDatetimeProperty: - """unix_timestamp. - - :param body: Is one of the following types: UnixTimestampDatetimeProperty, JSON, IO[bytes] - Required. - :type body: ~encode.datetime.models.UnixTimestampDatetimeProperty or JSON or IO[bytes] - :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with - MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UnixTimestampDatetimeProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_unix_timestamp_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.UnixTimestampDatetimeProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def unix_timestamp_array( - self, body: _models.UnixTimestampArrayDatetimeProperty, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampArrayDatetimeProperty: - """unix_timestamp_array. - - :param body: Required. - :type body: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is - compatible with MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def unix_timestamp_array( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampArrayDatetimeProperty: - """unix_timestamp_array. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is - compatible with MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def unix_timestamp_array( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.UnixTimestampArrayDatetimeProperty: - """unix_timestamp_array. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is - compatible with MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def unix_timestamp_array( - self, body: Union[_models.UnixTimestampArrayDatetimeProperty, JSON, IO[bytes]], **kwargs: Any - ) -> _models.UnixTimestampArrayDatetimeProperty: - """unix_timestamp_array. - - :param body: Is one of the following types: UnixTimestampArrayDatetimeProperty, JSON, IO[bytes] - Required. - :type body: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty or JSON or IO[bytes] - :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is - compatible with MutableMapping - :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UnixTimestampArrayDatetimeProperty] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_unix_timestamp_array_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if _stream: - deserialized = response.iter_bytes() - else: - deserialized = _deserialize(_models.UnixTimestampArrayDatetimeProperty, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - -class HeaderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.datetime.DatetimeClient`'s - :attr:`header` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def default( # pylint: disable=inconsistent-return-statements - self, *, value: datetime.datetime, **kwargs: Any - ) -> None: - """default. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_default_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def rfc3339( # pylint: disable=inconsistent-return-statements - self, *, value: datetime.datetime, **kwargs: Any - ) -> None: - """rfc3339. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_rfc3339_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def rfc7231( # pylint: disable=inconsistent-return-statements - self, *, value: datetime.datetime, **kwargs: Any - ) -> None: - """rfc7231. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_rfc7231_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def unix_timestamp( # pylint: disable=inconsistent-return-statements - self, *, value: datetime.datetime, **kwargs: Any - ) -> None: - """unix_timestamp. - - :keyword value: Required. - :paramtype value: ~datetime.datetime - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_unix_timestamp_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def unix_timestamp_array( # pylint: disable=inconsistent-return-statements - self, *, value: List[datetime.datetime], **kwargs: Any - ) -> None: - """unix_timestamp_array. - - :keyword value: Required. - :paramtype value: list[~datetime.datetime] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_unix_timestamp_array_request( - value=value, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ResponseHeaderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~encode.datetime.DatetimeClient`'s - :attr:`response_header` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def default(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """default. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_response_header_default_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def rfc3339(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """rfc3339. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_response_header_rfc3339_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["value"] = self._deserialize("iso-8601", response.headers.get("value")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def rfc7231(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """rfc7231. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_response_header_rfc7231_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore - - @distributed_trace - def unix_timestamp(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """unix_timestamp. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_response_header_unix_timestamp_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - response_headers = {} - response_headers["value"] = self._deserialize("unix-time", response.headers.get("value")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/aio/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/aio/operations/__init__.py new file mode 100644 index 00000000000..22f11074013 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import PropertyOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "PropertyOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/aio/operations/_operations.py new file mode 100644 index 00000000000..7cba6f88e3c --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/aio/operations/_operations.py @@ -0,0 +1,669 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict + +from .... import models as _models3 +from ...._model_base import SdkJSONEncoder, _deserialize +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import DatetimeClientConfiguration +from ...operations._operations import ( + build_property_default_request, + build_property_rfc3339_request, + build_property_rfc7231_request, + build_property_unix_timestamp_array_request, + build_property_unix_timestamp_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PropertyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.datetime.aio.DatetimeClient`'s + :attr:`property` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def default( + self, body: _models3.DefaultDatetimeProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.DefaultDatetimeProperty: + """default. + + :param body: Required. + :type body: ~encode.datetime.models.DefaultDatetimeProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.DefaultDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def default( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.DefaultDatetimeProperty: + """default. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.DefaultDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def default( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.DefaultDatetimeProperty: + """default. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.DefaultDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def default( + self, body: Union[_models3.DefaultDatetimeProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models3.DefaultDatetimeProperty: + """default. + + :param body: Is one of the following types: DefaultDatetimeProperty, JSON, IO[bytes] Required. + :type body: ~encode.datetime.models.DefaultDatetimeProperty or JSON or IO[bytes] + :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.DefaultDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models3.DefaultDatetimeProperty] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_property_default_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models3.DefaultDatetimeProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def rfc3339( + self, body: _models3.Rfc3339DatetimeProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Rfc3339DatetimeProperty: + """rfc3339. + + :param body: Required. + :type body: ~encode.datetime.models.Rfc3339DatetimeProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def rfc3339( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Rfc3339DatetimeProperty: + """rfc3339. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def rfc3339( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Rfc3339DatetimeProperty: + """rfc3339. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def rfc3339( + self, body: Union[_models3.Rfc3339DatetimeProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models3.Rfc3339DatetimeProperty: + """rfc3339. + + :param body: Is one of the following types: Rfc3339DatetimeProperty, JSON, IO[bytes] Required. + :type body: ~encode.datetime.models.Rfc3339DatetimeProperty or JSON or IO[bytes] + :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models3.Rfc3339DatetimeProperty] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_property_rfc3339_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models3.Rfc3339DatetimeProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def rfc7231( + self, body: _models3.Rfc7231DatetimeProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Rfc7231DatetimeProperty: + """rfc7231. + + :param body: Required. + :type body: ~encode.datetime.models.Rfc7231DatetimeProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def rfc7231( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Rfc7231DatetimeProperty: + """rfc7231. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def rfc7231( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.Rfc7231DatetimeProperty: + """rfc7231. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def rfc7231( + self, body: Union[_models3.Rfc7231DatetimeProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models3.Rfc7231DatetimeProperty: + """rfc7231. + + :param body: Is one of the following types: Rfc7231DatetimeProperty, JSON, IO[bytes] Required. + :type body: ~encode.datetime.models.Rfc7231DatetimeProperty or JSON or IO[bytes] + :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models3.Rfc7231DatetimeProperty] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_property_rfc7231_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models3.Rfc7231DatetimeProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def unix_timestamp( + self, body: _models3.UnixTimestampDatetimeProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.UnixTimestampDatetimeProperty: + """unix_timestamp. + + :param body: Required. + :type body: ~encode.datetime.models.UnixTimestampDatetimeProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with + MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unix_timestamp( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.UnixTimestampDatetimeProperty: + """unix_timestamp. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with + MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unix_timestamp( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.UnixTimestampDatetimeProperty: + """unix_timestamp. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with + MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def unix_timestamp( + self, body: Union[_models3.UnixTimestampDatetimeProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models3.UnixTimestampDatetimeProperty: + """unix_timestamp. + + :param body: Is one of the following types: UnixTimestampDatetimeProperty, JSON, IO[bytes] + Required. + :type body: ~encode.datetime.models.UnixTimestampDatetimeProperty or JSON or IO[bytes] + :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with + MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models3.UnixTimestampDatetimeProperty] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_property_unix_timestamp_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models3.UnixTimestampDatetimeProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def unix_timestamp_array( + self, + body: _models3.UnixTimestampArrayDatetimeProperty, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models3.UnixTimestampArrayDatetimeProperty: + """unix_timestamp_array. + + :param body: Required. + :type body: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is + compatible with MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unix_timestamp_array( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.UnixTimestampArrayDatetimeProperty: + """unix_timestamp_array. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is + compatible with MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def unix_timestamp_array( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models3.UnixTimestampArrayDatetimeProperty: + """unix_timestamp_array. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is + compatible with MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def unix_timestamp_array( + self, body: Union[_models3.UnixTimestampArrayDatetimeProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models3.UnixTimestampArrayDatetimeProperty: + """unix_timestamp_array. + + :param body: Is one of the following types: UnixTimestampArrayDatetimeProperty, JSON, IO[bytes] + Required. + :type body: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty or JSON or IO[bytes] + :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is + compatible with MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models3.UnixTimestampArrayDatetimeProperty] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_property_unix_timestamp_array_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models3.UnixTimestampArrayDatetimeProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/aio/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/aio/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/aio/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/operations/__init__.py new file mode 100644 index 00000000000..22f11074013 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import PropertyOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "PropertyOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/operations/_operations.py new file mode 100644 index 00000000000..175c05da5f7 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/operations/_operations.py @@ -0,0 +1,750 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ... import models as _models2 +from ..._configuration import DatetimeClientConfiguration +from ..._model_base import SdkJSONEncoder, _deserialize +from ..._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_property_default_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/encode/datetime/property/default" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_property_rfc3339_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/encode/datetime/property/rfc3339" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_property_rfc7231_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/encode/datetime/property/rfc7231" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_property_unix_timestamp_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/encode/datetime/property/unix-timestamp" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_property_unix_timestamp_array_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/encode/datetime/property/unix-timestamp-array" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +class PropertyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.datetime.DatetimeClient`'s + :attr:`property` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def default( + self, body: _models2.DefaultDatetimeProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.DefaultDatetimeProperty: + """default. + + :param body: Required. + :type body: ~encode.datetime.models.DefaultDatetimeProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.DefaultDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def default( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.DefaultDatetimeProperty: + """default. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.DefaultDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def default( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.DefaultDatetimeProperty: + """default. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.DefaultDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def default( + self, body: Union[_models2.DefaultDatetimeProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models2.DefaultDatetimeProperty: + """default. + + :param body: Is one of the following types: DefaultDatetimeProperty, JSON, IO[bytes] Required. + :type body: ~encode.datetime.models.DefaultDatetimeProperty or JSON or IO[bytes] + :return: DefaultDatetimeProperty. The DefaultDatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.DefaultDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models2.DefaultDatetimeProperty] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_property_default_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models2.DefaultDatetimeProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def rfc3339( + self, body: _models2.Rfc3339DatetimeProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Rfc3339DatetimeProperty: + """rfc3339. + + :param body: Required. + :type body: ~encode.datetime.models.Rfc3339DatetimeProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def rfc3339( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Rfc3339DatetimeProperty: + """rfc3339. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def rfc3339( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Rfc3339DatetimeProperty: + """rfc3339. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def rfc3339( + self, body: Union[_models2.Rfc3339DatetimeProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models2.Rfc3339DatetimeProperty: + """rfc3339. + + :param body: Is one of the following types: Rfc3339DatetimeProperty, JSON, IO[bytes] Required. + :type body: ~encode.datetime.models.Rfc3339DatetimeProperty or JSON or IO[bytes] + :return: Rfc3339DatetimeProperty. The Rfc3339DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc3339DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models2.Rfc3339DatetimeProperty] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_property_rfc3339_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models2.Rfc3339DatetimeProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def rfc7231( + self, body: _models2.Rfc7231DatetimeProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Rfc7231DatetimeProperty: + """rfc7231. + + :param body: Required. + :type body: ~encode.datetime.models.Rfc7231DatetimeProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def rfc7231( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Rfc7231DatetimeProperty: + """rfc7231. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def rfc7231( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.Rfc7231DatetimeProperty: + """rfc7231. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def rfc7231( + self, body: Union[_models2.Rfc7231DatetimeProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models2.Rfc7231DatetimeProperty: + """rfc7231. + + :param body: Is one of the following types: Rfc7231DatetimeProperty, JSON, IO[bytes] Required. + :type body: ~encode.datetime.models.Rfc7231DatetimeProperty or JSON or IO[bytes] + :return: Rfc7231DatetimeProperty. The Rfc7231DatetimeProperty is compatible with MutableMapping + :rtype: ~encode.datetime.models.Rfc7231DatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models2.Rfc7231DatetimeProperty] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_property_rfc7231_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models2.Rfc7231DatetimeProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def unix_timestamp( + self, body: _models2.UnixTimestampDatetimeProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.UnixTimestampDatetimeProperty: + """unix_timestamp. + + :param body: Required. + :type body: ~encode.datetime.models.UnixTimestampDatetimeProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with + MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unix_timestamp( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.UnixTimestampDatetimeProperty: + """unix_timestamp. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with + MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unix_timestamp( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.UnixTimestampDatetimeProperty: + """unix_timestamp. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with + MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def unix_timestamp( + self, body: Union[_models2.UnixTimestampDatetimeProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models2.UnixTimestampDatetimeProperty: + """unix_timestamp. + + :param body: Is one of the following types: UnixTimestampDatetimeProperty, JSON, IO[bytes] + Required. + :type body: ~encode.datetime.models.UnixTimestampDatetimeProperty or JSON or IO[bytes] + :return: UnixTimestampDatetimeProperty. The UnixTimestampDatetimeProperty is compatible with + MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models2.UnixTimestampDatetimeProperty] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_property_unix_timestamp_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models2.UnixTimestampDatetimeProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def unix_timestamp_array( + self, + body: _models2.UnixTimestampArrayDatetimeProperty, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models2.UnixTimestampArrayDatetimeProperty: + """unix_timestamp_array. + + :param body: Required. + :type body: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is + compatible with MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unix_timestamp_array( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.UnixTimestampArrayDatetimeProperty: + """unix_timestamp_array. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is + compatible with MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def unix_timestamp_array( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.UnixTimestampArrayDatetimeProperty: + """unix_timestamp_array. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is + compatible with MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def unix_timestamp_array( + self, body: Union[_models2.UnixTimestampArrayDatetimeProperty, JSON, IO[bytes]], **kwargs: Any + ) -> _models2.UnixTimestampArrayDatetimeProperty: + """unix_timestamp_array. + + :param body: Is one of the following types: UnixTimestampArrayDatetimeProperty, JSON, IO[bytes] + Required. + :type body: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty or JSON or IO[bytes] + :return: UnixTimestampArrayDatetimeProperty. The UnixTimestampArrayDatetimeProperty is + compatible with MutableMapping + :rtype: ~encode.datetime.models.UnixTimestampArrayDatetimeProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models2.UnixTimestampArrayDatetimeProperty] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_property_unix_timestamp_array_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models2.UnixTimestampArrayDatetimeProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/operations/_patch.py rename to packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/property/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/operations/__init__.py new file mode 100644 index 00000000000..97d3de4f9b2 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import QueryOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "QueryOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/operations/_operations.py new file mode 100644 index 00000000000..8481975ad8a --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/operations/_operations.py @@ -0,0 +1,293 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import DatetimeClientConfiguration +from ...operations._operations import ( + build_query_default_request, + build_query_rfc3339_request, + build_query_rfc7231_request, + build_query_unix_timestamp_array_request, + build_query_unix_timestamp_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class QueryOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.datetime.aio.DatetimeClient`'s + :attr:`query` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def default(self, *, value: datetime.datetime, **kwargs: Any) -> None: + """default. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_default_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def rfc3339(self, *, value: datetime.datetime, **kwargs: Any) -> None: + """rfc3339. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_rfc3339_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def rfc7231(self, *, value: datetime.datetime, **kwargs: Any) -> None: + """rfc7231. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_rfc7231_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def unix_timestamp(self, *, value: datetime.datetime, **kwargs: Any) -> None: + """unix_timestamp. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_unix_timestamp_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def unix_timestamp_array(self, *, value: List[datetime.datetime], **kwargs: Any) -> None: + """unix_timestamp_array. + + :keyword value: Required. + :paramtype value: list[~datetime.datetime] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_unix_timestamp_array_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/operations/__init__.py new file mode 100644 index 00000000000..97d3de4f9b2 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import QueryOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "QueryOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/operations/_operations.py new file mode 100644 index 00000000000..1a75883e516 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/operations/_operations.py @@ -0,0 +1,360 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ..._configuration import DatetimeClientConfiguration +from ..._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_query_default_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/encode/datetime/query/default" + + # Construct parameters + _params["value"] = _SERIALIZER.query("value", value, "iso-8601") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_rfc3339_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/encode/datetime/query/rfc3339" + + # Construct parameters + _params["value"] = _SERIALIZER.query("value", value, "iso-8601") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_rfc7231_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/encode/datetime/query/rfc7231" + + # Construct parameters + _params["value"] = _SERIALIZER.query("value", value, "rfc-1123") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_unix_timestamp_request(*, value: datetime.datetime, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/encode/datetime/query/unix-timestamp" + + # Construct parameters + _params["value"] = _SERIALIZER.query("value", value, "unix-time") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_unix_timestamp_array_request(*, value: List[datetime.datetime], **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/encode/datetime/query/unix-timestamp-array" + + # Construct parameters + _params["value"] = _SERIALIZER.query("value", value, "[unix-time]", div=",") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +class QueryOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.datetime.DatetimeClient`'s + :attr:`query` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def default( # pylint: disable=inconsistent-return-statements + self, *, value: datetime.datetime, **kwargs: Any + ) -> None: + """default. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_default_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def rfc3339( # pylint: disable=inconsistent-return-statements + self, *, value: datetime.datetime, **kwargs: Any + ) -> None: + """rfc3339. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_rfc3339_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def rfc7231( # pylint: disable=inconsistent-return-statements + self, *, value: datetime.datetime, **kwargs: Any + ) -> None: + """rfc7231. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_rfc7231_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def unix_timestamp( # pylint: disable=inconsistent-return-statements + self, *, value: datetime.datetime, **kwargs: Any + ) -> None: + """unix_timestamp. + + :keyword value: Required. + :paramtype value: ~datetime.datetime + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_unix_timestamp_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def unix_timestamp_array( # pylint: disable=inconsistent-return-statements + self, *, value: List[datetime.datetime], **kwargs: Any + ) -> None: + """unix_timestamp_array. + + :keyword value: Required. + :paramtype value: list[~datetime.datetime] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_unix_timestamp_array_request( + value=value, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/query/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/operations/__init__.py similarity index 79% rename from packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/__init__.py rename to packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/operations/__init__.py index d28aab0d0c1..dba58a39389 100644 --- a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/operations/__init__.py @@ -12,9 +12,6 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import QueryOperations # type: ignore -from ._operations import PropertyOperations # type: ignore -from ._operations import HeaderOperations # type: ignore from ._operations import ResponseHeaderOperations # type: ignore from ._patch import __all__ as _patch_all @@ -22,9 +19,6 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "QueryOperations", - "PropertyOperations", - "HeaderOperations", "ResponseHeaderOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/operations/_operations.py new file mode 100644 index 00000000000..2001a749820 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/operations/_operations.py @@ -0,0 +1,244 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import DatetimeClientConfiguration +from ...operations._operations import ( + build_response_header_default_request, + build_response_header_rfc3339_request, + build_response_header_rfc7231_request, + build_response_header_unix_timestamp_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ResponseHeaderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.datetime.aio.DatetimeClient`'s + :attr:`response_header` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def default(self, **kwargs: Any) -> None: + """default. + + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_response_header_default_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def rfc3339(self, **kwargs: Any) -> None: + """rfc3339. + + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_response_header_rfc3339_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["value"] = self._deserialize("iso-8601", response.headers.get("value")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def rfc7231(self, **kwargs: Any) -> None: + """rfc7231. + + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_response_header_rfc7231_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace_async + async def unix_timestamp(self, **kwargs: Any) -> None: + """unix_timestamp. + + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_response_header_unix_timestamp_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["value"] = self._deserialize("unix-time", response.headers.get("value")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/__init__.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/operations/__init__.py similarity index 79% rename from packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/__init__.py rename to packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/operations/__init__.py index d28aab0d0c1..dba58a39389 100644 --- a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/operations/__init__.py @@ -12,9 +12,6 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import QueryOperations # type: ignore -from ._operations import PropertyOperations # type: ignore -from ._operations import HeaderOperations # type: ignore from ._operations import ResponseHeaderOperations # type: ignore from ._patch import __all__ as _patch_all @@ -22,9 +19,6 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "QueryOperations", - "PropertyOperations", - "HeaderOperations", "ResponseHeaderOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/operations/_operations.py new file mode 100644 index 00000000000..7eaa9c7e1b9 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/operations/_operations.py @@ -0,0 +1,269 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ..._configuration import DatetimeClientConfiguration +from ..._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_response_header_default_request(**kwargs: Any) -> HttpRequest: + # Construct URL + _url = "/encode/datetime/responseheader/default" + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_response_header_rfc3339_request(**kwargs: Any) -> HttpRequest: + # Construct URL + _url = "/encode/datetime/responseheader/rfc3339" + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_response_header_rfc7231_request(**kwargs: Any) -> HttpRequest: + # Construct URL + _url = "/encode/datetime/responseheader/rfc7231" + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_response_header_unix_timestamp_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + # Construct URL + _url = "/encode/datetime/responseheader/unix-timestamp" + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class ResponseHeaderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~encode.datetime.DatetimeClient`'s + :attr:`response_header` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DatetimeClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def default(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """default. + + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_response_header_default_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def rfc3339(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """rfc3339. + + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_response_header_rfc3339_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["value"] = self._deserialize("iso-8601", response.headers.get("value")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def rfc7231(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """rfc7231. + + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_response_header_rfc7231_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["value"] = self._deserialize("rfc-1123", response.headers.get("value")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore + + @distributed_trace + def unix_timestamp(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """unix_timestamp. + + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_response_header_unix_timestamp_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["value"] = self._deserialize("unix-time", response.headers.get("value")) + + if cls: + return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/operations/_patch.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/responseheader/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/encode-duration/MANIFEST.in b/packages/typespec-python/test/azure/generated/encode-duration/MANIFEST.in index 62dea304f68..3979592823a 100644 --- a/packages/typespec-python/test/azure/generated/encode-duration/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/encode-duration/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include encode/duration/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include encode/__init__.py \ No newline at end of file +include encode/__init__.py diff --git a/packages/typespec-python/test/azure/generated/encode-duration/README.md b/packages/typespec-python/test/azure/generated/encode-duration/README.md index cf6a016066c..44530ab6f3d 100644 --- a/packages/typespec-python/test/azure/generated/encode-duration/README.md +++ b/packages/typespec-python/test/azure/generated/encode-duration/README.md @@ -1,5 +1,3 @@ - - # Encode Duration client library for Python @@ -17,6 +15,7 @@ python -m pip install encode-duration - You need an [Azure subscription][azure_sub] to use this package. - An existing Encode Duration instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/encode-numeric/MANIFEST.in b/packages/typespec-python/test/azure/generated/encode-numeric/MANIFEST.in index c5a0766925a..9f4baead01e 100644 --- a/packages/typespec-python/test/azure/generated/encode-numeric/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/encode-numeric/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include encode/numeric/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include encode/__init__.py \ No newline at end of file +include encode/__init__.py diff --git a/packages/typespec-python/test/azure/generated/encode-numeric/README.md b/packages/typespec-python/test/azure/generated/encode-numeric/README.md index b38cb9bc960..2561cacf778 100644 --- a/packages/typespec-python/test/azure/generated/encode-numeric/README.md +++ b/packages/typespec-python/test/azure/generated/encode-numeric/README.md @@ -1,5 +1,3 @@ - - # Encode Numeric client library for Python @@ -17,6 +15,7 @@ python -m pip install encode-numeric - You need an [Azure subscription][azure_sub] to use this package. - An existing Encode Numeric instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/headasbooleanfalse/MANIFEST.in b/packages/typespec-python/test/azure/generated/headasbooleanfalse/MANIFEST.in index 3a185557967..8d48e547d69 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleanfalse/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/headasbooleanfalse/MANIFEST.in @@ -2,4 +2,4 @@ include *.md include LICENSE include headasbooleanfalse/py.typed recursive-include tests *.py -recursive-include samples *.py *.md \ No newline at end of file +recursive-include samples *.py *.md diff --git a/packages/typespec-python/test/azure/generated/headasbooleanfalse/README.md b/packages/typespec-python/test/azure/generated/headasbooleanfalse/README.md index 8dd1d057d45..fc215bffae1 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleanfalse/README.md +++ b/packages/typespec-python/test/azure/generated/headasbooleanfalse/README.md @@ -1,5 +1,3 @@ - - # Headasbooleanfalse client library for Python @@ -17,6 +15,7 @@ python -m pip install headasbooleanfalse - You need an [Azure subscription][azure_sub] to use this package. - An existing Headasbooleanfalse instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/headasbooleantrue/MANIFEST.in b/packages/typespec-python/test/azure/generated/headasbooleantrue/MANIFEST.in index 89f2c0dccd2..d79293c6f31 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleantrue/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/headasbooleantrue/MANIFEST.in @@ -2,4 +2,4 @@ include *.md include LICENSE include headasbooleantrue/py.typed recursive-include tests *.py -recursive-include samples *.py *.md \ No newline at end of file +recursive-include samples *.py *.md diff --git a/packages/typespec-python/test/azure/generated/headasbooleantrue/README.md b/packages/typespec-python/test/azure/generated/headasbooleantrue/README.md index aa1d5599373..2ee76657dae 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleantrue/README.md +++ b/packages/typespec-python/test/azure/generated/headasbooleantrue/README.md @@ -1,5 +1,3 @@ - - # Headasbooleantrue client library for Python @@ -17,6 +15,7 @@ python -m pip install headasbooleantrue - You need an [Azure subscription][azure_sub] to use this package. - An existing Headasbooleantrue instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/parameters-basic/MANIFEST.in b/packages/typespec-python/test/azure/generated/parameters-basic/MANIFEST.in index 18f9767aa78..ec6eea5b987 100644 --- a/packages/typespec-python/test/azure/generated/parameters-basic/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/parameters-basic/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include parameters/basic/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include parameters/__init__.py \ No newline at end of file +include parameters/__init__.py diff --git a/packages/typespec-python/test/azure/generated/parameters-basic/README.md b/packages/typespec-python/test/azure/generated/parameters-basic/README.md index e2f7a58da85..d4b2e17c7c4 100644 --- a/packages/typespec-python/test/azure/generated/parameters-basic/README.md +++ b/packages/typespec-python/test/azure/generated/parameters-basic/README.md @@ -1,5 +1,3 @@ - - # Parameters Basic client library for Python @@ -17,6 +15,7 @@ python -m pip install parameters-basic - You need an [Azure subscription][azure_sub] to use this package. - An existing Parameters Basic instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/MANIFEST.in b/packages/typespec-python/test/azure/generated/parameters-body-optionality/MANIFEST.in index 0d45a014ef2..2dad293a4dc 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include parameters/bodyoptionality/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include parameters/__init__.py \ No newline at end of file +include parameters/__init__.py diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/README.md b/packages/typespec-python/test/azure/generated/parameters-body-optionality/README.md index c46b31a56b4..01040bbca9b 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/README.md +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/README.md @@ -1,5 +1,3 @@ - - # Parameters Bodyoptionality client library for Python @@ -17,6 +15,7 @@ python -m pip install parameters-bodyoptionality - You need an [Azure subscription][azure_sub] to use this package. - An existing Parameters Bodyoptionality instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_client.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_client.py index 3f3adb27c9c..89c3d462d4c 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_client.py +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_client.py @@ -15,8 +15,9 @@ from azure.core.rest import HttpRequest, HttpResponse from ._configuration import BodyOptionalityClientConfiguration +from ._operations import BodyOptionalityClientOperationsMixin from ._serialization import Deserializer, Serializer -from .operations import BodyOptionalityClientOperationsMixin, OptionalExplicitOperations +from .optionalexplicit.operations import OptionalExplicitOperations class BodyOptionalityClient(BodyOptionalityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_operations/__init__.py similarity index 90% rename from packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/__init__.py rename to packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_operations/__init__.py index e2c85131ec7..23fda0916ce 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_operations/__init__.py @@ -12,7 +12,6 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import OptionalExplicitOperations # type: ignore from ._operations import BodyOptionalityClientOperationsMixin # type: ignore from ._patch import __all__ as _patch_all @@ -20,7 +19,6 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "OptionalExplicitOperations", "BodyOptionalityClientOperationsMixin", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_operations/_operations.py new file mode 100644 index 00000000000..0e183074bb9 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_operations/_operations.py @@ -0,0 +1,281 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from .. import models as _models1 +from .._model_base import SdkJSONEncoder +from .._serialization import Serializer +from .._vendor import BodyOptionalityClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +_Unset: Any = object() +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_body_optionality_required_explicit_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + # Construct URL + _url = "/parameters/body-optionality/required-explicit" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_body_optionality_required_implicit_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + # Construct URL + _url = "/parameters/body-optionality/required-implicit" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +class BodyOptionalityClientOperationsMixin(BodyOptionalityClientMixinABC): + + @overload + def required_explicit( + self, body: _models1.BodyModel, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """required_explicit. + + :param body: Required. + :type body: ~parameters.bodyoptionality.models.BodyModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def required_explicit(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: + """required_explicit. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def required_explicit(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: + """required_explicit. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def required_explicit( # pylint: disable=inconsistent-return-statements + self, body: Union[_models1.BodyModel, JSON, IO[bytes]], **kwargs: Any + ) -> None: + """required_explicit. + + :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Required. + :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_body_optionality_required_explicit_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def required_implicit(self, *, name: str, content_type: str = "application/json", **kwargs: Any) -> None: + """required_implicit. + + :keyword name: Required. + :paramtype name: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def required_implicit(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: + """required_implicit. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def required_implicit(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> None: + """required_implicit. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def required_implicit( # pylint: disable=inconsistent-return-statements + self, body: Union[JSON, IO[bytes]] = _Unset, *, name: str = _Unset, **kwargs: Any + ) -> None: + """required_implicit. + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword name: Required. + :paramtype name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + if body is _Unset: + if name is _Unset: + raise TypeError("missing required argument: name") + body = {"name": name} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_body_optionality_required_implicit_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py index 9ce07013b5f..0dcc3936e44 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py @@ -15,8 +15,9 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer +from ..optionalexplicit.aio.operations import OptionalExplicitOperations from ._configuration import BodyOptionalityClientConfiguration -from .operations import BodyOptionalityClientOperationsMixin, OptionalExplicitOperations +from ._operations import BodyOptionalityClientOperationsMixin class BodyOptionalityClient(BodyOptionalityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/__init__.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/__init__.py similarity index 90% rename from packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/__init__.py rename to packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/__init__.py index e2c85131ec7..23fda0916ce 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/__init__.py @@ -12,7 +12,6 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import OptionalExplicitOperations # type: ignore from ._operations import BodyOptionalityClientOperationsMixin # type: ignore from ._patch import __all__ as _patch_all @@ -20,7 +19,6 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "OptionalExplicitOperations", "BodyOptionalityClientOperationsMixin", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_operations.py new file mode 100644 index 00000000000..ab625236008 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_operations.py @@ -0,0 +1,256 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict + +from ... import models as _models2 +from ..._model_base import SdkJSONEncoder +from ..._operations._operations import ( + build_body_optionality_required_explicit_request, + build_body_optionality_required_implicit_request, +) +from .._vendor import BodyOptionalityClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +_Unset: Any = object() +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class BodyOptionalityClientOperationsMixin(BodyOptionalityClientMixinABC): + + @overload + async def required_explicit( + self, body: _models2.BodyModel, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """required_explicit. + + :param body: Required. + :type body: ~parameters.bodyoptionality.models.BodyModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def required_explicit(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: + """required_explicit. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def required_explicit( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """required_explicit. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def required_explicit(self, body: Union[_models2.BodyModel, JSON, IO[bytes]], **kwargs: Any) -> None: + """required_explicit. + + :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Required. + :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_body_optionality_required_explicit_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def required_implicit(self, *, name: str, content_type: str = "application/json", **kwargs: Any) -> None: + """required_implicit. + + :keyword name: Required. + :paramtype name: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def required_implicit(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> None: + """required_implicit. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def required_implicit( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """required_implicit. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def required_implicit( + self, body: Union[JSON, IO[bytes]] = _Unset, *, name: str = _Unset, **kwargs: Any + ) -> None: + """required_implicit. + + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword name: Required. + :paramtype name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + if body is _Unset: + if name is _Unset: + raise TypeError("missing required argument: name") + body = {"name": name} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_body_optionality_required_implicit_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/__init__.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/__init__.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/__init__.py new file mode 100644 index 00000000000..83a10b55fe3 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import OptionalExplicitOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "OptionalExplicitOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_operations.py new file mode 100644 index 00000000000..1de50291f6c --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_operations.py @@ -0,0 +1,267 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict + +from .... import models as _models3 +from ...._model_base import SdkJSONEncoder +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import BodyOptionalityClientConfiguration +from ...operations._operations import build_optional_explicit_omit_request, build_optional_explicit_set_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class OptionalExplicitOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~parameters.bodyoptionality.aio.BodyOptionalityClient`'s + :attr:`optional_explicit` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BodyOptionalityClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def set( + self, body: Optional[_models3.BodyModel] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """set. + + :param body: Default value is None. + :type body: ~parameters.bodyoptionality.models.BodyModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set(self, body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: + """set. + + :param body: Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def set( + self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """set. + + :param body: Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def set(self, body: Optional[Union[_models3.BodyModel, JSON, IO[bytes]]] = None, **kwargs: Any) -> None: + """set. + + :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Default value is None. + :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_optional_explicit_set_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def omit( + self, body: Optional[_models3.BodyModel] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """omit. + + :param body: Default value is None. + :type body: ~parameters.bodyoptionality.models.BodyModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def omit(self, body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: + """omit. + + :param body: Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def omit( + self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """omit. + + :param body: Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def omit(self, body: Optional[Union[_models3.BodyModel, JSON, IO[bytes]]] = None, **kwargs: Any) -> None: + """omit. + + :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Default value is None. + :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_optional_explicit_omit_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/__init__.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/__init__.py new file mode 100644 index 00000000000..83a10b55fe3 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import OptionalExplicitOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "OptionalExplicitOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_operations.py new file mode 100644 index 00000000000..ed8d6706078 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_operations.py @@ -0,0 +1,297 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ... import models as _models2 +from ..._configuration import BodyOptionalityClientConfiguration +from ..._model_base import SdkJSONEncoder +from ..._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_optional_explicit_set_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + # Construct URL + _url = "/parameters/body-optionality/optional-explicit/set" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_optional_explicit_omit_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + # Construct URL + _url = "/parameters/body-optionality/optional-explicit/omit" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +class OptionalExplicitOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~parameters.bodyoptionality.BodyOptionalityClient`'s + :attr:`optional_explicit` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: BodyOptionalityClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def set( + self, body: Optional[_models2.BodyModel] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """set. + + :param body: Default value is None. + :type body: ~parameters.bodyoptionality.models.BodyModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set(self, body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: + """set. + + :param body: Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def set(self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: + """set. + + :param body: Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def set( # pylint: disable=inconsistent-return-statements + self, body: Optional[Union[_models2.BodyModel, JSON, IO[bytes]]] = None, **kwargs: Any + ) -> None: + """set. + + :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Default value is None. + :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_optional_explicit_set_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def omit( + self, body: Optional[_models2.BodyModel] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """omit. + + :param body: Default value is None. + :type body: ~parameters.bodyoptionality.models.BodyModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def omit(self, body: Optional[JSON] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: + """omit. + + :param body: Default value is None. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def omit(self, body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any) -> None: + """omit. + + :param body: Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def omit( # pylint: disable=inconsistent-return-statements + self, body: Optional[Union[_models2.BodyModel, JSON, IO[bytes]]] = None, **kwargs: Any + ) -> None: + """omit. + + :param body: Is one of the following types: BodyModel, JSON, IO[bytes] Default value is None. + :type body: ~parameters.bodyoptionality.models.BodyModel or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_optional_explicit_omit_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/MANIFEST.in b/packages/typespec-python/test/azure/generated/parameters-collection-format/MANIFEST.in index 90d0ba2db1f..e4e65c4a1d5 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include parameters/collectionformat/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include parameters/__init__.py \ No newline at end of file +include parameters/__init__.py diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/README.md b/packages/typespec-python/test/azure/generated/parameters-collection-format/README.md index d094692432e..cc2e770e018 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/README.md +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/README.md @@ -1,5 +1,3 @@ - - # Parameters Collectionformat client library for Python @@ -17,6 +15,7 @@ python -m pip install parameters-collectionformat - You need an [Azure subscription][azure_sub] to use this package. - An existing Parameters Collectionformat instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/_client.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/_client.py index d78764a0ca5..e729f304369 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/_client.py +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/_client.py @@ -16,7 +16,8 @@ from ._configuration import CollectionFormatClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import HeaderOperations, QueryOperations +from .header.operations import HeaderOperations +from .query.operations import QueryOperations class CollectionFormatClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/_client.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/_client.py index 436da0e76b5..80e29e9097b 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/_client.py @@ -15,8 +15,9 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer +from ..header.aio.operations import HeaderOperations +from ..query.aio.operations import QueryOperations from ._configuration import CollectionFormatClientConfiguration -from .operations import HeaderOperations, QueryOperations class CollectionFormatClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/__init__.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/__init__.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/operations/__init__.py new file mode 100644 index 00000000000..1ab30f60268 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import HeaderOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "HeaderOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/operations/_operations.py new file mode 100644 index 00000000000..b70837bb6f6 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/operations/_operations.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import CollectionFormatClientConfiguration +from ...operations._operations import build_header_csv_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class HeaderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~parameters.collectionformat.aio.CollectionFormatClient`'s + :attr:`header` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CollectionFormatClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def csv(self, *, colors: List[str], **kwargs: Any) -> None: + """csv. + + :keyword colors: Possible values for colors are [blue,red,green]. Required. + :paramtype colors: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_csv_request( + colors=colors, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/operations/__init__.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/operations/__init__.py new file mode 100644 index 00000000000..1ab30f60268 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import HeaderOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "HeaderOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/operations/_operations.py new file mode 100644 index 00000000000..223ec858a67 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/operations/_operations.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ..._configuration import CollectionFormatClientConfiguration +from ..._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_header_csv_request(*, colors: List[str], **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + # Construct URL + _url = "/parameters/collection-format/header/csv" + + # Construct headers + _headers["colors"] = _SERIALIZER.header("colors", colors, "[str]", div=",") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +class HeaderOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~parameters.collectionformat.CollectionFormatClient`'s + :attr:`header` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CollectionFormatClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """csv. + + :keyword colors: Possible values for colors are [blue,red,green]. Required. + :paramtype colors: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_header_csv_request( + colors=colors, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/__init__.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/__init__.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/operations/__init__.py new file mode 100644 index 00000000000..97d3de4f9b2 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import QueryOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "QueryOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/operations/_operations.py similarity index 77% rename from packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py rename to packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/operations/_operations.py index 315a97a9bfb..6ea57b3c086 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/operations/_operations.py @@ -21,15 +21,14 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async -from ..._serialization import Deserializer, Serializer +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import CollectionFormatClientConfiguration from ...operations._operations import ( - build_header_csv_request, build_query_csv_request, build_query_multi_request, build_query_pipes_request, build_query_ssv_request, ) -from .._configuration import CollectionFormatClientConfiguration if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -243,68 +242,3 @@ async def csv(self, *, colors: List[str], **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - - -class HeaderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~parameters.collectionformat.aio.CollectionFormatClient`'s - :attr:`header` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CollectionFormatClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def csv(self, *, colors: List[str], **kwargs: Any) -> None: - """csv. - - :keyword colors: Possible values for colors are [blue,red,green]. Required. - :paramtype colors: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_csv_request( - colors=colors, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/operations/__init__.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/operations/__init__.py new file mode 100644 index 00000000000..97d3de4f9b2 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import QueryOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "QueryOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/operations/_operations.py similarity index 77% rename from packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py rename to packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/operations/_operations.py index acc529a3411..4abda2c6b78 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/operations/_operations.py @@ -22,8 +22,8 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict -from .._configuration import CollectionFormatClientConfiguration -from .._serialization import Deserializer, Serializer +from ..._configuration import CollectionFormatClientConfiguration +from ..._serialization import Deserializer, Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -84,18 +84,6 @@ def build_query_csv_request(*, colors: List[str], **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, **kwargs) -def build_header_csv_request(*, colors: List[str], **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - # Construct URL - _url = "/parameters/collection-format/header/csv" - - # Construct headers - _headers["colors"] = _SERIALIZER.header("colors", colors, "[str]", div=",") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - class QueryOperations: """ .. warning:: @@ -300,68 +288,3 @@ def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i if cls: return cls(pipeline_response, None, {}) # type: ignore - - -class HeaderOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~parameters.collectionformat.CollectionFormatClient`'s - :attr:`header` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CollectionFormatClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """csv. - - :keyword colors: Possible values for colors are [blue,red,green]. Required. - :paramtype colors: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_header_csv_request( - colors=colors, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/parameters-spread/MANIFEST.in b/packages/typespec-python/test/azure/generated/parameters-spread/MANIFEST.in index 1deab2a88dd..eae446dee33 100644 --- a/packages/typespec-python/test/azure/generated/parameters-spread/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/parameters-spread/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include parameters/spread/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include parameters/__init__.py \ No newline at end of file +include parameters/__init__.py diff --git a/packages/typespec-python/test/azure/generated/parameters-spread/README.md b/packages/typespec-python/test/azure/generated/parameters-spread/README.md index fee9766d4ec..7b257b82d8a 100644 --- a/packages/typespec-python/test/azure/generated/parameters-spread/README.md +++ b/packages/typespec-python/test/azure/generated/parameters-spread/README.md @@ -1,5 +1,3 @@ - - # Parameters Spread client library for Python @@ -17,6 +15,7 @@ python -m pip install parameters-spread - You need an [Azure subscription][azure_sub] to use this package. - An existing Parameters Spread instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/payload-content-negotiation/MANIFEST.in b/packages/typespec-python/test/azure/generated/payload-content-negotiation/MANIFEST.in index dc7a7e5536d..5a3e215c4f4 100644 --- a/packages/typespec-python/test/azure/generated/payload-content-negotiation/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/payload-content-negotiation/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/contentnegotiation/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/azure/generated/payload-content-negotiation/README.md b/packages/typespec-python/test/azure/generated/payload-content-negotiation/README.md index 861d021514d..1779f7bb274 100644 --- a/packages/typespec-python/test/azure/generated/payload-content-negotiation/README.md +++ b/packages/typespec-python/test/azure/generated/payload-content-negotiation/README.md @@ -1,5 +1,3 @@ - - # Payload Contentnegotiation client library for Python @@ -17,6 +15,7 @@ python -m pip install payload-contentnegotiation - You need an [Azure subscription][azure_sub] to use this package. - An existing Payload Contentnegotiation instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/MANIFEST.in b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/MANIFEST.in index a4b16dd0a5c..5294299b234 100644 --- a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/jsonmergepatch/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/README.md b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/README.md index 8b6658000df..46b173ee6a1 100644 --- a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/README.md +++ b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/README.md @@ -1,5 +1,3 @@ - - # Payload Jsonmergepatch client library for Python @@ -17,6 +15,7 @@ python -m pip install payload-jsonmergepatch - You need an [Azure subscription][azure_sub] to use this package. - An existing Payload Jsonmergepatch instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/MANIFEST.in b/packages/typespec-python/test/azure/generated/payload-media-type/MANIFEST.in index 72b1c340a64..4c10e654b7f 100644 --- a/packages/typespec-python/test/azure/generated/payload-media-type/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/payload-media-type/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/mediatype/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/README.md b/packages/typespec-python/test/azure/generated/payload-media-type/README.md index a45881ae204..3776cd77177 100644 --- a/packages/typespec-python/test/azure/generated/payload-media-type/README.md +++ b/packages/typespec-python/test/azure/generated/payload-media-type/README.md @@ -1,5 +1,3 @@ - - # Payload Mediatype client library for Python @@ -17,6 +15,7 @@ python -m pip install payload-mediatype - You need an [Azure subscription][azure_sub] to use this package. - An existing Payload Mediatype instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/_client.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/_client.py index f13a86816e6..93d95fcc350 100644 --- a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/_client.py +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/_client.py @@ -16,7 +16,7 @@ from ._configuration import MediaTypeClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import StringBodyOperations +from .stringbody.operations import StringBodyOperations class MediaTypeClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/_client.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/_client.py index ff26c34ced3..0438cdd8725 100644 --- a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/_client.py @@ -15,8 +15,8 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer +from ..stringbody.aio.operations import StringBodyOperations from ._configuration import MediaTypeClientConfiguration -from .operations import StringBodyOperations class MediaTypeClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/__init__.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/aio/__init__.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/aio/operations/__init__.py similarity index 100% rename from packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/__init__.py rename to packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/aio/operations/__init__.py diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/aio/operations/_operations.py similarity index 98% rename from packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py rename to packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/aio/operations/_operations.py index 9d774613da8..5bdf070009d 100644 --- a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/aio/operations/_operations.py @@ -25,15 +25,15 @@ from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict -from ..._model_base import SdkJSONEncoder, _deserialize -from ..._serialization import Deserializer, Serializer +from ...._model_base import SdkJSONEncoder, _deserialize +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import MediaTypeClientConfiguration from ...operations._operations import ( build_string_body_get_as_json_request, build_string_body_get_as_text_request, build_string_body_send_as_json_request, build_string_body_send_as_text_request, ) -from .._configuration import MediaTypeClientConfiguration if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/__init__.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/operations/__init__.py similarity index 100% rename from packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/__init__.py rename to packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/operations/__init__.py diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/operations/_operations.py similarity index 98% rename from packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_operations.py rename to packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/operations/_operations.py index 4d43b6ef488..e462d39a4b8 100644 --- a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/operations/_operations.py @@ -25,9 +25,9 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict -from .._configuration import MediaTypeClientConfiguration -from .._model_base import SdkJSONEncoder, _deserialize -from .._serialization import Deserializer, Serializer +from ..._configuration import MediaTypeClientConfiguration +from ..._model_base import SdkJSONEncoder, _deserialize +from ..._serialization import Deserializer, Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/operations/_patch.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/stringbody/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/payload-multipart/MANIFEST.in b/packages/typespec-python/test/azure/generated/payload-multipart/MANIFEST.in index c41546020da..022fdb3ee1f 100644 --- a/packages/typespec-python/test/azure/generated/payload-multipart/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/payload-multipart/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/multipart/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/azure/generated/payload-multipart/README.md b/packages/typespec-python/test/azure/generated/payload-multipart/README.md index 1988da6d7e5..522ddb6785f 100644 --- a/packages/typespec-python/test/azure/generated/payload-multipart/README.md +++ b/packages/typespec-python/test/azure/generated/payload-multipart/README.md @@ -1,5 +1,3 @@ - - # Payload Multipart client library for Python @@ -17,6 +15,7 @@ python -m pip install payload-multipart - You need an [Azure subscription][azure_sub] to use this package. - An existing Payload Multipart instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/MANIFEST.in b/packages/typespec-python/test/azure/generated/payload-pageable/MANIFEST.in index f2e18952488..24d62ee29fd 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/payload-pageable/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/pageable/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/README.md b/packages/typespec-python/test/azure/generated/payload-pageable/README.md index 6b6afe92184..f4500dd3a18 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/README.md +++ b/packages/typespec-python/test/azure/generated/payload-pageable/README.md @@ -1,5 +1,3 @@ - - # Payload Pageable client library for Python @@ -17,6 +15,7 @@ python -m pip install payload-pageable - You need an [Azure subscription][azure_sub] to use this package. - An existing Payload Pageable instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_client.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_client.py index b46b94ad514..967152cad99 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_client.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_client.py @@ -16,7 +16,7 @@ from ._configuration import PageableClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import ServerDrivenPaginationOperations +from .serverdrivenpagination.operations import ServerDrivenPaginationOperations class PageableClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_client.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_client.py index e9c97b922a8..402f54fdcf4 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_client.py @@ -15,8 +15,8 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer +from ..serverdrivenpagination.aio.operations import ServerDrivenPaginationOperations from ._configuration import PageableClientConfiguration -from .operations import ServerDrivenPaginationOperations class PageableClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/__init__.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/aio/__init__.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/__init__.py similarity index 100% rename from packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/operations/__init__.py rename to packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/__init__.py diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_operations.py new file mode 100644 index 00000000000..3519ce73663 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_operations.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace + +from .... import models as _models3 +from ...._model_base import _deserialize +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import PageableClientConfiguration +from ...continuationtoken.aio.operations._operations import ServerDrivenPaginationContinuationTokenOperations +from ...operations._operations import build_server_driven_pagination_link_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServerDrivenPaginationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.pageable.aio.PageableClient`'s + :attr:`server_driven_pagination` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PageableClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.continuation_token = ServerDrivenPaginationContinuationTokenOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + @distributed_trace + def link(self, **kwargs: Any) -> AsyncIterable["_models3.Pet"]: + """link. + + :return: An iterator like instance of Pet + :rtype: ~azure.core.async_paging.AsyncItemPaged[~payload.pageable.models.Pet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models3.Pet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_server_driven_pagination_link_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models3.Pet], deserialized.get("pets", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("next") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/__init__.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/__init__.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_operations.py similarity index 72% rename from packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/operations/_operations.py rename to packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_operations.py index 00578f5274d..04c63181322 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_operations.py @@ -22,17 +22,16 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace -from ... import models as _models -from ..._model_base import _deserialize -from ..._serialization import Deserializer, Serializer +from ..... import models as _models4 +from ....._model_base import _deserialize +from ....._serialization import Deserializer, Serializer +from .....aio._configuration import PageableClientConfiguration from ...operations._operations import ( build_server_driven_pagination_continuation_token_request_header_response_body_request, build_server_driven_pagination_continuation_token_request_header_response_header_request, build_server_driven_pagination_continuation_token_request_query_response_body_request, build_server_driven_pagination_continuation_token_request_query_response_header_request, - build_server_driven_pagination_link_request, ) -from .._configuration import PageableClientConfiguration if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -42,98 +41,6 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ServerDrivenPaginationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~payload.pageable.aio.PageableClient`'s - :attr:`server_driven_pagination` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PageableClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.continuation_token = ServerDrivenPaginationContinuationTokenOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - @distributed_trace - def link(self, **kwargs: Any) -> AsyncIterable["_models.Pet"]: - """link. - - :return: An iterator like instance of Pet - :rtype: ~azure.core.async_paging.AsyncItemPaged[~payload.pageable.models.Pet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Pet]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_server_driven_pagination_link_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - _request = HttpRequest("GET", next_link) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pet], deserialized.get("pets", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("next") or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - raise HttpResponseError(response=response) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - class ServerDrivenPaginationContinuationTokenOperations: # pylint: disable=name-too-long """ .. warning:: @@ -154,7 +61,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def request_query_response_body( self, *, foo: Optional[str] = None, bar: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Pet"]: + ) -> AsyncIterable["_models4.Pet"]: """request_query_response_body. :keyword foo: Default value is None. @@ -168,7 +75,7 @@ def request_query_response_body( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Pet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models4.Pet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -195,7 +102,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pet], deserialized.get("pets", [])) + list_of_elem = _deserialize(List[_models4.Pet], deserialized.get("pets", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextToken") or None, AsyncList(list_of_elem) @@ -220,7 +127,7 @@ async def get_next(_continuation_token=None): @distributed_trace def request_header_response_body( self, *, foo: Optional[str] = None, bar: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Pet"]: + ) -> AsyncIterable["_models4.Pet"]: """request_header_response_body. :keyword foo: Default value is None. @@ -234,7 +141,7 @@ def request_header_response_body( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Pet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models4.Pet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -261,7 +168,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pet], deserialized.get("pets", [])) + list_of_elem = _deserialize(List[_models4.Pet], deserialized.get("pets", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextToken") or None, AsyncList(list_of_elem) @@ -286,7 +193,7 @@ async def get_next(_continuation_token=None): @distributed_trace def request_query_response_header( self, *, foo: Optional[str] = None, bar: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Pet"]: + ) -> AsyncIterable["_models4.Pet"]: """request_query_response_header. :keyword foo: Default value is None. @@ -300,7 +207,7 @@ def request_query_response_header( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Pet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models4.Pet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -327,7 +234,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pet], deserialized.get("pets", [])) + list_of_elem = _deserialize(List[_models4.Pet], deserialized.get("pets", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return pipeline_response.http_response.headers.get("next-token") or None, AsyncList(list_of_elem) @@ -352,7 +259,7 @@ async def get_next(_continuation_token=None): @distributed_trace def request_header_response_header( self, *, foo: Optional[str] = None, bar: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Pet"]: + ) -> AsyncIterable["_models4.Pet"]: """request_header_response_header. :keyword foo: Default value is None. @@ -366,7 +273,7 @@ def request_header_response_header( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Pet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models4.Pet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -393,7 +300,7 @@ def prepare_request(_continuation_token=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pet], deserialized.get("pets", [])) + list_of_elem = _deserialize(List[_models4.Pet], deserialized.get("pets", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return pipeline_response.http_response.headers.get("next-token") or None, AsyncList(list_of_elem) diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/__init__.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_operations.py similarity index 76% rename from packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/operations/_operations.py rename to packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_operations.py index 83eb162384b..ee4803f0993 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_operations.py @@ -24,10 +24,10 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict -from .. import models as _models -from .._configuration import PageableClientConfiguration -from .._model_base import _deserialize -from .._serialization import Deserializer, Serializer +from .... import models as _models3 +from ...._configuration import PageableClientConfiguration +from ...._model_base import _deserialize +from ...._serialization import Deserializer, Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -40,20 +40,6 @@ _SERIALIZER.client_side_validation = False -def build_server_driven_pagination_link_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/payload/pageable/server-driven-pagination/link" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - def build_server_driven_pagination_continuation_token_request_query_response_body_request( # pylint: disable=name-too-long *, token: Optional[str] = None, foo: Optional[str] = None, bar: Optional[str] = None, **kwargs: Any ) -> HttpRequest: @@ -154,98 +140,6 @@ def build_server_driven_pagination_continuation_token_request_header_response_he return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class ServerDrivenPaginationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~payload.pageable.PageableClient`'s - :attr:`server_driven_pagination` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PageableClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.continuation_token = ServerDrivenPaginationContinuationTokenOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - @distributed_trace - def link(self, **kwargs: Any) -> Iterable["_models.Pet"]: - """link. - - :return: An iterator like instance of Pet - :rtype: ~azure.core.paging.ItemPaged[~payload.pageable.models.Pet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Pet]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_server_driven_pagination_link_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - _request = HttpRequest("GET", next_link) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pet], deserialized.get("pets", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("next") or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - raise HttpResponseError(response=response) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - class ServerDrivenPaginationContinuationTokenOperations: # pylint: disable=name-too-long """ .. warning:: @@ -266,7 +160,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def request_query_response_body( self, *, foo: Optional[str] = None, bar: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Pet"]: + ) -> Iterable["_models3.Pet"]: """request_query_response_body. :keyword foo: Default value is None. @@ -280,7 +174,7 @@ def request_query_response_body( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Pet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models3.Pet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -307,7 +201,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pet], deserialized.get("pets", [])) + list_of_elem = _deserialize(List[_models3.Pet], deserialized.get("pets", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextToken") or None, iter(list_of_elem) @@ -332,7 +226,7 @@ def get_next(_continuation_token=None): @distributed_trace def request_header_response_body( self, *, foo: Optional[str] = None, bar: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Pet"]: + ) -> Iterable["_models3.Pet"]: """request_header_response_body. :keyword foo: Default value is None. @@ -346,7 +240,7 @@ def request_header_response_body( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Pet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models3.Pet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -373,7 +267,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pet], deserialized.get("pets", [])) + list_of_elem = _deserialize(List[_models3.Pet], deserialized.get("pets", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextToken") or None, iter(list_of_elem) @@ -398,7 +292,7 @@ def get_next(_continuation_token=None): @distributed_trace def request_query_response_header( self, *, foo: Optional[str] = None, bar: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Pet"]: + ) -> Iterable["_models3.Pet"]: """request_query_response_header. :keyword foo: Default value is None. @@ -412,7 +306,7 @@ def request_query_response_header( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Pet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models3.Pet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -439,7 +333,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pet], deserialized.get("pets", [])) + list_of_elem = _deserialize(List[_models3.Pet], deserialized.get("pets", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return pipeline_response.http_response.headers.get("next-token") or None, iter(list_of_elem) @@ -464,7 +358,7 @@ def get_next(_continuation_token=None): @distributed_trace def request_header_response_header( self, *, foo: Optional[str] = None, bar: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Pet"]: + ) -> Iterable["_models3.Pet"]: """request_header_response_header. :keyword foo: Default value is None. @@ -478,7 +372,7 @@ def request_header_response_header( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Pet]] = kwargs.pop("cls", None) + cls: ClsType[List[_models3.Pet]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -505,7 +399,7 @@ def prepare_request(_continuation_token=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Pet], deserialized.get("pets", [])) + list_of_elem = _deserialize(List[_models3.Pet], deserialized.get("pets", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return pipeline_response.http_response.headers.get("next-token") or None, iter(list_of_elem) diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/operations/__init__.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/operations/__init__.py similarity index 100% rename from packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/operations/__init__.py rename to packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/operations/__init__.py diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/operations/_operations.py new file mode 100644 index 00000000000..aa7026c01c1 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/operations/_operations.py @@ -0,0 +1,146 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ... import models as _models2 +from ..._configuration import PageableClientConfiguration +from ..._model_base import _deserialize +from ..._serialization import Deserializer, Serializer +from ..continuationtoken.operations._operations import ServerDrivenPaginationContinuationTokenOperations + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_server_driven_pagination_link_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/payload/pageable/server-driven-pagination/link" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +class ServerDrivenPaginationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.pageable.PageableClient`'s + :attr:`server_driven_pagination` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PageableClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.continuation_token = ServerDrivenPaginationContinuationTokenOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + @distributed_trace + def link(self, **kwargs: Any) -> Iterable["_models2.Pet"]: + """link. + + :return: An iterator like instance of Pet + :rtype: ~azure.core.paging.ItemPaged[~payload.pageable.models.Pet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models2.Pet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_server_driven_pagination_link_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models2.Pet], deserialized.get("pets", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("next") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/payload-xml/MANIFEST.in b/packages/typespec-python/test/azure/generated/payload-xml/MANIFEST.in index 07a0c716455..ef8f20ba112 100644 --- a/packages/typespec-python/test/azure/generated/payload-xml/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/payload-xml/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/xml/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/azure/generated/payload-xml/README.md b/packages/typespec-python/test/azure/generated/payload-xml/README.md index 34bf5fe0496..3ffbae66c91 100644 --- a/packages/typespec-python/test/azure/generated/payload-xml/README.md +++ b/packages/typespec-python/test/azure/generated/payload-xml/README.md @@ -1,5 +1,3 @@ - - # Payload Xml client library for Python @@ -17,6 +15,7 @@ python -m pip install payload-xml - You need an [Azure subscription][azure_sub] to use this package. - An existing Payload Xml instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/MANIFEST.in b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/MANIFEST.in index 7afdb8f1707..0afda28e610 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/MANIFEST.in @@ -4,4 +4,4 @@ include resiliency/srv/driven1/py.typed recursive-include tests *.py recursive-include samples *.py *.md include resiliency/__init__.py -include resiliency/srv/__init__.py \ No newline at end of file +include resiliency/srv/__init__.py diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/README.md b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/README.md index a2c41ff113f..74ce9cfcdee 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/README.md +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/README.md @@ -1,5 +1,3 @@ - - # ResiliencySrvDriven1 client library for Python @@ -17,6 +15,7 @@ python -m pip install resiliency-srv-driven1 - You need an [Azure subscription][azure_sub] to use this package. - An existing ResiliencySrvDriven1 instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/MANIFEST.in b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/MANIFEST.in index 299f0760ca6..22e737be264 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/MANIFEST.in @@ -4,4 +4,4 @@ include resiliency/srv/driven2/py.typed recursive-include tests *.py recursive-include samples *.py *.md include resiliency/__init__.py -include resiliency/srv/__init__.py \ No newline at end of file +include resiliency/srv/__init__.py diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/README.md b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/README.md index a6703b3c658..18f39c6183d 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/README.md +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/README.md @@ -1,5 +1,3 @@ - - # ResiliencySrvDriven2 client library for Python @@ -17,6 +15,7 @@ python -m pip install resiliency-srv-driven2 - You need an [Azure subscription][azure_sub] to use this package. - An existing ResiliencySrvDriven2 instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/response-status-code-range/MANIFEST.in b/packages/typespec-python/test/azure/generated/response-status-code-range/MANIFEST.in index 87b2b3fe020..3b3539da09f 100644 --- a/packages/typespec-python/test/azure/generated/response-status-code-range/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/response-status-code-range/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include response/statuscoderange/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include response/__init__.py \ No newline at end of file +include response/__init__.py diff --git a/packages/typespec-python/test/azure/generated/response-status-code-range/README.md b/packages/typespec-python/test/azure/generated/response-status-code-range/README.md index 5e4613dfc2b..a29a98fa666 100644 --- a/packages/typespec-python/test/azure/generated/response-status-code-range/README.md +++ b/packages/typespec-python/test/azure/generated/response-status-code-range/README.md @@ -1,5 +1,3 @@ - - # Response Statuscoderange client library for Python @@ -17,6 +15,7 @@ python -m pip install response-statuscoderange - You need an [Azure subscription][azure_sub] to use this package. - An existing Response Statuscoderange instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/routes/MANIFEST.in b/packages/typespec-python/test/azure/generated/routes/MANIFEST.in index d3777f92f7f..0d81e3a9d35 100644 --- a/packages/typespec-python/test/azure/generated/routes/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/routes/MANIFEST.in @@ -2,4 +2,4 @@ include *.md include LICENSE include routes/py.typed recursive-include tests *.py -recursive-include samples *.py *.md \ No newline at end of file +recursive-include samples *.py *.md diff --git a/packages/typespec-python/test/azure/generated/routes/README.md b/packages/typespec-python/test/azure/generated/routes/README.md index 492036ee953..417beeedb40 100644 --- a/packages/typespec-python/test/azure/generated/routes/README.md +++ b/packages/typespec-python/test/azure/generated/routes/README.md @@ -1,5 +1,3 @@ - - # Routes client library for Python @@ -17,6 +15,7 @@ python -m pip install routes - You need an [Azure subscription][azure_sub] to use this package. - An existing Routes instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/routes/routes/_client.py b/packages/typespec-python/test/azure/generated/routes/routes/_client.py index 7e94d2e04ef..45fa7930063 100644 --- a/packages/typespec-python/test/azure/generated/routes/routes/_client.py +++ b/packages/typespec-python/test/azure/generated/routes/routes/_client.py @@ -16,12 +16,9 @@ from ._configuration import RoutesClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import ( - InInterfaceOperations, - PathParametersOperations, - QueryParametersOperations, - RoutesClientOperationsMixin, -) +from .operations import InInterfaceOperations, RoutesClientOperationsMixin +from .pathparameters.operations import PathParametersOperations +from .queryparameters.operations import QueryParametersOperations class RoutesClient(RoutesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/routes/routes/aio/_client.py b/packages/typespec-python/test/azure/generated/routes/routes/aio/_client.py index 8af3b6a1eef..7345d6d8d94 100644 --- a/packages/typespec-python/test/azure/generated/routes/routes/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/routes/routes/aio/_client.py @@ -15,13 +15,10 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer +from ..pathparameters.aio.operations import PathParametersOperations +from ..queryparameters.aio.operations import QueryParametersOperations from ._configuration import RoutesClientConfiguration -from .operations import ( - InInterfaceOperations, - PathParametersOperations, - QueryParametersOperations, - RoutesClientOperationsMixin, -) +from .operations import InInterfaceOperations, RoutesClientOperationsMixin class RoutesClient(RoutesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/routes/routes/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/aio/operations/__init__.py index 60c9a9b554a..830cd9bf21f 100644 --- a/packages/typespec-python/test/azure/generated/routes/routes/aio/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/routes/routes/aio/operations/__init__.py @@ -12,8 +12,6 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import PathParametersOperations # type: ignore -from ._operations import QueryParametersOperations # type: ignore from ._operations import InInterfaceOperations # type: ignore from ._operations import RoutesClientOperationsMixin # type: ignore @@ -22,8 +20,6 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "PathParametersOperations", - "QueryParametersOperations", "InInterfaceOperations", "RoutesClientOperationsMixin", ] diff --git a/packages/typespec-python/test/azure/generated/routes/routes/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/aio/operations/_operations.py index 01a796e09b6..8cc6873b594 100644 --- a/packages/typespec-python/test/azure/generated/routes/routes/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/routes/routes/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -23,54 +23,7 @@ from azure.core.tracing.decorator_async import distributed_trace_async from ..._serialization import Deserializer, Serializer -from ...operations._operations import ( - build_in_interface_fixed_request, - build_path_parameters_annotation_only_request, - build_path_parameters_explicit_request, - build_path_parameters_label_expansion_explode_array_request, - build_path_parameters_label_expansion_explode_primitive_request, - build_path_parameters_label_expansion_explode_record_request, - build_path_parameters_label_expansion_standard_array_request, - build_path_parameters_label_expansion_standard_primitive_request, - build_path_parameters_label_expansion_standard_record_request, - build_path_parameters_matrix_expansion_explode_array_request, - build_path_parameters_matrix_expansion_explode_primitive_request, - build_path_parameters_matrix_expansion_explode_record_request, - build_path_parameters_matrix_expansion_standard_array_request, - build_path_parameters_matrix_expansion_standard_primitive_request, - build_path_parameters_matrix_expansion_standard_record_request, - build_path_parameters_path_expansion_explode_array_request, - build_path_parameters_path_expansion_explode_primitive_request, - build_path_parameters_path_expansion_explode_record_request, - build_path_parameters_path_expansion_standard_array_request, - build_path_parameters_path_expansion_standard_primitive_request, - build_path_parameters_path_expansion_standard_record_request, - build_path_parameters_reserved_expansion_annotation_request, - build_path_parameters_reserved_expansion_template_request, - build_path_parameters_simple_expansion_explode_array_request, - build_path_parameters_simple_expansion_explode_primitive_request, - build_path_parameters_simple_expansion_explode_record_request, - build_path_parameters_simple_expansion_standard_array_request, - build_path_parameters_simple_expansion_standard_primitive_request, - build_path_parameters_simple_expansion_standard_record_request, - build_path_parameters_template_only_request, - build_query_parameters_annotation_only_request, - build_query_parameters_explicit_request, - build_query_parameters_query_continuation_explode_array_request, - build_query_parameters_query_continuation_explode_primitive_request, - build_query_parameters_query_continuation_explode_record_request, - build_query_parameters_query_continuation_standard_array_request, - build_query_parameters_query_continuation_standard_primitive_request, - build_query_parameters_query_continuation_standard_record_request, - build_query_parameters_query_expansion_explode_array_request, - build_query_parameters_query_expansion_explode_primitive_request, - build_query_parameters_query_expansion_explode_record_request, - build_query_parameters_query_expansion_standard_array_request, - build_query_parameters_query_expansion_standard_primitive_request, - build_query_parameters_query_expansion_standard_record_request, - build_query_parameters_template_only_request, - build_routes_fixed_request, -) +from ...operations._operations import build_in_interface_fixed_request, build_routes_fixed_request from .._configuration import RoutesClientConfiguration from .._vendor import RoutesClientMixinABC @@ -82,189 +35,14 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class PathParametersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`path_parameters` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.reserved_expansion = PathParametersReservedExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.simple_expansion = PathParametersSimpleExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.path_expansion = PathParametersPathExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.label_expansion = PathParametersLabelExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.matrix_expansion = PathParametersMatrixExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - @distributed_trace_async - async def template_only(self, param: str, **kwargs: Any) -> None: - """template_only. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_template_only_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def explicit(self, param: str, **kwargs: Any) -> None: - """explicit. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_explicit_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def annotation_only(self, param: str, **kwargs: Any) -> None: - """annotation_only. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_annotation_only_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class QueryParametersOperations: +class InInterfaceOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~routes.aio.RoutesClient`'s - :attr:`query_parameters` attribute. + :attr:`in_interface` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -274,113 +52,10 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self.query_expansion = QueryParametersQueryExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.query_continuation = QueryParametersQueryContinuationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - @distributed_trace_async - async def template_only(self, *, param: str, **kwargs: Any) -> None: - """template_only. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_template_only_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace_async - async def explicit(self, *, param: str, **kwargs: Any) -> None: - """explicit. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_explicit_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def annotation_only(self, *, param: str, **kwargs: Any) -> None: - """annotation_only. + async def fixed(self, **kwargs: Any) -> None: + """fixed. - :keyword param: Required. - :paramtype param: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -398,8 +73,7 @@ async def annotation_only(self, *, param: str, **kwargs: Any) -> None: cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_query_parameters_annotation_only_request( - param=param, + _request = build_in_interface_fixed_request( headers=_headers, params=_params, ) @@ -423,22 +97,7 @@ async def annotation_only(self, *, param: str, **kwargs: Any) -> None: return cls(pipeline_response, None, {}) # type: ignore -class InInterfaceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`in_interface` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") +class RoutesClientOperationsMixin(RoutesClientMixinABC): @distributed_trace_async async def fixed(self, **kwargs: Any) -> None: @@ -461,54 +120,7 @@ async def fixed(self, **kwargs: Any) -> None: cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_in_interface_fixed_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class RoutesClientOperationsMixin(RoutesClientMixinABC): - - @distributed_trace_async - async def fixed(self, **kwargs: Any) -> None: - """fixed. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_routes_fixed_request( + _request = build_routes_fixed_request( headers=_headers, params=_params, ) @@ -530,2173 +142,3 @@ async def fixed(self, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersReservedExpansionOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`reserved_expansion` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def template(self, param: str, **kwargs: Any) -> None: - """template. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_reserved_expansion_template_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def annotation(self, param: str, **kwargs: Any) -> None: - """annotation. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_reserved_expansion_annotation_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersSimpleExpansionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`simple_expansion` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = PathParametersSimpleExpansionStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = PathParametersSimpleExpansionExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class PathParametersPathExpansionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`path_expansion` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = PathParametersPathExpansionStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = PathParametersPathExpansionExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class PathParametersLabelExpansionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`label_expansion` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = PathParametersLabelExpansionStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = PathParametersLabelExpansionExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class PathParametersMatrixExpansionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`matrix_expansion` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = PathParametersMatrixExpansionStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = PathParametersMatrixExpansionExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class QueryParametersQueryExpansionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`query_expansion` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = QueryParametersQueryExpansionStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = QueryParametersQueryExpansionExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class QueryParametersQueryContinuationOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`query_continuation` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = QueryParametersQueryContinuationStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = QueryParametersQueryContinuationExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class PathParametersSimpleExpansionStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, param: str, **kwargs: Any) -> None: - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, param: List[str], **kwargs: Any) -> None: - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersSimpleExpansionExplodeOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`explode` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, param: str, **kwargs: Any) -> None: - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_explode_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, param: List[str], **kwargs: Any) -> None: - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_explode_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersPathExpansionStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, param: str, **kwargs: Any) -> None: - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, param: List[str], **kwargs: Any) -> None: - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersPathExpansionExplodeOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`explode` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, param: str, **kwargs: Any) -> None: - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_explode_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, param: List[str], **kwargs: Any) -> None: - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_explode_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersLabelExpansionStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, param: str, **kwargs: Any) -> None: - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, param: List[str], **kwargs: Any) -> None: - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersLabelExpansionExplodeOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`explode` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, param: str, **kwargs: Any) -> None: - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_explode_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, param: List[str], **kwargs: Any) -> None: - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_explode_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersMatrixExpansionStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, param: str, **kwargs: Any) -> None: - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, param: List[str], **kwargs: Any) -> None: - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersMatrixExpansionExplodeOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`explode` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, param: str, **kwargs: Any) -> None: - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_explode_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, param: List[str], **kwargs: Any) -> None: - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_explode_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class QueryParametersQueryExpansionStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, *, param: str, **kwargs: Any) -> None: - """primitive. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, *, param: List[str], **kwargs: Any) -> None: - """array. - - :keyword param: Required. - :paramtype param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :keyword param: Required. - :paramtype param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class QueryParametersQueryExpansionExplodeOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`explode` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, *, param: str, **kwargs: Any) -> None: - """primitive. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_explode_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, *, param: List[str], **kwargs: Any) -> None: - """array. - - :keyword param: Required. - :paramtype param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :keyword param: Required. - :paramtype param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_explode_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class QueryParametersQueryContinuationStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, *, param: str, **kwargs: Any) -> None: - """primitive. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_continuation_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, *, param: List[str], **kwargs: Any) -> None: - """array. - - :keyword param: Required. - :paramtype param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_continuation_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :keyword param: Required. - :paramtype param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_continuation_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class QueryParametersQueryContinuationExplodeOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.aio.RoutesClient`'s - :attr:`explode` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def primitive(self, *, param: str, **kwargs: Any) -> None: - """primitive. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_continuation_explode_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def array(self, *, param: List[str], **kwargs: Any) -> None: - """array. - - :keyword param: Required. - :paramtype param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_continuation_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: - """record. - - :keyword param: Required. - :paramtype param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_continuation_explode_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/operations/__init__.py index 60c9a9b554a..830cd9bf21f 100644 --- a/packages/typespec-python/test/azure/generated/routes/routes/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/routes/routes/operations/__init__.py @@ -12,8 +12,6 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import PathParametersOperations # type: ignore -from ._operations import QueryParametersOperations # type: ignore from ._operations import InInterfaceOperations # type: ignore from ._operations import RoutesClientOperationsMixin # type: ignore @@ -22,8 +20,6 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "PathParametersOperations", - "QueryParametersOperations", "InInterfaceOperations", "RoutesClientOperationsMixin", ] diff --git a/packages/typespec-python/test/azure/generated/routes/routes/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/operations/_operations.py index d499c0fc9a7..3662220cf24 100644 --- a/packages/typespec-python/test/azure/generated/routes/routes/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/routes/routes/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core import PipelineClient from azure.core.exceptions import ( @@ -21,7 +20,6 @@ from azure.core.pipeline import PipelineResponse from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict from .._configuration import RoutesClientConfiguration from .._serialization import Deserializer, Serializer @@ -38,3101 +36,28 @@ _SERIALIZER.client_side_validation = False -def build_path_parameters_template_only_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/template-only/{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_explicit_request(param: str, **kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/routes/path/explicit/{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_annotation_only_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/annotation-only/{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_query_parameters_template_only_request( # pylint: disable=name-too-long - *, param: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/template-only" - - # Construct parameters - _params["param"] = _SERIALIZER.query("param", param, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_explicit_request(*, param: str, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/explicit" - - # Construct parameters - _params["param"] = _SERIALIZER.query("param", param, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_annotation_only_request( # pylint: disable=name-too-long - *, param: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/annotation-only" - - # Construct parameters - _params["param"] = _SERIALIZER.query("param", param, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_in_interface_fixed_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/routes/in-interface/fixed" - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_routes_fixed_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/routes/fixed" - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_reserved_expansion_template_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/reserved-expansion/template/{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_reserved_expansion_annotation_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/reserved-expansion/annotation/{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str", skip_quote=True), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_simple_expansion_standard_primitive_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/simple/standard/primitive{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_simple_expansion_standard_array_request( # pylint: disable=name-too-long - param: List[str], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/simple/standard/array{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "[str]"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_simple_expansion_standard_record_request( # pylint: disable=name-too-long - param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/simple/standard/record{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "{int}"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_simple_expansion_explode_primitive_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/simple/explode/primitive{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_simple_expansion_explode_array_request( # pylint: disable=name-too-long - param: List[str], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/simple/explode/array{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "[str]"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_simple_expansion_explode_record_request( # pylint: disable=name-too-long - param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/simple/explode/record{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "{int}"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_path_expansion_standard_primitive_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/path/standard/primitive{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_path_expansion_standard_array_request( # pylint: disable=name-too-long - param: List[str], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/path/standard/array{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "[str]"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_path_expansion_standard_record_request( # pylint: disable=name-too-long - param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/path/standard/record{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "{int}"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_path_expansion_explode_primitive_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/path/explode/primitive{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_path_expansion_explode_array_request( # pylint: disable=name-too-long - param: List[str], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/path/explode/array{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "[str]"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_path_expansion_explode_record_request( # pylint: disable=name-too-long - param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/path/explode/record{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "{int}"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_label_expansion_standard_primitive_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/label/standard/primitive{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_label_expansion_standard_array_request( # pylint: disable=name-too-long - param: List[str], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/label/standard/array{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "[str]"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_label_expansion_standard_record_request( # pylint: disable=name-too-long - param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/label/standard/record{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "{int}"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_label_expansion_explode_primitive_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/label/explode/primitive{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_label_expansion_explode_array_request( # pylint: disable=name-too-long - param: List[str], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/label/explode/array{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "[str]"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_label_expansion_explode_record_request( # pylint: disable=name-too-long - param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/label/explode/record{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "{int}"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_matrix_expansion_standard_primitive_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/matrix/standard/primitive{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_matrix_expansion_standard_array_request( # pylint: disable=name-too-long - param: List[str], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/matrix/standard/array{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "[str]"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_matrix_expansion_standard_record_request( # pylint: disable=name-too-long - param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/matrix/standard/record{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "{int}"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_matrix_expansion_explode_primitive_request( # pylint: disable=name-too-long - param: str, **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/matrix/explode/primitive{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_matrix_expansion_explode_array_request( # pylint: disable=name-too-long - param: List[str], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/matrix/explode/array{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "[str]"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_path_parameters_matrix_expansion_explode_record_request( # pylint: disable=name-too-long - param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - # Construct URL - _url = "/routes/path/matrix/explode/record{param}" - path_format_arguments = { - "param": _SERIALIZER.url("param", param, "{int}"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - return HttpRequest(method="GET", url=_url, **kwargs) - - -def build_query_parameters_query_expansion_standard_primitive_request( # pylint: disable=name-too-long - *, param: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-expansion/standard/primitive" - - # Construct parameters - _params["param"] = _SERIALIZER.query("param", param, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_query_expansion_standard_array_request( # pylint: disable=name-too-long - *, param: List[str], **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-expansion/standard/array" - - # Construct parameters - _params["param"] = [_SERIALIZER.query("param", q, "str") if q is not None else "" for q in param] - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_query_expansion_standard_record_request( # pylint: disable=name-too-long - *, param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-expansion/standard/record" - - # Construct parameters - _params["param"] = _SERIALIZER.query("param", param, "{int}") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_query_expansion_explode_primitive_request( # pylint: disable=name-too-long - *, param: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-expansion/explode/primitive" - - # Construct parameters - _params["param"] = _SERIALIZER.query("param", param, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_query_expansion_explode_array_request( # pylint: disable=name-too-long - *, param: List[str], **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-expansion/explode/array" - - # Construct parameters - _params["param"] = [_SERIALIZER.query("param", q, "str") if q is not None else "" for q in param] - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_query_expansion_explode_record_request( # pylint: disable=name-too-long - *, param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-expansion/explode/record" - - # Construct parameters - _params["param"] = _SERIALIZER.query("param", param, "{int}") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_query_continuation_standard_primitive_request( # pylint: disable=name-too-long - *, param: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-continuation/standard/primitive?fixed=true" - - # Construct parameters - _params["param"] = _SERIALIZER.query("param", param, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_query_continuation_standard_array_request( # pylint: disable=name-too-long - *, param: List[str], **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-continuation/standard/array?fixed=true" - - # Construct parameters - _params["param"] = [_SERIALIZER.query("param", q, "str") if q is not None else "" for q in param] - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_query_continuation_standard_record_request( # pylint: disable=name-too-long - *, param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-continuation/standard/record?fixed=true" - - # Construct parameters - _params["param"] = _SERIALIZER.query("param", param, "{int}") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_query_continuation_explode_primitive_request( # pylint: disable=name-too-long - *, param: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-continuation/explode/primitive?fixed=true" - - # Construct parameters - _params["param"] = _SERIALIZER.query("param", param, "str") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_query_continuation_explode_array_request( # pylint: disable=name-too-long - *, param: List[str], **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-continuation/explode/array?fixed=true" - - # Construct parameters - _params["param"] = [_SERIALIZER.query("param", q, "str") if q is not None else "" for q in param] - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -def build_query_parameters_query_continuation_explode_record_request( # pylint: disable=name-too-long - *, param: Dict[str, int], **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/routes/query/query-continuation/explode/record?fixed=true" - - # Construct parameters - _params["param"] = _SERIALIZER.query("param", param, "{int}") - - return HttpRequest(method="GET", url=_url, params=_params, **kwargs) - - -class PathParametersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`path_parameters` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.reserved_expansion = PathParametersReservedExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.simple_expansion = PathParametersSimpleExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.path_expansion = PathParametersPathExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.label_expansion = PathParametersLabelExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.matrix_expansion = PathParametersMatrixExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - @distributed_trace - def template_only(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """template_only. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_template_only_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def explicit(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """explicit. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_explicit_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def annotation_only(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """annotation_only. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_annotation_only_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class QueryParametersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`query_parameters` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.query_expansion = QueryParametersQueryExpansionOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.query_continuation = QueryParametersQueryContinuationOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - @distributed_trace - def template_only(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """template_only. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_template_only_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def explicit(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """explicit. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_explicit_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def annotation_only(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """annotation_only. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_annotation_only_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class InInterfaceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`in_interface` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def fixed(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """fixed. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_in_interface_fixed_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class RoutesClientOperationsMixin(RoutesClientMixinABC): - - @distributed_trace - def fixed(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """fixed. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_routes_fixed_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersReservedExpansionOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`reserved_expansion` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def template(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """template. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_reserved_expansion_template_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def annotation(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """annotation. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_reserved_expansion_annotation_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersSimpleExpansionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`simple_expansion` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = PathParametersSimpleExpansionStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = PathParametersSimpleExpansionExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class PathParametersPathExpansionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`path_expansion` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = PathParametersPathExpansionStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = PathParametersPathExpansionExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class PathParametersLabelExpansionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`label_expansion` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = PathParametersLabelExpansionStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = PathParametersLabelExpansionExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class PathParametersMatrixExpansionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`matrix_expansion` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = PathParametersMatrixExpansionStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = PathParametersMatrixExpansionExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class QueryParametersQueryExpansionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`query_expansion` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = QueryParametersQueryExpansionStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = QueryParametersQueryExpansionExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class QueryParametersQueryContinuationOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`query_continuation` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - self.standard = QueryParametersQueryContinuationStandardOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.explode = QueryParametersQueryContinuationExplodeOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - -class PathParametersSimpleExpansionStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersSimpleExpansionExplodeOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`explode` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_explode_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_simple_expansion_explode_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersPathExpansionStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersPathExpansionExplodeOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`explode` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_explode_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_path_expansion_explode_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersLabelExpansionStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersLabelExpansionExplodeOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`explode` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_explode_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_label_expansion_explode_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersMatrixExpansionStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class PathParametersMatrixExpansionExplodeOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`explode` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. - - :param param: Required. - :type param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_explode_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :param param: Required. - :type param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. - - :param param: Required. - :type param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_path_parameters_matrix_expansion_explode_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class QueryParametersQueryExpansionStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def primitive(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def array(self, *, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :keyword param: Required. - :paramtype param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. - - :keyword param: Required. - :paramtype param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class QueryParametersQueryExpansionExplodeOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`explode` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def primitive(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_explode_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def array(self, *, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :keyword param: Required. - :paramtype param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. - - :keyword param: Required. - :paramtype param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_expansion_explode_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class QueryParametersQueryContinuationStandardOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~routes.RoutesClient`'s - :attr:`standard` attribute. - """ - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def primitive(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. - - :keyword param: Required. - :paramtype param: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_continuation_standard_primitive_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def array(self, *, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :keyword param: Required. - :paramtype param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_continuation_standard_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. - - :keyword param: Required. - :paramtype param: dict[str, int] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_continuation_standard_record_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) +def build_in_interface_fixed_request(**kwargs: Any) -> HttpRequest: + # Construct URL + _url = "/routes/in-interface/fixed" - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) - response = pipeline_response.http_response - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) +def build_routes_fixed_request(**kwargs: Any) -> HttpRequest: + # Construct URL + _url = "/routes/fixed" - if cls: - return cls(pipeline_response, None, {}) # type: ignore + return HttpRequest(method="GET", url=_url, **kwargs) -class QueryParametersQueryContinuationExplodeOperations: # pylint: disable=name-too-long +class InInterfaceOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~routes.RoutesClient`'s - :attr:`explode` attribute. + :attr:`in_interface` attribute. """ def __init__(self, *args, **kwargs): @@ -3143,11 +68,9 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def primitive(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """primitive. + def fixed(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """fixed. - :keyword param: Required. - :paramtype param: str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -3165,8 +88,7 @@ def primitive(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=in cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_query_parameters_query_continuation_explode_primitive_request( - param=param, + _request = build_in_interface_fixed_request( headers=_headers, params=_params, ) @@ -3189,59 +111,13 @@ def primitive(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=in if cls: return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def array(self, *, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """array. - - :keyword param: Required. - :paramtype param: list[str] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_query_parameters_query_continuation_explode_array_request( - param=param, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - if cls: - return cls(pipeline_response, None, {}) # type: ignore +class RoutesClientOperationsMixin(RoutesClientMixinABC): @distributed_trace - def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """record. + def fixed(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """fixed. - :keyword param: Required. - :paramtype param: dict[str, int] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -3259,8 +135,7 @@ def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: # pylint: di cls: ClsType[None] = kwargs.pop("cls", None) - _request = build_query_parameters_query_continuation_explode_record_request( - param=param, + _request = build_routes_fixed_request( headers=_headers, params=_params, ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/operations/__init__.py new file mode 100644 index 00000000000..fc6dacce9a2 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import PathParametersOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "PathParametersOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/operations/_operations.py new file mode 100644 index 00000000000..51072c593cd --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/operations/_operations.py @@ -0,0 +1,217 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import RoutesClientConfiguration +from ...labelexpansion.aio.operations._operations import PathParametersLabelExpansionOperations +from ...matrixexpansion.aio.operations._operations import PathParametersMatrixExpansionOperations +from ...operations._operations import ( + build_path_parameters_annotation_only_request, + build_path_parameters_explicit_request, + build_path_parameters_template_only_request, +) +from ...pathexpansion.aio.operations._operations import PathParametersPathExpansionOperations +from ...reservedexpansion.aio.operations._operations import PathParametersReservedExpansionOperations +from ...simpleexpansion.aio.operations._operations import PathParametersSimpleExpansionOperations + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PathParametersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`path_parameters` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.reserved_expansion = PathParametersReservedExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.simple_expansion = PathParametersSimpleExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.path_expansion = PathParametersPathExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.label_expansion = PathParametersLabelExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.matrix_expansion = PathParametersMatrixExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + @distributed_trace_async + async def template_only(self, param: str, **kwargs: Any) -> None: + """template_only. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_template_only_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def explicit(self, param: str, **kwargs: Any) -> None: + """explicit. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_explicit_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def annotation_only(self, param: str, **kwargs: Any) -> None: + """annotation_only. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_annotation_only_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/operations/_operations.py new file mode 100644 index 00000000000..04e02bd6daa --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import AsyncPipelineClient + +from ....._serialization import Deserializer, Serializer +from .....aio._configuration import RoutesClientConfiguration +from ...explode.aio.operations._operations import PathParametersLabelExpansionExplodeOperations +from ...standard.aio.operations._operations import PathParametersLabelExpansionStandardOperations + + +class PathParametersLabelExpansionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`label_expansion` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = PathParametersLabelExpansionStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = PathParametersLabelExpansionExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_operations.py new file mode 100644 index 00000000000..1ad7449bc11 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_path_parameters_label_expansion_explode_array_request, + build_path_parameters_label_expansion_explode_primitive_request, + build_path_parameters_label_expansion_explode_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PathParametersLabelExpansionExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, param: str, **kwargs: Any) -> None: + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, param: List[str], **kwargs: Any) -> None: + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/operations/_operations.py new file mode 100644 index 00000000000..07409f56547 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/operations/_operations.py @@ -0,0 +1,236 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_path_parameters_label_expansion_explode_primitive_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/label/explode/primitive{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_label_expansion_explode_array_request( # pylint: disable=name-too-long + param: List[str], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/label/explode/array{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "[str]"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_label_expansion_explode_record_request( # pylint: disable=name-too-long + param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/label/explode/record{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "{int}"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class PathParametersLabelExpansionExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/operations/_operations.py new file mode 100644 index 00000000000..f714b5a0a4f --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import PipelineClient + +from ...._configuration import RoutesClientConfiguration +from ...._serialization import Deserializer, Serializer +from ..explode.operations._operations import PathParametersLabelExpansionExplodeOperations +from ..standard.operations._operations import PathParametersLabelExpansionStandardOperations + + +class PathParametersLabelExpansionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`label_expansion` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = PathParametersLabelExpansionStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = PathParametersLabelExpansionExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_operations.py new file mode 100644 index 00000000000..f0d8044500a --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_path_parameters_label_expansion_standard_array_request, + build_path_parameters_label_expansion_standard_primitive_request, + build_path_parameters_label_expansion_standard_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PathParametersLabelExpansionStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, param: str, **kwargs: Any) -> None: + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, param: List[str], **kwargs: Any) -> None: + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/operations/_operations.py new file mode 100644 index 00000000000..1d9d9c7e5ad --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/operations/_operations.py @@ -0,0 +1,236 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_path_parameters_label_expansion_standard_primitive_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/label/standard/primitive{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_label_expansion_standard_array_request( # pylint: disable=name-too-long + param: List[str], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/label/standard/array{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "[str]"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_label_expansion_standard_record_request( # pylint: disable=name-too-long + param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/label/standard/record{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "{int}"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class PathParametersLabelExpansionStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_label_expansion_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/operations/_operations.py new file mode 100644 index 00000000000..5b747f1cca1 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import AsyncPipelineClient + +from ....._serialization import Deserializer, Serializer +from .....aio._configuration import RoutesClientConfiguration +from ...explode.aio.operations._operations import PathParametersMatrixExpansionExplodeOperations +from ...standard.aio.operations._operations import PathParametersMatrixExpansionStandardOperations + + +class PathParametersMatrixExpansionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`matrix_expansion` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = PathParametersMatrixExpansionStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = PathParametersMatrixExpansionExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_operations.py new file mode 100644 index 00000000000..317a1b584fc --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_path_parameters_matrix_expansion_explode_array_request, + build_path_parameters_matrix_expansion_explode_primitive_request, + build_path_parameters_matrix_expansion_explode_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PathParametersMatrixExpansionExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, param: str, **kwargs: Any) -> None: + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, param: List[str], **kwargs: Any) -> None: + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/operations/_operations.py new file mode 100644 index 00000000000..405fd2801f6 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/operations/_operations.py @@ -0,0 +1,236 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_path_parameters_matrix_expansion_explode_primitive_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/matrix/explode/primitive{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_matrix_expansion_explode_array_request( # pylint: disable=name-too-long + param: List[str], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/matrix/explode/array{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "[str]"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_matrix_expansion_explode_record_request( # pylint: disable=name-too-long + param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/matrix/explode/record{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "{int}"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class PathParametersMatrixExpansionExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/operations/_operations.py new file mode 100644 index 00000000000..bcbe3d09bd5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import PipelineClient + +from ...._configuration import RoutesClientConfiguration +from ...._serialization import Deserializer, Serializer +from ..explode.operations._operations import PathParametersMatrixExpansionExplodeOperations +from ..standard.operations._operations import PathParametersMatrixExpansionStandardOperations + + +class PathParametersMatrixExpansionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`matrix_expansion` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = PathParametersMatrixExpansionStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = PathParametersMatrixExpansionExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_operations.py new file mode 100644 index 00000000000..38880e6067a --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_path_parameters_matrix_expansion_standard_array_request, + build_path_parameters_matrix_expansion_standard_primitive_request, + build_path_parameters_matrix_expansion_standard_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PathParametersMatrixExpansionStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, param: str, **kwargs: Any) -> None: + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, param: List[str], **kwargs: Any) -> None: + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/operations/_operations.py new file mode 100644 index 00000000000..99f775b8211 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/operations/_operations.py @@ -0,0 +1,236 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_path_parameters_matrix_expansion_standard_primitive_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/matrix/standard/primitive{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_matrix_expansion_standard_array_request( # pylint: disable=name-too-long + param: List[str], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/matrix/standard/array{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "[str]"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_matrix_expansion_standard_record_request( # pylint: disable=name-too-long + param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/matrix/standard/record{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "{int}"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class PathParametersMatrixExpansionStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_matrix_expansion_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/operations/__init__.py new file mode 100644 index 00000000000..fc6dacce9a2 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import PathParametersOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "PathParametersOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/operations/_operations.py new file mode 100644 index 00000000000..d6d80682e13 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/operations/_operations.py @@ -0,0 +1,255 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ..._configuration import RoutesClientConfiguration +from ..._serialization import Deserializer, Serializer +from ..labelexpansion.operations._operations import PathParametersLabelExpansionOperations +from ..matrixexpansion.operations._operations import PathParametersMatrixExpansionOperations +from ..pathexpansion.operations._operations import PathParametersPathExpansionOperations +from ..reservedexpansion.operations._operations import PathParametersReservedExpansionOperations +from ..simpleexpansion.operations._operations import PathParametersSimpleExpansionOperations + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_path_parameters_template_only_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/template-only/{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_explicit_request(param: str, **kwargs: Any) -> HttpRequest: + # Construct URL + _url = "/routes/path/explicit/{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_annotation_only_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/annotation-only/{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class PathParametersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`path_parameters` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.reserved_expansion = PathParametersReservedExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.simple_expansion = PathParametersSimpleExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.path_expansion = PathParametersPathExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.label_expansion = PathParametersLabelExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.matrix_expansion = PathParametersMatrixExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + @distributed_trace + def template_only(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """template_only. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_template_only_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def explicit(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """explicit. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_explicit_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def annotation_only(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """annotation_only. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_annotation_only_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/operations/_operations.py new file mode 100644 index 00000000000..9e37a7bc57e --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import AsyncPipelineClient + +from ....._serialization import Deserializer, Serializer +from .....aio._configuration import RoutesClientConfiguration +from ...explode.aio.operations._operations import PathParametersPathExpansionExplodeOperations +from ...standard.aio.operations._operations import PathParametersPathExpansionStandardOperations + + +class PathParametersPathExpansionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`path_expansion` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = PathParametersPathExpansionStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = PathParametersPathExpansionExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_operations.py new file mode 100644 index 00000000000..14ea8bba16c --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_path_parameters_path_expansion_explode_array_request, + build_path_parameters_path_expansion_explode_primitive_request, + build_path_parameters_path_expansion_explode_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PathParametersPathExpansionExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, param: str, **kwargs: Any) -> None: + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, param: List[str], **kwargs: Any) -> None: + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/operations/_operations.py new file mode 100644 index 00000000000..75272bcae45 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/operations/_operations.py @@ -0,0 +1,236 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_path_parameters_path_expansion_explode_primitive_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/path/explode/primitive{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_path_expansion_explode_array_request( # pylint: disable=name-too-long + param: List[str], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/path/explode/array{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "[str]"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_path_expansion_explode_record_request( # pylint: disable=name-too-long + param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/path/explode/record{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "{int}"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class PathParametersPathExpansionExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/operations/_operations.py new file mode 100644 index 00000000000..bfc9d1b6cf4 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import PipelineClient + +from ...._configuration import RoutesClientConfiguration +from ...._serialization import Deserializer, Serializer +from ..explode.operations._operations import PathParametersPathExpansionExplodeOperations +from ..standard.operations._operations import PathParametersPathExpansionStandardOperations + + +class PathParametersPathExpansionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`path_expansion` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = PathParametersPathExpansionStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = PathParametersPathExpansionExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_operations.py new file mode 100644 index 00000000000..0eb26bc5cf3 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_path_parameters_path_expansion_standard_array_request, + build_path_parameters_path_expansion_standard_primitive_request, + build_path_parameters_path_expansion_standard_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PathParametersPathExpansionStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, param: str, **kwargs: Any) -> None: + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, param: List[str], **kwargs: Any) -> None: + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/operations/_operations.py new file mode 100644 index 00000000000..3a1263419dc --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/operations/_operations.py @@ -0,0 +1,236 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_path_parameters_path_expansion_standard_primitive_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/path/standard/primitive{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_path_expansion_standard_array_request( # pylint: disable=name-too-long + param: List[str], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/path/standard/array{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "[str]"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_path_expansion_standard_record_request( # pylint: disable=name-too-long + param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/path/standard/record{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "{int}"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class PathParametersPathExpansionStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_path_expansion_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/operations/_operations.py new file mode 100644 index 00000000000..e35160f1d36 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/operations/_operations.py @@ -0,0 +1,148 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ....._serialization import Deserializer, Serializer +from .....aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_path_parameters_reserved_expansion_annotation_request, + build_path_parameters_reserved_expansion_template_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PathParametersReservedExpansionOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`reserved_expansion` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def template(self, param: str, **kwargs: Any) -> None: + """template. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_reserved_expansion_template_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def annotation(self, param: str, **kwargs: Any) -> None: + """annotation. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_reserved_expansion_annotation_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/operations/_operations.py new file mode 100644 index 00000000000..6404752c1de --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/operations/_operations.py @@ -0,0 +1,175 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ...._configuration import RoutesClientConfiguration +from ...._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_path_parameters_reserved_expansion_template_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/reserved-expansion/template/{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_reserved_expansion_annotation_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/reserved-expansion/annotation/{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class PathParametersReservedExpansionOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`reserved_expansion` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def template(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """template. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_reserved_expansion_template_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def annotation(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """annotation. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_reserved_expansion_annotation_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/reservedexpansion/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/operations/_operations.py new file mode 100644 index 00000000000..415fb2ee17a --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import AsyncPipelineClient + +from ....._serialization import Deserializer, Serializer +from .....aio._configuration import RoutesClientConfiguration +from ...explode.aio.operations._operations import PathParametersSimpleExpansionExplodeOperations +from ...standard.aio.operations._operations import PathParametersSimpleExpansionStandardOperations + + +class PathParametersSimpleExpansionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`simple_expansion` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = PathParametersSimpleExpansionStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = PathParametersSimpleExpansionExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_operations.py new file mode 100644 index 00000000000..a1934ebd9bd --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_path_parameters_simple_expansion_explode_array_request, + build_path_parameters_simple_expansion_explode_primitive_request, + build_path_parameters_simple_expansion_explode_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PathParametersSimpleExpansionExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, param: str, **kwargs: Any) -> None: + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, param: List[str], **kwargs: Any) -> None: + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/operations/_operations.py new file mode 100644 index 00000000000..531f26f1a64 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/operations/_operations.py @@ -0,0 +1,236 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_path_parameters_simple_expansion_explode_primitive_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/simple/explode/primitive{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_simple_expansion_explode_array_request( # pylint: disable=name-too-long + param: List[str], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/simple/explode/array{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "[str]"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_simple_expansion_explode_record_request( # pylint: disable=name-too-long + param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/simple/explode/record{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "{int}"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class PathParametersSimpleExpansionExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/operations/_operations.py new file mode 100644 index 00000000000..6ecc41d56f4 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import PipelineClient + +from ...._configuration import RoutesClientConfiguration +from ...._serialization import Deserializer, Serializer +from ..explode.operations._operations import PathParametersSimpleExpansionExplodeOperations +from ..standard.operations._operations import PathParametersSimpleExpansionStandardOperations + + +class PathParametersSimpleExpansionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`simple_expansion` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = PathParametersSimpleExpansionStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = PathParametersSimpleExpansionExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_operations.py new file mode 100644 index 00000000000..afa5efcbff5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_path_parameters_simple_expansion_standard_array_request, + build_path_parameters_simple_expansion_standard_primitive_request, + build_path_parameters_simple_expansion_standard_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class PathParametersSimpleExpansionStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, param: str, **kwargs: Any) -> None: + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, param: List[str], **kwargs: Any) -> None: + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/operations/_operations.py new file mode 100644 index 00000000000..51709420fdb --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/operations/_operations.py @@ -0,0 +1,236 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_path_parameters_simple_expansion_standard_primitive_request( # pylint: disable=name-too-long + param: str, **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/simple/standard/primitive{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_simple_expansion_standard_array_request( # pylint: disable=name-too-long + param: List[str], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/simple/standard/array{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "[str]"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +def build_path_parameters_simple_expansion_standard_record_request( # pylint: disable=name-too-long + param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + # Construct URL + _url = "/routes/path/simple/standard/record{param}" + path_format_arguments = { + "param": _SERIALIZER.url("param", param, "{int}"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class PathParametersSimpleExpansionStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :param param: Required. + :type param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :param param: Required. + :type param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :param param: Required. + :type param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_path_parameters_simple_expansion_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/operations/__init__.py new file mode 100644 index 00000000000..2a3caa32eab --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import QueryParametersOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "QueryParametersOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/operations/_operations.py new file mode 100644 index 00000000000..7d21ac809a8 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/operations/_operations.py @@ -0,0 +1,205 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_query_parameters_annotation_only_request, + build_query_parameters_explicit_request, + build_query_parameters_template_only_request, +) +from ...querycontinuation.aio.operations._operations import QueryParametersQueryContinuationOperations +from ...queryexpansion.aio.operations._operations import QueryParametersQueryExpansionOperations + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class QueryParametersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`query_parameters` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.query_expansion = QueryParametersQueryExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.query_continuation = QueryParametersQueryContinuationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + @distributed_trace_async + async def template_only(self, *, param: str, **kwargs: Any) -> None: + """template_only. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_template_only_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def explicit(self, *, param: str, **kwargs: Any) -> None: + """explicit. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_explicit_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def annotation_only(self, *, param: str, **kwargs: Any) -> None: + """annotation_only. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_annotation_only_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/operations/__init__.py new file mode 100644 index 00000000000..2a3caa32eab --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import QueryParametersOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "QueryParametersOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/operations/_operations.py new file mode 100644 index 00000000000..d74558a9393 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/operations/_operations.py @@ -0,0 +1,244 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ..._configuration import RoutesClientConfiguration +from ..._serialization import Deserializer, Serializer +from ..querycontinuation.operations._operations import QueryParametersQueryContinuationOperations +from ..queryexpansion.operations._operations import QueryParametersQueryExpansionOperations + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_query_parameters_template_only_request( # pylint: disable=name-too-long + *, param: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/template-only" + + # Construct parameters + _params["param"] = _SERIALIZER.query("param", param, "str") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_parameters_explicit_request(*, param: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/explicit" + + # Construct parameters + _params["param"] = _SERIALIZER.query("param", param, "str") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_parameters_annotation_only_request( # pylint: disable=name-too-long + *, param: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/annotation-only" + + # Construct parameters + _params["param"] = _SERIALIZER.query("param", param, "str") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +class QueryParametersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`query_parameters` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.query_expansion = QueryParametersQueryExpansionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.query_continuation = QueryParametersQueryContinuationOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + @distributed_trace + def template_only(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """template_only. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_template_only_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def explicit(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """explicit. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_explicit_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def annotation_only(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """annotation_only. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_annotation_only_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/operations/_operations.py new file mode 100644 index 00000000000..5cfd81ed40f --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import AsyncPipelineClient + +from ....._serialization import Deserializer, Serializer +from .....aio._configuration import RoutesClientConfiguration +from ...explode.aio.operations._operations import QueryParametersQueryContinuationExplodeOperations +from ...standard.aio.operations._operations import QueryParametersQueryContinuationStandardOperations + + +class QueryParametersQueryContinuationOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`query_continuation` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = QueryParametersQueryContinuationStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = QueryParametersQueryContinuationExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_operations.py new file mode 100644 index 00000000000..edbdd1c4104 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_query_parameters_query_continuation_explode_array_request, + build_query_parameters_query_continuation_explode_primitive_request, + build_query_parameters_query_continuation_explode_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class QueryParametersQueryContinuationExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, *, param: str, **kwargs: Any) -> None: + """primitive. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, *, param: List[str], **kwargs: Any) -> None: + """array. + + :keyword param: Required. + :paramtype param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :keyword param: Required. + :paramtype param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/operations/_operations.py new file mode 100644 index 00000000000..94b7afe8e0b --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/operations/_operations.py @@ -0,0 +1,237 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_query_parameters_query_continuation_explode_primitive_request( # pylint: disable=name-too-long + *, param: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-continuation/explode/primitive?fixed=true" + + # Construct parameters + _params["param"] = _SERIALIZER.query("param", param, "str") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_parameters_query_continuation_explode_array_request( # pylint: disable=name-too-long + *, param: List[str], **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-continuation/explode/array?fixed=true" + + # Construct parameters + _params["param"] = [_SERIALIZER.query("param", q, "str") if q is not None else "" for q in param] + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_parameters_query_continuation_explode_record_request( # pylint: disable=name-too-long + *, param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-continuation/explode/record?fixed=true" + + # Construct parameters + _params["param"] = _SERIALIZER.query("param", param, "{int}") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +class QueryParametersQueryContinuationExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, *, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :keyword param: Required. + :paramtype param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :keyword param: Required. + :paramtype param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/operations/_operations.py new file mode 100644 index 00000000000..1be220a2d55 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import PipelineClient + +from ...._configuration import RoutesClientConfiguration +from ...._serialization import Deserializer, Serializer +from ..explode.operations._operations import QueryParametersQueryContinuationExplodeOperations +from ..standard.operations._operations import QueryParametersQueryContinuationStandardOperations + + +class QueryParametersQueryContinuationOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`query_continuation` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = QueryParametersQueryContinuationStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = QueryParametersQueryContinuationExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_operations.py new file mode 100644 index 00000000000..4862b597636 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_query_parameters_query_continuation_standard_array_request, + build_query_parameters_query_continuation_standard_primitive_request, + build_query_parameters_query_continuation_standard_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class QueryParametersQueryContinuationStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, *, param: str, **kwargs: Any) -> None: + """primitive. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, *, param: List[str], **kwargs: Any) -> None: + """array. + + :keyword param: Required. + :paramtype param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :keyword param: Required. + :paramtype param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/operations/_operations.py new file mode 100644 index 00000000000..3cc9b171aef --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/operations/_operations.py @@ -0,0 +1,237 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_query_parameters_query_continuation_standard_primitive_request( # pylint: disable=name-too-long + *, param: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-continuation/standard/primitive?fixed=true" + + # Construct parameters + _params["param"] = _SERIALIZER.query("param", param, "str") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_parameters_query_continuation_standard_array_request( # pylint: disable=name-too-long + *, param: List[str], **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-continuation/standard/array?fixed=true" + + # Construct parameters + _params["param"] = [_SERIALIZER.query("param", q, "str") if q is not None else "" for q in param] + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_parameters_query_continuation_standard_record_request( # pylint: disable=name-too-long + *, param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-continuation/standard/record?fixed=true" + + # Construct parameters + _params["param"] = _SERIALIZER.query("param", param, "{int}") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +class QueryParametersQueryContinuationStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, *, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :keyword param: Required. + :paramtype param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :keyword param: Required. + :paramtype param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_continuation_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/operations/_operations.py new file mode 100644 index 00000000000..fc3aba35f11 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import AsyncPipelineClient + +from ....._serialization import Deserializer, Serializer +from .....aio._configuration import RoutesClientConfiguration +from ...explode.aio.operations._operations import QueryParametersQueryExpansionExplodeOperations +from ...standard.aio.operations._operations import QueryParametersQueryExpansionStandardOperations + + +class QueryParametersQueryExpansionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`query_expansion` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = QueryParametersQueryExpansionStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = QueryParametersQueryExpansionExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_operations.py new file mode 100644 index 00000000000..6de8790d6b2 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_query_parameters_query_expansion_explode_array_request, + build_query_parameters_query_expansion_explode_primitive_request, + build_query_parameters_query_expansion_explode_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class QueryParametersQueryExpansionExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, *, param: str, **kwargs: Any) -> None: + """primitive. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, *, param: List[str], **kwargs: Any) -> None: + """array. + + :keyword param: Required. + :paramtype param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :keyword param: Required. + :paramtype param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/operations/_operations.py new file mode 100644 index 00000000000..cb190e15d50 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/operations/_operations.py @@ -0,0 +1,237 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_query_parameters_query_expansion_explode_primitive_request( # pylint: disable=name-too-long + *, param: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-expansion/explode/primitive" + + # Construct parameters + _params["param"] = _SERIALIZER.query("param", param, "str") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_parameters_query_expansion_explode_array_request( # pylint: disable=name-too-long + *, param: List[str], **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-expansion/explode/array" + + # Construct parameters + _params["param"] = [_SERIALIZER.query("param", q, "str") if q is not None else "" for q in param] + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_parameters_query_expansion_explode_record_request( # pylint: disable=name-too-long + *, param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-expansion/explode/record" + + # Construct parameters + _params["param"] = _SERIALIZER.query("param", param, "{int}") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +class QueryParametersQueryExpansionExplodeOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`explode` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_explode_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, *, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :keyword param: Required. + :paramtype param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_explode_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :keyword param: Required. + :paramtype param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_explode_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/operations/_operations.py new file mode 100644 index 00000000000..1b07e28ec71 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/operations/_operations.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.core import PipelineClient + +from ...._configuration import RoutesClientConfiguration +from ...._serialization import Deserializer, Serializer +from ..explode.operations._operations import QueryParametersQueryExpansionExplodeOperations +from ..standard.operations._operations import QueryParametersQueryExpansionStandardOperations + + +class QueryParametersQueryExpansionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`query_expansion` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + self.standard = QueryParametersQueryExpansionStandardOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.explode = QueryParametersQueryExpansionExplodeOperations( + self._client, self._config, self._serialize, self._deserialize + ) diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_operations.py new file mode 100644 index 00000000000..e3920ee16d1 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ......_serialization import Deserializer, Serializer +from ......aio._configuration import RoutesClientConfiguration +from ...operations._operations import ( + build_query_parameters_query_expansion_standard_array_request, + build_query_parameters_query_expansion_standard_primitive_request, + build_query_parameters_query_expansion_standard_record_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class QueryParametersQueryExpansionStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.aio.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def primitive(self, *, param: str, **kwargs: Any) -> None: + """primitive. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def array(self, *, param: List[str], **kwargs: Any) -> None: + """array. + + :keyword param: Required. + :paramtype param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: + """record. + + :keyword param: Required. + :paramtype param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/operations/__init__.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/operations/__init__.py new file mode 100644 index 00000000000..933fcd7d1b5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/operations/__init__.py @@ -0,0 +1,22 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/operations/_operations.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/operations/_operations.py new file mode 100644 index 00000000000..1fea97d4cd6 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/operations/_operations.py @@ -0,0 +1,237 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, List, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ....._configuration import RoutesClientConfiguration +from ....._serialization import Deserializer, Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_query_parameters_query_expansion_standard_primitive_request( # pylint: disable=name-too-long + *, param: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-expansion/standard/primitive" + + # Construct parameters + _params["param"] = _SERIALIZER.query("param", param, "str") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_parameters_query_expansion_standard_array_request( # pylint: disable=name-too-long + *, param: List[str], **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-expansion/standard/array" + + # Construct parameters + _params["param"] = [_SERIALIZER.query("param", q, "str") if q is not None else "" for q in param] + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +def build_query_parameters_query_expansion_standard_record_request( # pylint: disable=name-too-long + *, param: Dict[str, int], **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/routes/query/query-expansion/standard/record" + + # Construct parameters + _params["param"] = _SERIALIZER.query("param", param, "{int}") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +class QueryParametersQueryExpansionStandardOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~routes.RoutesClient`'s + :attr:`standard` attribute. + """ + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: RoutesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def primitive(self, *, param: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """primitive. + + :keyword param: Required. + :paramtype param: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_standard_primitive_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def array(self, *, param: List[str], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """array. + + :keyword param: Required. + :paramtype param: list[str] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_standard_array_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def record(self, *, param: Dict[str, int], **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """record. + + :keyword param: Required. + :paramtype param: dict[str, int] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_parameters_query_expansion_standard_record_request( + param=param, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/MANIFEST.in b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/MANIFEST.in index ae346d7ed79..129d71d3353 100644 --- a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/MANIFEST.in @@ -4,4 +4,4 @@ include serialization/encodedname/json/py.typed recursive-include tests *.py recursive-include samples *.py *.md include serialization/__init__.py -include serialization/encodedname/__init__.py \ No newline at end of file +include serialization/encodedname/__init__.py diff --git a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/README.md b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/README.md index dcb438fa117..d6cf0487387 100644 --- a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/README.md +++ b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/README.md @@ -1,5 +1,3 @@ - - # Serialization Encodedname Json client library for Python @@ -17,6 +15,7 @@ python -m pip install serialization-encodedname-json - You need an [Azure subscription][azure_sub] to use this package. - An existing Serialization Encodedname Json instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/MANIFEST.in b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/MANIFEST.in index 3fb7e5ef0a6..f1826052a5d 100644 --- a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/MANIFEST.in @@ -4,4 +4,4 @@ include server/endpoint/notdefined/py.typed recursive-include tests *.py recursive-include samples *.py *.md include server/__init__.py -include server/endpoint/__init__.py \ No newline at end of file +include server/endpoint/__init__.py diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/README.md b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/README.md index a053ffb3406..fd6a68b7989 100644 --- a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/README.md +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/README.md @@ -1,5 +1,3 @@ - - # Server Endpoint Notdefined client library for Python @@ -17,6 +15,7 @@ python -m pip install server-endpoint-notdefined - You need an [Azure subscription][azure_sub] to use this package. - An existing Server Endpoint Notdefined instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/MANIFEST.in b/packages/typespec-python/test/azure/generated/server-path-multiple/MANIFEST.in index 543f941fab6..56d253b0ae2 100644 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/server-path-multiple/MANIFEST.in @@ -4,4 +4,4 @@ include server/path/multiple/py.typed recursive-include tests *.py recursive-include samples *.py *.md include server/__init__.py -include server/path/__init__.py \ No newline at end of file +include server/path/__init__.py diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/README.md b/packages/typespec-python/test/azure/generated/server-path-multiple/README.md index dc1b26979d8..88e0cf0beef 100644 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/README.md +++ b/packages/typespec-python/test/azure/generated/server-path-multiple/README.md @@ -1,5 +1,3 @@ - - # Server Path Multiple client library for Python @@ -17,6 +15,7 @@ python -m pip install server-path-multiple - You need an [Azure subscription][azure_sub] to use this package. - An existing Server Path Multiple instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/server-path-single/MANIFEST.in b/packages/typespec-python/test/azure/generated/server-path-single/MANIFEST.in index 973c402a023..d3262e4af86 100644 --- a/packages/typespec-python/test/azure/generated/server-path-single/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/server-path-single/MANIFEST.in @@ -4,4 +4,4 @@ include server/path/single/py.typed recursive-include tests *.py recursive-include samples *.py *.md include server/__init__.py -include server/path/__init__.py \ No newline at end of file +include server/path/__init__.py diff --git a/packages/typespec-python/test/azure/generated/server-path-single/README.md b/packages/typespec-python/test/azure/generated/server-path-single/README.md index 490f5929f58..860e102d8c8 100644 --- a/packages/typespec-python/test/azure/generated/server-path-single/README.md +++ b/packages/typespec-python/test/azure/generated/server-path-single/README.md @@ -1,5 +1,3 @@ - - # Server Path Single client library for Python @@ -17,6 +15,7 @@ python -m pip install server-path-single - You need an [Azure subscription][azure_sub] to use this package. - An existing Server Path Single instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/MANIFEST.in b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/MANIFEST.in index cb00091dc98..03251cbd03c 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/MANIFEST.in @@ -4,4 +4,4 @@ include server/versions/notversioned/py.typed recursive-include tests *.py recursive-include samples *.py *.md include server/__init__.py -include server/versions/__init__.py \ No newline at end of file +include server/versions/__init__.py diff --git a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/README.md b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/README.md index ea4c5ee345a..d6e8fdf210a 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/README.md +++ b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/README.md @@ -1,5 +1,3 @@ - - # Server Versions Notversioned client library for Python @@ -17,6 +15,7 @@ python -m pip install server-versions-notversioned - You need an [Azure subscription][azure_sub] to use this package. - An existing Server Versions Notversioned instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/server-versions-versioned/MANIFEST.in b/packages/typespec-python/test/azure/generated/server-versions-versioned/MANIFEST.in index 7779034f76c..914710e6ed5 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-versioned/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/server-versions-versioned/MANIFEST.in @@ -4,4 +4,4 @@ include server/versions/versioned/py.typed recursive-include tests *.py recursive-include samples *.py *.md include server/__init__.py -include server/versions/__init__.py \ No newline at end of file +include server/versions/__init__.py diff --git a/packages/typespec-python/test/azure/generated/server-versions-versioned/README.md b/packages/typespec-python/test/azure/generated/server-versions-versioned/README.md index ec3569014ae..c0c5ec55846 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-versioned/README.md +++ b/packages/typespec-python/test/azure/generated/server-versions-versioned/README.md @@ -1,5 +1,3 @@ - - # Server Versions Versioned client library for Python @@ -17,6 +15,7 @@ python -m pip install server-versions-versioned - You need an [Azure subscription][azure_sub] to use this package. - An existing Server Versions Versioned instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/MANIFEST.in b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/MANIFEST.in index f9e928ca45b..fc707cbe7eb 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include specialheaders/conditionalrequest/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include specialheaders/__init__.py \ No newline at end of file +include specialheaders/__init__.py diff --git a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/README.md b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/README.md index 30e1ebc66bc..d1ecdd7f72e 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/README.md +++ b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/README.md @@ -1,5 +1,3 @@ - - # Specialheaders Conditionalrequest client library for Python @@ -17,6 +15,7 @@ python -m pip install specialheaders-conditionalrequest - You need an [Azure subscription][azure_sub] to use this package. - An existing Specialheaders Conditionalrequest instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/special-headers-repeatability/MANIFEST.in b/packages/typespec-python/test/azure/generated/special-headers-repeatability/MANIFEST.in index 237a98837bc..e7e275be2ba 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-repeatability/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/special-headers-repeatability/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include specialheaders/repeatability/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include specialheaders/__init__.py \ No newline at end of file +include specialheaders/__init__.py diff --git a/packages/typespec-python/test/azure/generated/special-headers-repeatability/README.md b/packages/typespec-python/test/azure/generated/special-headers-repeatability/README.md index 6447c0a79a2..b976370d314 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-repeatability/README.md +++ b/packages/typespec-python/test/azure/generated/special-headers-repeatability/README.md @@ -1,5 +1,3 @@ - - # Specialheaders Repeatability client library for Python @@ -17,6 +15,7 @@ python -m pip install specialheaders-repeatability - You need an [Azure subscription][azure_sub] to use this package. - An existing Specialheaders Repeatability instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/special-words/MANIFEST.in b/packages/typespec-python/test/azure/generated/special-words/MANIFEST.in index fa4fcb28a3e..0bd139fa00a 100644 --- a/packages/typespec-python/test/azure/generated/special-words/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/special-words/MANIFEST.in @@ -2,4 +2,4 @@ include *.md include LICENSE include specialwords/py.typed recursive-include tests *.py -recursive-include samples *.py *.md \ No newline at end of file +recursive-include samples *.py *.md diff --git a/packages/typespec-python/test/azure/generated/special-words/README.md b/packages/typespec-python/test/azure/generated/special-words/README.md index 2c5ffef5df8..438fed85ba0 100644 --- a/packages/typespec-python/test/azure/generated/special-words/README.md +++ b/packages/typespec-python/test/azure/generated/special-words/README.md @@ -1,5 +1,3 @@ - - # Specialwords client library for Python @@ -17,6 +15,7 @@ python -m pip install specialwords - You need an [Azure subscription][azure_sub] to use this package. - An existing Specialwords instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/MANIFEST.in b/packages/typespec-python/test/azure/generated/streaming-jsonl/MANIFEST.in index 0535e9d52c8..32a6518ac7e 100644 --- a/packages/typespec-python/test/azure/generated/streaming-jsonl/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/streaming-jsonl/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include streaming/jsonl/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include streaming/__init__.py \ No newline at end of file +include streaming/__init__.py diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/README.md b/packages/typespec-python/test/azure/generated/streaming-jsonl/README.md index 5bf164c3cfa..8004a637f08 100644 --- a/packages/typespec-python/test/azure/generated/streaming-jsonl/README.md +++ b/packages/typespec-python/test/azure/generated/streaming-jsonl/README.md @@ -1,5 +1,3 @@ - - # Streaming Jsonl client library for Python @@ -17,6 +15,7 @@ python -m pip install streaming-jsonl - You need an [Azure subscription][azure_sub] to use this package. - An existing Streaming Jsonl instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/_client.py b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/_client.py index 568e6702876..5f4503ae008 100644 --- a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/_client.py +++ b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/_client.py @@ -16,7 +16,7 @@ from ._configuration import JsonlClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import BasicOperations +from .basic.operations import BasicOperations class JsonlClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/aio/_client.py b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/aio/_client.py index c4c7bbd07c1..ccb855c2ff9 100644 --- a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/aio/_client.py @@ -15,8 +15,8 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer +from ..basic.aio.operations import BasicOperations from ._configuration import JsonlClientConfiguration -from .operations import BasicOperations class JsonlClient: # pylint: disable=client-accepts-api-version-keyword diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/__init__.py b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/aio/__init__.py b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/aio/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/aio/operations/__init__.py similarity index 100% rename from packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/aio/operations/__init__.py rename to packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/aio/operations/__init__.py diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/aio/operations/_operations.py similarity index 98% rename from packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/aio/operations/_operations.py rename to packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/aio/operations/_operations.py index 5cd53de149e..c3164171232 100644 --- a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/aio/operations/_operations.py @@ -24,9 +24,9 @@ from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict -from ..._serialization import Deserializer, Serializer +from ...._serialization import Deserializer, Serializer +from ....aio._configuration import JsonlClientConfiguration from ...operations._operations import build_basic_receive_request, build_basic_send_request -from .._configuration import JsonlClientConfiguration if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/operations/__init__.py b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/operations/__init__.py similarity index 100% rename from packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/operations/__init__.py rename to packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/operations/__init__.py diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/operations/_operations.py b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/operations/_operations.py similarity index 98% rename from packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/operations/_operations.py rename to packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/operations/_operations.py index eb9bd83cd1b..e1214d80140 100644 --- a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/operations/_operations.py @@ -24,8 +24,8 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict -from .._configuration import JsonlClientConfiguration -from .._serialization import Deserializer, Serializer +from ..._configuration import JsonlClientConfiguration +from ..._serialization import Deserializer, Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping diff --git a/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/packages/typespec-python/test/azure/generated/typetest-array/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-array/MANIFEST.in index a465968cb1a..23611f20002 100644 --- a/packages/typespec-python/test/azure/generated/typetest-array/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-array/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include typetest/array/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include typetest/__init__.py \ No newline at end of file +include typetest/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-array/README.md b/packages/typespec-python/test/azure/generated/typetest-array/README.md index 00b81ac15b3..858a45c77c0 100644 --- a/packages/typespec-python/test/azure/generated/typetest-array/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-array/README.md @@ -1,5 +1,3 @@ - - # Typetest Array client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-array - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Array instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-dictionary/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-dictionary/MANIFEST.in index 2194c3bd9fe..8d989eb529c 100644 --- a/packages/typespec-python/test/azure/generated/typetest-dictionary/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-dictionary/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include typetest/dictionary/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include typetest/__init__.py \ No newline at end of file +include typetest/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-dictionary/README.md b/packages/typespec-python/test/azure/generated/typetest-dictionary/README.md index b7876ea14b8..2f9cf4db3ae 100644 --- a/packages/typespec-python/test/azure/generated/typetest-dictionary/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-dictionary/README.md @@ -1,5 +1,3 @@ - - # Typetest Dictionary client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-dictionary - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Dictionary instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/MANIFEST.in index cadf7e31a1b..51fb6ca25f7 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/enum/extensible/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/enum/__init__.py \ No newline at end of file +include typetest/enum/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/README.md b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/README.md index 646a8c3ec3e..732d1bc3e71 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/README.md @@ -1,5 +1,3 @@ - - # Typetest Enum Extensible client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-enum-extensible - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Enum Extensible instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/MANIFEST.in index b60b55cdab3..577b197e8e9 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/enum/fixed/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/enum/__init__.py \ No newline at end of file +include typetest/enum/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/README.md b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/README.md index 4d463d20813..5013ea1e666 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/README.md @@ -1,5 +1,3 @@ - - # Typetest Enum Fixed client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-enum-fixed - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Enum Fixed instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-model-empty/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-model-empty/MANIFEST.in index 79c41726e37..5cd1e0e87ab 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-empty/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-model-empty/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/empty/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-model-empty/README.md b/packages/typespec-python/test/azure/generated/typetest-model-empty/README.md index 13436f53ae1..97abe628bd4 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-empty/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-empty/README.md @@ -1,5 +1,3 @@ - - # Typetest Model Empty client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-model-empty - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Model Empty instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/MANIFEST.in index a755cad0130..c88f38a9557 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/enumdiscriminator/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/README.md b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/README.md index b5a04356ccb..87136d34e9f 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/README.md @@ -1,5 +1,3 @@ - - # Typetest Model Enumdiscriminator client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-model-enumdiscriminator - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Model Enumdiscriminator instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/MANIFEST.in index b555114e4a7..8a9c735394b 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/nesteddiscriminator/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/README.md b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/README.md index 147aba5cdf9..7eecaa524f6 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/README.md @@ -1,5 +1,3 @@ - - # Typetest Model Nesteddiscriminator client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-model-nesteddiscriminator - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Model Nesteddiscriminator instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/MANIFEST.in index 16b644339ea..47fc2574304 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/notdiscriminated/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/README.md b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/README.md index 215be22d431..9b457baac4b 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/README.md @@ -1,5 +1,3 @@ - - # Typetest Model Notdiscriminated client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-model-notdiscriminated - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Model Notdiscriminated instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-model-recursive/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-model-recursive/MANIFEST.in index 2d44c39bf33..95276adaa97 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-recursive/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-model-recursive/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/recursive/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-model-recursive/README.md b/packages/typespec-python/test/azure/generated/typetest-model-recursive/README.md index 87540174157..3c740b4ead1 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-recursive/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-recursive/README.md @@ -1,5 +1,3 @@ - - # Typetest Model Recursive client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-model-recursive - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Model Recursive instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/MANIFEST.in index 0eab23be467..2cea11d5ea8 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/singlediscriminator/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/README.md b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/README.md index 1389647f068..6d69db5c472 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/README.md @@ -1,5 +1,3 @@ - - # Typetest Model Singlediscriminator client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-model-singlediscriminator - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Model Singlediscriminator instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-model-usage/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-model-usage/MANIFEST.in index 47ea6680c9a..d042ddbf08c 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-usage/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-model-usage/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/usage/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-model-usage/README.md b/packages/typespec-python/test/azure/generated/typetest-model-usage/README.md index fae75217c80..35c9cb5c356 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-usage/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-usage/README.md @@ -1,5 +1,3 @@ - - # Typetest Model Usage client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-model-usage - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Model Usage instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-model-visibility/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-model-visibility/MANIFEST.in index 23933c60348..13cad0d7ff6 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-visibility/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-model-visibility/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/visibility/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-model-visibility/README.md b/packages/typespec-python/test/azure/generated/typetest-model-visibility/README.md index dab0204dd64..d7f5644daaf 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-visibility/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-visibility/README.md @@ -1,5 +1,3 @@ - - # Typetest Model Visibility client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-model-visibility - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Model Visibility instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/MANIFEST.in index 57dd89e3dbe..f336dd88dac 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/property/additionalproperties/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/property/__init__.py \ No newline at end of file +include typetest/property/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/README.md b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/README.md index 25d305a17d6..8eaa1c29b60 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/README.md @@ -1,5 +1,3 @@ - - # Typetest Property Additionalproperties client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-property-additionalproperties - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Property Additionalproperties instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-property-nullable/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-property-nullable/MANIFEST.in index a0b21fd6e5b..9c6af5b254e 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-nullable/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-property-nullable/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/property/nullable/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/property/__init__.py \ No newline at end of file +include typetest/property/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-property-nullable/README.md b/packages/typespec-python/test/azure/generated/typetest-property-nullable/README.md index 53deb974893..463888fe727 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-nullable/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-property-nullable/README.md @@ -1,5 +1,3 @@ - - # Typetest Property Nullable client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-property-nullable - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Property Nullable instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-property-optional/MANIFEST.in index 7de1ad09fbc..2b81dc34d38 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-property-optional/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/property/optional/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/property/__init__.py \ No newline at end of file +include typetest/property/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/README.md b/packages/typespec-python/test/azure/generated/typetest-property-optional/README.md index 9467e0ad02d..91934a365a1 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-property-optional/README.md @@ -1,5 +1,3 @@ - - # Typetest Property Optional client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-property-optional - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Property Optional instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/MANIFEST.in index de3b3dbb96f..1168e7f57aa 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/property/valuetypes/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/property/__init__.py \ No newline at end of file +include typetest/property/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/README.md b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/README.md index 57072e646d1..94d17ab8485 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/README.md @@ -1,5 +1,3 @@ - - # Typetest Property Valuetypes client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-property-valuetypes - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Property Valuetypes instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-scalar/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-scalar/MANIFEST.in index a58aab400ed..61880ef6cba 100644 --- a/packages/typespec-python/test/azure/generated/typetest-scalar/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-scalar/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include typetest/scalar/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include typetest/__init__.py \ No newline at end of file +include typetest/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-scalar/README.md b/packages/typespec-python/test/azure/generated/typetest-scalar/README.md index 29451029d45..616cadbb029 100644 --- a/packages/typespec-python/test/azure/generated/typetest-scalar/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-scalar/README.md @@ -1,5 +1,3 @@ - - # Typetest Scalar client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-scalar - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Scalar instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/typetest-union/MANIFEST.in b/packages/typespec-python/test/azure/generated/typetest-union/MANIFEST.in index e66a3e513b1..607206a947f 100644 --- a/packages/typespec-python/test/azure/generated/typetest-union/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/typetest-union/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include typetest/union/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include typetest/__init__.py \ No newline at end of file +include typetest/__init__.py diff --git a/packages/typespec-python/test/azure/generated/typetest-union/README.md b/packages/typespec-python/test/azure/generated/typetest-union/README.md index 7438d06b0f6..9bd5719c2dd 100644 --- a/packages/typespec-python/test/azure/generated/typetest-union/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-union/README.md @@ -1,5 +1,3 @@ - - # Typetest Union client library for Python @@ -17,6 +15,7 @@ python -m pip install typetest-union - You need an [Azure subscription][azure_sub] to use this package. - An existing Typetest Union instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/versioning-added/MANIFEST.in b/packages/typespec-python/test/azure/generated/versioning-added/MANIFEST.in index b1be260c62a..53ff76c3a87 100644 --- a/packages/typespec-python/test/azure/generated/versioning-added/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/versioning-added/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/added/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/packages/typespec-python/test/azure/generated/versioning-added/README.md b/packages/typespec-python/test/azure/generated/versioning-added/README.md index a6227b40b52..0906f8d2388 100644 --- a/packages/typespec-python/test/azure/generated/versioning-added/README.md +++ b/packages/typespec-python/test/azure/generated/versioning-added/README.md @@ -1,5 +1,3 @@ - - # Versioning Added client library for Python @@ -17,6 +15,7 @@ python -m pip install versioning-added - You need an [Azure subscription][azure_sub] to use this package. - An existing Versioning Added instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/versioning-madeoptional/MANIFEST.in b/packages/typespec-python/test/azure/generated/versioning-madeoptional/MANIFEST.in index 0fe89d7fd9e..0c3e336fcef 100644 --- a/packages/typespec-python/test/azure/generated/versioning-madeoptional/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/versioning-madeoptional/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/madeoptional/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/packages/typespec-python/test/azure/generated/versioning-madeoptional/README.md b/packages/typespec-python/test/azure/generated/versioning-madeoptional/README.md index bd69c9deeb2..3cd90f5b32c 100644 --- a/packages/typespec-python/test/azure/generated/versioning-madeoptional/README.md +++ b/packages/typespec-python/test/azure/generated/versioning-madeoptional/README.md @@ -1,5 +1,3 @@ - - # Versioning Madeoptional client library for Python @@ -17,6 +15,7 @@ python -m pip install versioning-madeoptional - You need an [Azure subscription][azure_sub] to use this package. - An existing Versioning Madeoptional instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/versioning-removed/MANIFEST.in b/packages/typespec-python/test/azure/generated/versioning-removed/MANIFEST.in index fac2b952d50..85d3fb2ce8c 100644 --- a/packages/typespec-python/test/azure/generated/versioning-removed/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/versioning-removed/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/removed/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/packages/typespec-python/test/azure/generated/versioning-removed/README.md b/packages/typespec-python/test/azure/generated/versioning-removed/README.md index eb42466c2db..b62ebddfcb5 100644 --- a/packages/typespec-python/test/azure/generated/versioning-removed/README.md +++ b/packages/typespec-python/test/azure/generated/versioning-removed/README.md @@ -1,5 +1,3 @@ - - # Versioning Removed client library for Python @@ -17,6 +15,7 @@ python -m pip install versioning-removed - You need an [Azure subscription][azure_sub] to use this package. - An existing Versioning Removed instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/versioning-renamedfrom/MANIFEST.in b/packages/typespec-python/test/azure/generated/versioning-renamedfrom/MANIFEST.in index e8853b0efa9..68c9d666a33 100644 --- a/packages/typespec-python/test/azure/generated/versioning-renamedfrom/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/versioning-renamedfrom/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/renamedfrom/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/packages/typespec-python/test/azure/generated/versioning-renamedfrom/README.md b/packages/typespec-python/test/azure/generated/versioning-renamedfrom/README.md index 49af6693435..10ca4e24054 100644 --- a/packages/typespec-python/test/azure/generated/versioning-renamedfrom/README.md +++ b/packages/typespec-python/test/azure/generated/versioning-renamedfrom/README.md @@ -1,5 +1,3 @@ - - # Versioning Renamedfrom client library for Python @@ -17,6 +15,7 @@ python -m pip install versioning-renamedfrom - You need an [Azure subscription][azure_sub] to use this package. - An existing Versioning Renamedfrom instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/versioning-returntypechangedfrom/MANIFEST.in b/packages/typespec-python/test/azure/generated/versioning-returntypechangedfrom/MANIFEST.in index 9908ce3b143..d097edf0a73 100644 --- a/packages/typespec-python/test/azure/generated/versioning-returntypechangedfrom/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/versioning-returntypechangedfrom/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/returntypechangedfrom/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/packages/typespec-python/test/azure/generated/versioning-returntypechangedfrom/README.md b/packages/typespec-python/test/azure/generated/versioning-returntypechangedfrom/README.md index 131cecd842b..e85ac34ca4c 100644 --- a/packages/typespec-python/test/azure/generated/versioning-returntypechangedfrom/README.md +++ b/packages/typespec-python/test/azure/generated/versioning-returntypechangedfrom/README.md @@ -1,5 +1,3 @@ - - # Versioning Returntypechangedfrom client library for Python @@ -17,6 +15,7 @@ python -m pip install versioning-returntypechangedfrom - You need an [Azure subscription][azure_sub] to use this package. - An existing Versioning Returntypechangedfrom instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/azure/generated/versioning-typechangedfrom/MANIFEST.in b/packages/typespec-python/test/azure/generated/versioning-typechangedfrom/MANIFEST.in index 9d66ecf8fe3..667a92076b0 100644 --- a/packages/typespec-python/test/azure/generated/versioning-typechangedfrom/MANIFEST.in +++ b/packages/typespec-python/test/azure/generated/versioning-typechangedfrom/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/typechangedfrom/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/packages/typespec-python/test/azure/generated/versioning-typechangedfrom/README.md b/packages/typespec-python/test/azure/generated/versioning-typechangedfrom/README.md index dbb623ac417..5cd5efa18fb 100644 --- a/packages/typespec-python/test/azure/generated/versioning-typechangedfrom/README.md +++ b/packages/typespec-python/test/azure/generated/versioning-typechangedfrom/README.md @@ -1,5 +1,3 @@ - - # Versioning Typechangedfrom client library for Python @@ -17,6 +15,7 @@ python -m pip install versioning-typechangedfrom - You need an [Azure subscription][azure_sub] to use this package. - An existing Versioning Typechangedfrom instance. + ## Contributing This project welcomes contributions and suggestions. Most contributions require @@ -42,4 +41,3 @@ additional questions or comments. [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential [pip]: https://pypi.org/project/pip/ [azure_sub]: https://azure.microsoft.com/free/ - diff --git a/packages/typespec-python/test/unbranded/generated/authentication-api-key/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/authentication-api-key/MANIFEST.in index 84258db3b15..805328d742a 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-api-key/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/authentication-api-key/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include authentication/apikey/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include authentication/__init__.py \ No newline at end of file +include authentication/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/MANIFEST.in index b61198cfa7f..6f9c2254b26 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/MANIFEST.in @@ -4,4 +4,4 @@ include authentication/http/custom/py.typed recursive-include tests *.py recursive-include samples *.py *.md include authentication/__init__.py -include authentication/http/__init__.py \ No newline at end of file +include authentication/http/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/setup.py b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/setup.py index e98cb77b42b..8c728f9a540 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/setup.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/setup.py @@ -13,7 +13,7 @@ PACKAGE_NAME = "authentication-http-custom" -PACKAGE_PPRINT_NAME = "Authentication Http Custom Service" +PACKAGE_PPRINT_NAME = "Authentication Http Custom" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace("-", "/") diff --git a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/MANIFEST.in index 9c73f66d6b1..9bb1ed4315f 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include authentication/oauth2/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include authentication/__init__.py \ No newline at end of file +include authentication/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/authentication-union/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/authentication-union/MANIFEST.in index 83649fb608a..a8e19db2766 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-union/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/authentication-union/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include authentication/union/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include authentication/__init__.py \ No newline at end of file +include authentication/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/encode-bytes/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/encode-bytes/MANIFEST.in index 75b3ca6eac0..8b0e3efbc6c 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-bytes/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/encode-bytes/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include encode/bytes/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include encode/__init__.py \ No newline at end of file +include encode/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/encode-datetime/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/encode-datetime/MANIFEST.in index 63254f8a20e..d686e124bfd 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-datetime/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/encode-datetime/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include encode/datetime/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include encode/__init__.py \ No newline at end of file +include encode/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/encode-duration/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/encode-duration/MANIFEST.in index 62dea304f68..3979592823a 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-duration/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/encode-duration/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include encode/duration/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include encode/__init__.py \ No newline at end of file +include encode/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/encode-numeric/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/encode-numeric/MANIFEST.in index c5a0766925a..9f4baead01e 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-numeric/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/encode-numeric/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include encode/numeric/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include encode/__init__.py \ No newline at end of file +include encode/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/MANIFEST.in index 3a185557967..8d48e547d69 100644 --- a/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/MANIFEST.in @@ -2,4 +2,4 @@ include *.md include LICENSE include headasbooleanfalse/py.typed recursive-include tests *.py -recursive-include samples *.py *.md \ No newline at end of file +recursive-include samples *.py *.md diff --git a/packages/typespec-python/test/unbranded/generated/headasbooleantrue/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/headasbooleantrue/MANIFEST.in index 89f2c0dccd2..d79293c6f31 100644 --- a/packages/typespec-python/test/unbranded/generated/headasbooleantrue/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/headasbooleantrue/MANIFEST.in @@ -2,4 +2,4 @@ include *.md include LICENSE include headasbooleantrue/py.typed recursive-include tests *.py -recursive-include samples *.py *.md \ No newline at end of file +recursive-include samples *.py *.md diff --git a/packages/typespec-python/test/unbranded/generated/parameters-basic/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/parameters-basic/MANIFEST.in index 18f9767aa78..ec6eea5b987 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-basic/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/parameters-basic/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include parameters/basic/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include parameters/__init__.py \ No newline at end of file +include parameters/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/MANIFEST.in index 0d45a014ef2..2dad293a4dc 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include parameters/bodyoptionality/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include parameters/__init__.py \ No newline at end of file +include parameters/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/parameters-collection-format/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/parameters-collection-format/MANIFEST.in index 90d0ba2db1f..e4e65c4a1d5 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-collection-format/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/parameters-collection-format/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include parameters/collectionformat/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include parameters/__init__.py \ No newline at end of file +include parameters/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/parameters-spread/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/parameters-spread/MANIFEST.in index 1deab2a88dd..eae446dee33 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-spread/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/parameters-spread/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include parameters/spread/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include parameters/__init__.py \ No newline at end of file +include parameters/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/MANIFEST.in index dc7a7e5536d..5a3e215c4f4 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/contentnegotiation/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/MANIFEST.in index a4b16dd0a5c..5294299b234 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/jsonmergepatch/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/payload-media-type/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/payload-media-type/MANIFEST.in index 72b1c340a64..4c10e654b7f 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-media-type/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/payload-media-type/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/mediatype/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/payload-multipart/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/payload-multipart/MANIFEST.in index c41546020da..022fdb3ee1f 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-multipart/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/payload-multipart/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/multipart/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/payload-pageable/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/payload-pageable/MANIFEST.in index f2e18952488..24d62ee29fd 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-pageable/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/payload-pageable/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/pageable/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/payload-xml/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/payload-xml/MANIFEST.in index 07a0c716455..ef8f20ba112 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-xml/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/payload-xml/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include payload/xml/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include payload/__init__.py \ No newline at end of file +include payload/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/response-status-code-range/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/response-status-code-range/MANIFEST.in index 87b2b3fe020..3b3539da09f 100644 --- a/packages/typespec-python/test/unbranded/generated/response-status-code-range/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/response-status-code-range/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include response/statuscoderange/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include response/__init__.py \ No newline at end of file +include response/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/routes/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/routes/MANIFEST.in index d3777f92f7f..0d81e3a9d35 100644 --- a/packages/typespec-python/test/unbranded/generated/routes/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/routes/MANIFEST.in @@ -2,4 +2,4 @@ include *.md include LICENSE include routes/py.typed recursive-include tests *.py -recursive-include samples *.py *.md \ No newline at end of file +recursive-include samples *.py *.md diff --git a/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/MANIFEST.in index ae346d7ed79..129d71d3353 100644 --- a/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/MANIFEST.in @@ -4,4 +4,4 @@ include serialization/encodedname/json/py.typed recursive-include tests *.py recursive-include samples *.py *.md include serialization/__init__.py -include serialization/encodedname/__init__.py \ No newline at end of file +include serialization/encodedname/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/MANIFEST.in index 3fb7e5ef0a6..f1826052a5d 100644 --- a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/MANIFEST.in @@ -4,4 +4,4 @@ include server/endpoint/notdefined/py.typed recursive-include tests *.py recursive-include samples *.py *.md include server/__init__.py -include server/endpoint/__init__.py \ No newline at end of file +include server/endpoint/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/server-path-multiple/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/server-path-multiple/MANIFEST.in index 543f941fab6..56d253b0ae2 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-multiple/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/server-path-multiple/MANIFEST.in @@ -4,4 +4,4 @@ include server/path/multiple/py.typed recursive-include tests *.py recursive-include samples *.py *.md include server/__init__.py -include server/path/__init__.py \ No newline at end of file +include server/path/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/server-path-single/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/server-path-single/MANIFEST.in index 973c402a023..d3262e4af86 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-single/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/server-path-single/MANIFEST.in @@ -4,4 +4,4 @@ include server/path/single/py.typed recursive-include tests *.py recursive-include samples *.py *.md include server/__init__.py -include server/path/__init__.py \ No newline at end of file +include server/path/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/MANIFEST.in index cb00091dc98..03251cbd03c 100644 --- a/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/MANIFEST.in @@ -4,4 +4,4 @@ include server/versions/notversioned/py.typed recursive-include tests *.py recursive-include samples *.py *.md include server/__init__.py -include server/versions/__init__.py \ No newline at end of file +include server/versions/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/server-versions-versioned/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/server-versions-versioned/MANIFEST.in index 7779034f76c..914710e6ed5 100644 --- a/packages/typespec-python/test/unbranded/generated/server-versions-versioned/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/server-versions-versioned/MANIFEST.in @@ -4,4 +4,4 @@ include server/versions/versioned/py.typed recursive-include tests *.py recursive-include samples *.py *.md include server/__init__.py -include server/versions/__init__.py \ No newline at end of file +include server/versions/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/MANIFEST.in index f9e928ca45b..fc707cbe7eb 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include specialheaders/conditionalrequest/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include specialheaders/__init__.py \ No newline at end of file +include specialheaders/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/MANIFEST.in index 237a98837bc..e7e275be2ba 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include specialheaders/repeatability/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include specialheaders/__init__.py \ No newline at end of file +include specialheaders/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/special-words/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/special-words/MANIFEST.in index fa4fcb28a3e..0bd139fa00a 100644 --- a/packages/typespec-python/test/unbranded/generated/special-words/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/special-words/MANIFEST.in @@ -2,4 +2,4 @@ include *.md include LICENSE include specialwords/py.typed recursive-include tests *.py -recursive-include samples *.py *.md \ No newline at end of file +recursive-include samples *.py *.md diff --git a/packages/typespec-python/test/unbranded/generated/streaming-jsonl/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/streaming-jsonl/MANIFEST.in index 0535e9d52c8..32a6518ac7e 100644 --- a/packages/typespec-python/test/unbranded/generated/streaming-jsonl/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/streaming-jsonl/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include streaming/jsonl/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include streaming/__init__.py \ No newline at end of file +include streaming/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-array/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-array/MANIFEST.in index a465968cb1a..23611f20002 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-array/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-array/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include typetest/array/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include typetest/__init__.py \ No newline at end of file +include typetest/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-dictionary/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-dictionary/MANIFEST.in index 2194c3bd9fe..8d989eb529c 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-dictionary/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-dictionary/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include typetest/dictionary/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include typetest/__init__.py \ No newline at end of file +include typetest/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/MANIFEST.in index cadf7e31a1b..51fb6ca25f7 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/enum/extensible/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/enum/__init__.py \ No newline at end of file +include typetest/enum/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/MANIFEST.in index b60b55cdab3..577b197e8e9 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/enum/fixed/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/enum/__init__.py \ No newline at end of file +include typetest/enum/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-empty/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-model-empty/MANIFEST.in index 79c41726e37..5cd1e0e87ab 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-empty/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-empty/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/empty/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/MANIFEST.in index a755cad0130..c88f38a9557 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/enumdiscriminator/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/MANIFEST.in index b555114e4a7..8a9c735394b 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/nesteddiscriminator/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/MANIFEST.in index 16b644339ea..47fc2574304 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/notdiscriminated/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/MANIFEST.in index 2d44c39bf33..95276adaa97 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/recursive/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/MANIFEST.in index 0eab23be467..2cea11d5ea8 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/singlediscriminator/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-usage/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-model-usage/MANIFEST.in index 47ea6680c9a..d042ddbf08c 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-usage/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-usage/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/usage/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/MANIFEST.in index 23933c60348..13cad0d7ff6 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/model/visibility/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/model/__init__.py \ No newline at end of file +include typetest/model/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/MANIFEST.in index 57dd89e3dbe..f336dd88dac 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/property/additionalproperties/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/property/__init__.py \ No newline at end of file +include typetest/property/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/MANIFEST.in index a0b21fd6e5b..9c6af5b254e 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/property/nullable/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/property/__init__.py \ No newline at end of file +include typetest/property/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/MANIFEST.in index 7de1ad09fbc..2b81dc34d38 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/property/optional/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/property/__init__.py \ No newline at end of file +include typetest/property/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/MANIFEST.in index de3b3dbb96f..1168e7f57aa 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/MANIFEST.in @@ -4,4 +4,4 @@ include typetest/property/valuetypes/py.typed recursive-include tests *.py recursive-include samples *.py *.md include typetest/__init__.py -include typetest/property/__init__.py \ No newline at end of file +include typetest/property/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-scalar/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-scalar/MANIFEST.in index a58aab400ed..61880ef6cba 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-scalar/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-scalar/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include typetest/scalar/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include typetest/__init__.py \ No newline at end of file +include typetest/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/typetest-union/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/typetest-union/MANIFEST.in index e66a3e513b1..607206a947f 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-union/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/typetest-union/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include typetest/union/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include typetest/__init__.py \ No newline at end of file +include typetest/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/versioning-added/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/versioning-added/MANIFEST.in index b1be260c62a..53ff76c3a87 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-added/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/versioning-added/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/added/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/versioning-madeoptional/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/versioning-madeoptional/MANIFEST.in index 0fe89d7fd9e..0c3e336fcef 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-madeoptional/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/versioning-madeoptional/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/madeoptional/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/versioning-removed/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/versioning-removed/MANIFEST.in index fac2b952d50..85d3fb2ce8c 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-removed/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/versioning-removed/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/removed/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/versioning-renamedfrom/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/versioning-renamedfrom/MANIFEST.in index e8853b0efa9..68c9d666a33 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-renamedfrom/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/versioning-renamedfrom/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/renamedfrom/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/versioning-returntypechangedfrom/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/versioning-returntypechangedfrom/MANIFEST.in index 9908ce3b143..d097edf0a73 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-returntypechangedfrom/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/versioning-returntypechangedfrom/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/returntypechangedfrom/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/versioning-typechangedfrom/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/versioning-typechangedfrom/MANIFEST.in index 9d66ecf8fe3..667a92076b0 100644 --- a/packages/typespec-python/test/unbranded/generated/versioning-typechangedfrom/MANIFEST.in +++ b/packages/typespec-python/test/unbranded/generated/versioning-typechangedfrom/MANIFEST.in @@ -3,4 +3,4 @@ include LICENSE include versioning/typechangedfrom/py.typed recursive-include tests *.py recursive-include samples *.py *.md -include versioning/__init__.py \ No newline at end of file +include versioning/__init__.py diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9e1f3b2a59e..57ae98610f7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -57,8 +57,8 @@ importers: specifier: ~1.0.2 version: 1.0.2 '@typespec/http-client-python': - specifier: ~0.8.1 - version: 0.8.1(xyfohv7glp6msr4ipudj2mb5ju) + specifier: ~0.9.0-dev.1 + version: 0.9.0-dev.1(na5sqrbfiqe26rpjh3d3zww5om) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -79,8 +79,8 @@ importers: packages/typespec-python: dependencies: '@typespec/http-client-python': - specifier: ~0.8.1 - version: 0.8.1(z4b5mqrksjtjtkrtw4eaa2rjea) + specifier: ~0.9.0-dev.1 + version: 0.9.0-dev.1(tbepisicnniwwh5yfhvlwsftvu) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -99,7 +99,7 @@ importers: version: 0.1.0-alpha.10(hxmxu44wsiwmqbpvyuomrsmujq) '@azure-tools/typespec-autorest': specifier: ~0.53.0 - version: 0.53.0(vsru7ipd7qt42slknz5aanwsou) + version: 0.53.0(e3cfoxkazmlklhsfsyiqwpleoq) '@azure-tools/typespec-azure-core': specifier: ~0.53.0 version: 0.53.0(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))) @@ -108,10 +108,10 @@ importers: version: 0.53.0(felt6lfzt5orrlwrzxpkykwppa) '@azure-tools/typespec-azure-rulesets': specifier: ~0.53.0 - version: 0.53.0(@azure-tools/typespec-azure-core@0.53.0(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))))(@azure-tools/typespec-azure-resource-manager@0.53.0(felt6lfzt5orrlwrzxpkykwppa))(@azure-tools/typespec-client-generator-core@0.53.0(3qm5ewpnxvwkav6ttg6x7temqm))(@typespec/compiler@0.67.1(@types/node@22.5.5)) + version: 0.53.0(@azure-tools/typespec-azure-core@0.53.0(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))))(@azure-tools/typespec-azure-resource-manager@0.53.0(felt6lfzt5orrlwrzxpkykwppa))(@azure-tools/typespec-client-generator-core@0.53.1(3qm5ewpnxvwkav6ttg6x7temqm))(@typespec/compiler@0.67.1(@types/node@22.5.5)) '@azure-tools/typespec-client-generator-core': - specifier: ~0.53.0 - version: 0.53.0(3qm5ewpnxvwkav6ttg6x7temqm) + specifier: ~0.53.1 + version: 0.53.1(3qm5ewpnxvwkav6ttg6x7temqm) '@types/fs-extra': specifier: 11.0.4 version: 11.0.4 @@ -231,8 +231,8 @@ packages: '@azure-tools/typespec-client-generator-core': ^0.53.0 '@typespec/compiler': ^0.67.0 - '@azure-tools/typespec-client-generator-core@0.53.0': - resolution: {integrity: sha512-EXdkC76HmAdaH0kzET38pPpG7Phoyvp9AFYsAXnQdhRQssfI+x9nxEADix8GZ2n2P1P50ZysvzWeciqgqUbRVw==} + '@azure-tools/typespec-client-generator-core@0.53.1': + resolution: {integrity: sha512-BWHQQ9Kjsk23Rb0eZ6V6HI2Gr20n/LhxAKEuBChCFWLjrFMYyXrHtlUBK6j/9D2VqwjaurRQA2SVXx/wzGyvAg==} engines: {node: '>=20.0.0'} peerDependencies: '@azure-tools/typespec-azure-core': ^0.53.0 @@ -1535,15 +1535,15 @@ packages: peerDependencies: '@typespec/compiler': ^0.67.1 - '@typespec/http-client-python@0.8.1': - resolution: {integrity: sha512-OeSO54sFSfR6/Gkny0S3UJTHrXYwfRcaMJf94uBnTUgo5r9QZSBj2BXjNfW4opOvyZ3S7m5ozRQVp9LAMz8suQ==} - engines: {node: '>=18.0.0'} + '@typespec/http-client-python@0.9.0-dev.1': + resolution: {integrity: sha512-Bch/zdt2wol6e4sBHbfruXVexubKfp1oM9jY8GXDGBvXKoSgMVDwVahExrf58JSrMeLFN2rcEL+BH2BTLJCd/w==} + engines: {node: '>=20.0.0'} peerDependencies: '@azure-tools/typespec-autorest': '>=0.53.0 <1.0.0' '@azure-tools/typespec-azure-core': '>=0.53.0 <1.0.0' '@azure-tools/typespec-azure-resource-manager': '>=0.53.0 <1.0.0' '@azure-tools/typespec-azure-rulesets': '>=0.53.0 <3.0.0' - '@azure-tools/typespec-client-generator-core': '>=0.53.0 <1.0.0' + '@azure-tools/typespec-client-generator-core': '>=0.53.1 <1.0.0' '@typespec/compiler': '>=0.67.0 <1.0.0' '@typespec/http': '>=0.67.0 <1.0.0' '@typespec/openapi': '>=0.67.0 <1.0.0' @@ -4526,28 +4526,28 @@ snapshots: - debug - supports-color - '@azure-tools/typespec-autorest@0.53.0(nzqsibdudqbld3r7bpinzdupvm)': - dependencies: - '@azure-tools/typespec-azure-core': 0.53.0(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))) - '@azure-tools/typespec-azure-resource-manager': 0.53.0(3gv5j4bbl2jtmj53euvpetu3oa) - '@azure-tools/typespec-client-generator-core': 0.53.0(vvgwrzozbt5d3w3ee557dp5xuy) - '@typespec/compiler': 0.67.1(@types/node@22.13.10) - '@typespec/http': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))) - '@typespec/openapi': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10)))) - '@typespec/rest': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10)))) - '@typespec/versioning': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10)) - - '@azure-tools/typespec-autorest@0.53.0(vsru7ipd7qt42slknz5aanwsou)': + '@azure-tools/typespec-autorest@0.53.0(e3cfoxkazmlklhsfsyiqwpleoq)': dependencies: '@azure-tools/typespec-azure-core': 0.53.0(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))) '@azure-tools/typespec-azure-resource-manager': 0.53.0(felt6lfzt5orrlwrzxpkykwppa) - '@azure-tools/typespec-client-generator-core': 0.53.0(3qm5ewpnxvwkav6ttg6x7temqm) + '@azure-tools/typespec-client-generator-core': 0.53.1(3qm5ewpnxvwkav6ttg6x7temqm) '@typespec/compiler': 0.67.1(@types/node@22.5.5) '@typespec/http': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))) '@typespec/openapi': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5)))) '@typespec/rest': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5)))) '@typespec/versioning': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5)) + '@azure-tools/typespec-autorest@0.53.0(wjegnqrrlroq36cedwihs7fwdy)': + dependencies: + '@azure-tools/typespec-azure-core': 0.53.0(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))) + '@azure-tools/typespec-azure-resource-manager': 0.53.0(3gv5j4bbl2jtmj53euvpetu3oa) + '@azure-tools/typespec-client-generator-core': 0.53.1(vvgwrzozbt5d3w3ee557dp5xuy) + '@typespec/compiler': 0.67.1(@types/node@22.13.10) + '@typespec/http': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))) + '@typespec/openapi': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10)))) + '@typespec/rest': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10)))) + '@typespec/versioning': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10)) + '@azure-tools/typespec-azure-core@0.53.0(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10)))))': dependencies: '@typespec/compiler': 0.67.1(@types/node@22.13.10) @@ -4582,21 +4582,21 @@ snapshots: change-case: 5.4.4 pluralize: 8.0.0 - '@azure-tools/typespec-azure-rulesets@0.53.0(@azure-tools/typespec-azure-core@0.53.0(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))))(@azure-tools/typespec-azure-resource-manager@0.53.0(3gv5j4bbl2jtmj53euvpetu3oa))(@azure-tools/typespec-client-generator-core@0.53.0(vvgwrzozbt5d3w3ee557dp5xuy))(@typespec/compiler@0.67.1(@types/node@22.13.10))': + '@azure-tools/typespec-azure-rulesets@0.53.0(@azure-tools/typespec-azure-core@0.53.0(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))))(@azure-tools/typespec-azure-resource-manager@0.53.0(3gv5j4bbl2jtmj53euvpetu3oa))(@azure-tools/typespec-client-generator-core@0.53.1(vvgwrzozbt5d3w3ee557dp5xuy))(@typespec/compiler@0.67.1(@types/node@22.13.10))': dependencies: '@azure-tools/typespec-azure-core': 0.53.0(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))) '@azure-tools/typespec-azure-resource-manager': 0.53.0(3gv5j4bbl2jtmj53euvpetu3oa) - '@azure-tools/typespec-client-generator-core': 0.53.0(vvgwrzozbt5d3w3ee557dp5xuy) + '@azure-tools/typespec-client-generator-core': 0.53.1(vvgwrzozbt5d3w3ee557dp5xuy) '@typespec/compiler': 0.67.1(@types/node@22.13.10) - '@azure-tools/typespec-azure-rulesets@0.53.0(@azure-tools/typespec-azure-core@0.53.0(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))))(@azure-tools/typespec-azure-resource-manager@0.53.0(felt6lfzt5orrlwrzxpkykwppa))(@azure-tools/typespec-client-generator-core@0.53.0(3qm5ewpnxvwkav6ttg6x7temqm))(@typespec/compiler@0.67.1(@types/node@22.5.5))': + '@azure-tools/typespec-azure-rulesets@0.53.0(@azure-tools/typespec-azure-core@0.53.0(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))))(@azure-tools/typespec-azure-resource-manager@0.53.0(felt6lfzt5orrlwrzxpkykwppa))(@azure-tools/typespec-client-generator-core@0.53.1(3qm5ewpnxvwkav6ttg6x7temqm))(@typespec/compiler@0.67.1(@types/node@22.5.5))': dependencies: '@azure-tools/typespec-azure-core': 0.53.0(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))) '@azure-tools/typespec-azure-resource-manager': 0.53.0(felt6lfzt5orrlwrzxpkykwppa) - '@azure-tools/typespec-client-generator-core': 0.53.0(3qm5ewpnxvwkav6ttg6x7temqm) + '@azure-tools/typespec-client-generator-core': 0.53.1(3qm5ewpnxvwkav6ttg6x7temqm) '@typespec/compiler': 0.67.1(@types/node@22.5.5) - '@azure-tools/typespec-client-generator-core@0.53.0(3qm5ewpnxvwkav6ttg6x7temqm)': + '@azure-tools/typespec-client-generator-core@0.53.1(3qm5ewpnxvwkav6ttg6x7temqm)': dependencies: '@azure-tools/typespec-azure-core': 0.53.0(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))) '@typespec/compiler': 0.67.1(@types/node@22.5.5) @@ -4612,7 +4612,7 @@ snapshots: pluralize: 8.0.0 yaml: 2.7.0 - '@azure-tools/typespec-client-generator-core@0.53.0(vvgwrzozbt5d3w3ee557dp5xuy)': + '@azure-tools/typespec-client-generator-core@0.53.1(vvgwrzozbt5d3w3ee557dp5xuy)': dependencies: '@azure-tools/typespec-azure-core': 0.53.0(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))) '@typespec/compiler': 0.67.1(@types/node@22.13.10) @@ -6143,13 +6143,13 @@ snapshots: dependencies: '@typespec/compiler': 0.67.1(@types/node@22.5.5) - '@typespec/http-client-python@0.8.1(xyfohv7glp6msr4ipudj2mb5ju)': + '@typespec/http-client-python@0.9.0-dev.1(na5sqrbfiqe26rpjh3d3zww5om)': dependencies: - '@azure-tools/typespec-autorest': 0.53.0(nzqsibdudqbld3r7bpinzdupvm) + '@azure-tools/typespec-autorest': 0.53.0(wjegnqrrlroq36cedwihs7fwdy) '@azure-tools/typespec-azure-core': 0.53.0(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))) '@azure-tools/typespec-azure-resource-manager': 0.53.0(3gv5j4bbl2jtmj53euvpetu3oa) - '@azure-tools/typespec-azure-rulesets': 0.53.0(@azure-tools/typespec-azure-core@0.53.0(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))))(@azure-tools/typespec-azure-resource-manager@0.53.0(3gv5j4bbl2jtmj53euvpetu3oa))(@azure-tools/typespec-client-generator-core@0.53.0(vvgwrzozbt5d3w3ee557dp5xuy))(@typespec/compiler@0.67.1(@types/node@22.13.10)) - '@azure-tools/typespec-client-generator-core': 0.53.0(vvgwrzozbt5d3w3ee557dp5xuy) + '@azure-tools/typespec-azure-rulesets': 0.53.0(@azure-tools/typespec-azure-core@0.53.0(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))))))(@azure-tools/typespec-azure-resource-manager@0.53.0(3gv5j4bbl2jtmj53euvpetu3oa))(@azure-tools/typespec-client-generator-core@0.53.1(vvgwrzozbt5d3w3ee557dp5xuy))(@typespec/compiler@0.67.1(@types/node@22.13.10)) + '@azure-tools/typespec-client-generator-core': 0.53.1(vvgwrzozbt5d3w3ee557dp5xuy) '@typespec/compiler': 0.67.1(@types/node@22.13.10) '@typespec/http': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))) '@typespec/openapi': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.13.10)))) @@ -6164,13 +6164,13 @@ snapshots: - bufferutil - utf-8-validate - '@typespec/http-client-python@0.8.1(z4b5mqrksjtjtkrtw4eaa2rjea)': + '@typespec/http-client-python@0.9.0-dev.1(tbepisicnniwwh5yfhvlwsftvu)': dependencies: - '@azure-tools/typespec-autorest': 0.53.0(vsru7ipd7qt42slknz5aanwsou) + '@azure-tools/typespec-autorest': 0.53.0(e3cfoxkazmlklhsfsyiqwpleoq) '@azure-tools/typespec-azure-core': 0.53.0(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))) '@azure-tools/typespec-azure-resource-manager': 0.53.0(felt6lfzt5orrlwrzxpkykwppa) - '@azure-tools/typespec-azure-rulesets': 0.53.0(@azure-tools/typespec-azure-core@0.53.0(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))))(@azure-tools/typespec-azure-resource-manager@0.53.0(felt6lfzt5orrlwrzxpkykwppa))(@azure-tools/typespec-client-generator-core@0.53.0(3qm5ewpnxvwkav6ttg6x7temqm))(@typespec/compiler@0.67.1(@types/node@22.5.5)) - '@azure-tools/typespec-client-generator-core': 0.53.0(3qm5ewpnxvwkav6ttg6x7temqm) + '@azure-tools/typespec-azure-rulesets': 0.53.0(@azure-tools/typespec-azure-core@0.53.0(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))(@typespec/rest@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))))(@azure-tools/typespec-azure-resource-manager@0.53.0(felt6lfzt5orrlwrzxpkykwppa))(@azure-tools/typespec-client-generator-core@0.53.1(3qm5ewpnxvwkav6ttg6x7temqm))(@typespec/compiler@0.67.1(@types/node@22.5.5)) + '@azure-tools/typespec-client-generator-core': 0.53.1(3qm5ewpnxvwkav6ttg6x7temqm) '@typespec/compiler': 0.67.1(@types/node@22.5.5) '@typespec/http': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))) '@typespec/openapi': 0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/http@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))(@typespec/streams@0.67.1(@typespec/compiler@0.67.1(@types/node@22.5.5))))