From 017f90f499978212ce23c65ff71c304d559b1b5b Mon Sep 17 00:00:00 2001 From: AutoPrFromHttpClientPython Date: Fri, 20 Mar 2026 01:09:08 +0000 Subject: [PATCH 1/5] Update dependencies --- packages/autorest.python/package.json | 2 +- packages/typespec-python/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/autorest.python/package.json b/packages/autorest.python/package.json index 8d44652bbf..e3d2ec43ae 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": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzMjIxMi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz", + "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzODE4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz", "@autorest/system-requirements": "~1.0.2", "fs-extra": "~11.2.0", "tsx": "^4.21.0" diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index 92171a080e..7024d804cb 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -67,7 +67,7 @@ "js-yaml": "~4.1.0", "semver": "~7.6.2", "tsx": "^4.21.0", - "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzMjIxMi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz", + "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzODE4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz", "fs-extra": "~11.2.0" }, "devDependencies": { @@ -87,7 +87,7 @@ "@azure-tools/typespec-autorest": "~0.66.0", "@azure-tools/typespec-client-generator-core": "~0.66.2", "@azure-tools/azure-http-specs": "0.1.0-alpha.39-dev.4", - "@typespec/http-specs": "0.1.0-alpha.35-dev.4", + "@typespec/http-specs": "0.1.0-alpha.35-dev.5", "@typespec/spector": "0.1.0-alpha.24", "@typespec/spec-api": "0.1.0-alpha.14-dev.1", "@types/js-yaml": "~4.0.5", From 9132796de72e9922acd5f5f092bbb457f854769b Mon Sep 17 00:00:00 2001 From: AutoPrFromHttpClientPython Date: Fri, 20 Mar 2026 01:09:11 +0000 Subject: [PATCH 2/5] Sync shared files from typespec repo (2026-03-20 01:09:11) --- .../scripts/eng/regenerate-common.ts | 811 +++++++++--------- packages/typespec-python/src/lib.ts | 6 +- .../asynctests/test_payload_xml_async.py | 114 +++ .../test_payload_xml.py | 103 +++ 4 files changed, 638 insertions(+), 396 deletions(-) diff --git a/packages/typespec-python/scripts/eng/regenerate-common.ts b/packages/typespec-python/scripts/eng/regenerate-common.ts index 9880418935..9f9a91266d 100644 --- a/packages/typespec-python/scripts/eng/regenerate-common.ts +++ b/packages/typespec-python/scripts/eng/regenerate-common.ts @@ -6,444 +6,467 @@ import { dirname, join, relative, resolve } from "path"; export const SKIP_SPECS: string[] = ["type/file"]; export const SpecialFlags: Record> = { - azure: { - "generate-test": true, - "generate-sample": true, - }, + azure: { + "generate-test": true, + "generate-sample": true, + }, }; // ---- Base emitter options (shared across repos) ---- -export const BASE_AZURE_EMITTER_OPTIONS: Record | Record[]> = { - "azure/client-generator-core/access": { - namespace: "specs.azure.clientgenerator.core.access", - }, - "azure/client-generator-core/alternate-type": { - namespace: "specs.azure.clientgenerator.core.alternatetype", - }, - "azure/client-generator-core/api-version": { - namespace: "specs.azure.clientgenerator.core.apiversion", - }, - "azure/client-generator-core/client-initialization/default": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.default", - }, - "azure/client-generator-core/client-initialization/individually": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.individually", - }, - "azure/client-generator-core/client-initialization/individuallyParent": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.individuallyparent", - }, - "azure/client-generator-core/client-location": { - namespace: "specs.azure.clientgenerator.core.clientlocation", - }, - "azure/client-generator-core/deserialize-empty-string-as-null": { - namespace: "specs.azure.clientgenerator.core.emptystring", - }, - "azure/client-generator-core/flatten-property": { - namespace: "specs.azure.clientgenerator.core.flattenproperty", - }, - "azure/client-generator-core/usage": { - namespace: "specs.azure.clientgenerator.core.usage", - }, - "azure/client-generator-core/override": { - namespace: "specs.azure.clientgenerator.core.override", - }, - "azure/client-generator-core/hierarchy-building": { - namespace: "specs.azure.clientgenerator.core.hierarchybuilding", - }, - "azure/core/basic": { - namespace: "specs.azure.core.basic", - }, - "azure/core/lro/rpc": { - namespace: "specs.azure.core.lro.rpc", - }, - "azure/core/lro/standard": { - namespace: "specs.azure.core.lro.standard", - }, - "azure/core/model": { - namespace: "specs.azure.core.model", - }, - "azure/core/page": { - namespace: "specs.azure.core.page", - }, - "azure/core/scalar": { - namespace: "specs.azure.core.scalar", - }, - "azure/core/traits": { - namespace: "specs.azure.core.traits", - }, - "azure/encode/duration": { - namespace: "specs.azure.encode.duration", - }, - "azure/example/basic": { - namespace: "specs.azure.example.basic", - }, - "azure/payload/pageable": { - namespace: "specs.azure.payload.pageable", - }, - "azure/versioning/previewVersion": { - namespace: "specs.azure.versioning.previewversion", - }, - "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.main", - }, - "client/overload": { - namespace: "client.overload", - }, - "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", - }, - "service/multi-service": { - namespace: "service.multiservice", - }, +export const BASE_AZURE_EMITTER_OPTIONS: Record< + string, + Record | Record[] +> = { + "azure/client-generator-core/access": { + namespace: "specs.azure.clientgenerator.core.access", + }, + "azure/client-generator-core/alternate-type": { + namespace: "specs.azure.clientgenerator.core.alternatetype", + }, + "azure/client-generator-core/api-version": { + namespace: "specs.azure.clientgenerator.core.apiversion", + }, + "azure/client-generator-core/client-initialization/default": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.default", + }, + "azure/client-generator-core/client-initialization/individually": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.individually", + }, + "azure/client-generator-core/client-initialization/individuallyParent": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.individuallyparent", + }, + "azure/client-generator-core/client-location": { + namespace: "specs.azure.clientgenerator.core.clientlocation", + }, + "azure/client-generator-core/deserialize-empty-string-as-null": { + namespace: "specs.azure.clientgenerator.core.emptystring", + }, + "azure/client-generator-core/flatten-property": { + namespace: "specs.azure.clientgenerator.core.flattenproperty", + }, + "azure/client-generator-core/usage": { + namespace: "specs.azure.clientgenerator.core.usage", + }, + "azure/client-generator-core/override": { + namespace: "specs.azure.clientgenerator.core.override", + }, + "azure/client-generator-core/hierarchy-building": { + namespace: "specs.azure.clientgenerator.core.hierarchybuilding", + }, + "azure/core/basic": { + namespace: "specs.azure.core.basic", + }, + "azure/core/lro/rpc": { + namespace: "specs.azure.core.lro.rpc", + }, + "azure/core/lro/standard": { + namespace: "specs.azure.core.lro.standard", + }, + "azure/core/model": { + namespace: "specs.azure.core.model", + }, + "azure/core/page": { + namespace: "specs.azure.core.page", + }, + "azure/core/scalar": { + namespace: "specs.azure.core.scalar", + }, + "azure/core/traits": { + namespace: "specs.azure.core.traits", + }, + "azure/encode/duration": { + namespace: "specs.azure.encode.duration", + }, + "azure/example/basic": { + namespace: "specs.azure.example.basic", + }, + "azure/payload/pageable": { + namespace: "specs.azure.payload.pageable", + }, + "azure/versioning/previewVersion": { + namespace: "specs.azure.versioning.previewversion", + }, + "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.main", + }, + "client/overload": { + namespace: "client.overload", + }, + "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", + }, + "service/multi-service": { + namespace: "service.multiservice", + }, }; -export const BASE_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/api-key": { - "clear-output-folder": "true", - }, - "authentication/http/custom": { - "package-name": "authentication-http-custom", - "namespace": "authentication.http.custom", - "package-pprint-name": "Authentication Http Custom", - }, - "authentication/union": [ - { - "package-name": "authentication-union", - "namespace": "authentication.union", - }, - { - "package-name": "setuppy-authentication-union", - "namespace": "setuppy.authentication.union", - "keep-setup-py": "true", - }, - ], - "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", - "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", - }, - "type/union/discriminated": { - "package-name": "typetest-discriminatedunion", - "namespace": "typetest.discriminatedunion", - }, - "type/file": { - "package-name": "typetest-file", - "namespace": "typetest.file", - }, - "documentation": { - "package-name": "specs-documentation", - "namespace": "specs.documentation", - }, +export const BASE_EMITTER_OPTIONS: Record< + string, + 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/api-key": { + "clear-output-folder": "true", + }, + "authentication/http/custom": { + "package-name": "authentication-http-custom", + namespace: "authentication.http.custom", + "package-pprint-name": "Authentication Http Custom", + }, + "authentication/union": [ + { + "package-name": "authentication-union", + namespace: "authentication.union", + }, + { + "package-name": "setuppy-authentication-union", + namespace: "setuppy.authentication.union", + "keep-setup-py": "true", + }, + ], + "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", + 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", + }, + "type/union/discriminated": { + "package-name": "typetest-discriminatedunion", + namespace: "typetest.discriminatedunion", + }, + "type/file": { + "package-name": "typetest-file", + namespace: "typetest.file", + }, + documentation: { + "package-name": "specs-documentation", + namespace: "specs.documentation", + }, }; // ---- Shared interfaces ---- export interface TspCommand { - outputDir: string; - command: string | string[]; + outputDir: string; + command: string | string[]; } export interface RegenerateFlagsInput { - flavor?: string; - debug?: boolean; - name?: string; - pyodide?: boolean; + flavor?: string; + debug?: boolean; + name?: string; + pyodide?: boolean; } export interface RegenerateFlags { - flavor: string; - debug: boolean; - name?: string; - pyodide?: boolean; + flavor: string; + debug: boolean; + name?: string; + pyodide?: boolean; } export interface ProcessedEmitterOption { - options: Record; - outputDir: string; + options: Record; + outputDir: string; } export interface RegenerateConfig { - azureHttpSpecs: string; - httpSpecs: string; - emitterOptions: Record | Record[]>; - azureEmitterOptions: Record | Record[]>; - preprocess: (flags: RegenerateFlagsInput) => Promise; - getCmdList: (spec: string, flags: RegenerateFlags) => TspCommand[]; - executeCommand: (cmd: TspCommand) => Promise; + azureHttpSpecs: string; + httpSpecs: string; + emitterOptions: Record | Record[]>; + azureEmitterOptions: Record | Record[]>; + preprocess: (flags: RegenerateFlagsInput) => Promise; + getCmdList: (spec: string, flags: RegenerateFlags) => TspCommand[]; + executeCommand: (cmd: TspCommand) => Promise; } // ---- Shared utility functions ---- export function toPosix(dir: string): string { - return dir.replace(/\\/g, "/"); + return dir.replace(/\\/g, "/"); } -export function getEmitterOption(spec: string, flavor: string, config: RegenerateConfig): Record[] { - const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; - const relativeSpec = toPosix(relative(specDir, spec)); - const key = relativeSpec.includes("resiliency/srv-driven/old.tsp") ? relativeSpec : dirname(relativeSpec); - const emitter_options = config.emitterOptions[key] || - (flavor === "azure" ? config.azureEmitterOptions[key] : [{}]) || [{}]; - return Array.isArray(emitter_options) ? emitter_options : [emitter_options]; +export function getEmitterOption( + spec: string, + flavor: string, + config: RegenerateConfig, +): Record[] { + const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; + const relativeSpec = toPosix(relative(specDir, spec)); + const key = relativeSpec.includes("resiliency/srv-driven/old.tsp") + ? relativeSpec + : dirname(relativeSpec); + const emitter_options = config.emitterOptions[key] || + (flavor === "azure" ? config.azureEmitterOptions[key] : [{}]) || [{}]; + return Array.isArray(emitter_options) ? emitter_options : [emitter_options]; } -export async function getSubdirectories(baseDir: string, flags: RegenerateFlags): Promise { - const subdirectories: string[] = []; - - async function searchDir(currentDir: string) { - const items = await promises.readdir(currentDir, { withFileTypes: true }); - - const promisesArray = items.map(async (item) => { - const subDirPath = join(currentDir, item.name); - if (item.isDirectory()) { - const mainTspPath = join(subDirPath, "main.tsp"); - const clientTspPath = join(subDirPath, "client.tsp"); - - const mainTspRelativePath = toPosix(relative(baseDir, mainTspPath)); - - if (SKIP_SPECS.some((skipSpec) => mainTspRelativePath.includes(skipSpec))) return; - - const hasMainTsp = await promises - .access(mainTspPath) - .then(() => true) - .catch(() => false); - const hasClientTsp = await promises - .access(clientTspPath) - .then(() => true) - .catch(() => false); - - if (mainTspRelativePath.toLowerCase().includes(flags.name || "")) { - if (mainTspRelativePath.includes("resiliency/srv-driven")) { - subdirectories.push(resolve(subDirPath, "old.tsp")); - } - if (hasClientTsp) { - subdirectories.push(resolve(subDirPath, "client.tsp")); - } else if (hasMainTsp) { - subdirectories.push(resolve(subDirPath, "main.tsp")); - } - } - - // Recursively search in the subdirectory - await searchDir(subDirPath); - } - }); - - await Promise.all(promisesArray); - } +export async function getSubdirectories( + baseDir: string, + flags: RegenerateFlags, +): Promise { + const subdirectories: string[] = []; + + async function searchDir(currentDir: string) { + const items = await promises.readdir(currentDir, { withFileTypes: true }); + + const promisesArray = items.map(async (item) => { + const subDirPath = join(currentDir, item.name); + if (item.isDirectory()) { + const mainTspPath = join(subDirPath, "main.tsp"); + const clientTspPath = join(subDirPath, "client.tsp"); + + const mainTspRelativePath = toPosix(relative(baseDir, mainTspPath)); + + if (SKIP_SPECS.some((skipSpec) => mainTspRelativePath.includes(skipSpec))) return; + + const hasMainTsp = await promises + .access(mainTspPath) + .then(() => true) + .catch(() => false); + const hasClientTsp = await promises + .access(clientTspPath) + .then(() => true) + .catch(() => false); + + if (mainTspRelativePath.toLowerCase().includes(flags.name || "")) { + if (mainTspRelativePath.includes("resiliency/srv-driven")) { + subdirectories.push(resolve(subDirPath, "old.tsp")); + } + if (hasClientTsp) { + subdirectories.push(resolve(subDirPath, "client.tsp")); + } else if (hasMainTsp) { + subdirectories.push(resolve(subDirPath, "main.tsp")); + } + } + + // Recursively search in the subdirectory + await searchDir(subDirPath); + } + }); + + await Promise.all(promisesArray); + } - await searchDir(baseDir); - return subdirectories; + await searchDir(baseDir); + return subdirectories; } export function defaultPackageName(spec: string, config: RegenerateConfig): string { - const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; - return toPosix(relative(specDir, dirname(spec))) - .replace(/\//g, "-") - .toLowerCase(); + const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; + return toPosix(relative(specDir, dirname(spec))) + .replace(/\//g, "-") + .toLowerCase(); } export function buildOptions( - spec: string, - generatedFolder: string, - flags: RegenerateFlags, - config: RegenerateConfig, + spec: string, + generatedFolder: string, + flags: RegenerateFlags, + config: RegenerateConfig, ): ProcessedEmitterOption[] { - const results: ProcessedEmitterOption[] = []; - for (const emitterConfig of getEmitterOption(spec, flags.flavor, config)) { - const options: Record = { ...emitterConfig }; - if (flags.pyodide) { - options["use-pyodide"] = "true"; - } - options["flavor"] = flags.flavor; - for (const [k, v] of Object.entries(SpecialFlags[flags.flavor] ?? {})) { - options[k] = v; - } - if (options["emitter-output-dir"] === undefined) { - const packageName = options["package-name"] || defaultPackageName(spec, config); - options["emitter-output-dir"] = toPosix(`${generatedFolder}/test/${flags.flavor}/generated/${packageName}`); - } - if (flags.debug) { - options["debug"] = "true"; - } - options["examples-dir"] = toPosix(join(dirname(spec), "examples")); - results.push({ - options, - outputDir: options["emitter-output-dir"], - }); + const results: ProcessedEmitterOption[] = []; + for (const emitterConfig of getEmitterOption(spec, flags.flavor, config)) { + const options: Record = { ...emitterConfig }; + if (flags.pyodide) { + options["use-pyodide"] = "true"; } - return results; -} - -export async function runTaskPool(tasks: Array<() => Promise>, poolLimit: number): Promise { - async function worker(start: number, end: number) { - while (start < end) { - await tasks[start](); - start++; - } + options["flavor"] = flags.flavor; + for (const [k, v] of Object.entries(SpecialFlags[flags.flavor] ?? {})) { + options[k] = v; } - - const workers = []; - let start = 0; - while (start < tasks.length) { - const end = Math.min(start + poolLimit, tasks.length); - workers.push((async () => await worker(start, end))()); - start = end; + if (options["emitter-output-dir"] === undefined) { + const packageName = options["package-name"] || defaultPackageName(spec, config); + options["emitter-output-dir"] = toPosix( + `${generatedFolder}/test/${flags.flavor}/generated/${packageName}`, + ); + } + if (flags.debug) { + options["debug"] = "true"; } - await Promise.all(workers); + options["examples-dir"] = toPosix(join(dirname(spec), "examples")); + results.push({ + options, + outputDir: options["emitter-output-dir"], + }); + } + return results; } -export async function regenerate(flags: RegenerateFlagsInput, config: RegenerateConfig): Promise { - if (flags.flavor === undefined) { - await regenerate({ flavor: "azure", ...flags }, config); - await regenerate({ flavor: "unbranded", ...flags }, config); - } else { - await config.preprocess(flags); - - const flagsResolved: RegenerateFlags = { debug: false, flavor: flags.flavor, ...flags }; - const subdirectoriesForAzure = await getSubdirectories(config.azureHttpSpecs, flagsResolved); - const subdirectoriesForNonAzure = await getSubdirectories(config.httpSpecs, flagsResolved); - const subdirectories = - flags.flavor === "azure" - ? [...subdirectoriesForAzure, ...subdirectoriesForNonAzure] - : subdirectoriesForNonAzure; - const cmdList: TspCommand[] = subdirectories.flatMap((subdirectory) => - config.getCmdList(subdirectory, flagsResolved), - ); - - // Create tasks as functions for the pool - const tasks: Array<() => Promise> = cmdList.map((tspCommand) => { - return () => config.executeCommand(tspCommand); - }); - - // Run tasks with a concurrency limit - await runTaskPool(tasks, 30); +export async function runTaskPool( + tasks: Array<() => Promise>, + poolLimit: number, +): Promise { + async function worker(start: number, end: number) { + while (start < end) { + await tasks[start](); + start++; } + } + + const workers = []; + let start = 0; + while (start < tasks.length) { + const end = Math.min(start + poolLimit, tasks.length); + workers.push((async () => await worker(start, end))()); + start = end; + } + await Promise.all(workers); +} + +export async function regenerate( + flags: RegenerateFlagsInput, + config: RegenerateConfig, +): Promise { + if (flags.flavor === undefined) { + await regenerate({ flavor: "azure", ...flags }, config); + await regenerate({ flavor: "unbranded", ...flags }, config); + } else { + await config.preprocess(flags); + + const flagsResolved: RegenerateFlags = { debug: false, flavor: flags.flavor, ...flags }; + const subdirectoriesForAzure = await getSubdirectories(config.azureHttpSpecs, flagsResolved); + const subdirectoriesForNonAzure = await getSubdirectories(config.httpSpecs, flagsResolved); + const subdirectories = + flags.flavor === "azure" + ? [...subdirectoriesForAzure, ...subdirectoriesForNonAzure] + : subdirectoriesForNonAzure; + const cmdList: TspCommand[] = subdirectories.flatMap((subdirectory) => + config.getCmdList(subdirectory, flagsResolved), + ); + + // Create tasks as functions for the pool + const tasks: Array<() => Promise> = cmdList.map((tspCommand) => { + return () => config.executeCommand(tspCommand); + }); + + // Run tasks with a concurrency limit + await runTaskPool(tasks, 30); + } } diff --git a/packages/typespec-python/src/lib.ts b/packages/typespec-python/src/lib.ts index 6e85d60424..8062bf9cc4 100644 --- a/packages/typespec-python/src/lib.ts +++ b/packages/typespec-python/src/lib.ts @@ -12,8 +12,10 @@ export interface PythonAzureEmitterOptions extends PythonEmitterOptions { "generate-test"?: boolean; } -export interface PythonSdkContext - extends SdkContext { +export interface PythonSdkContext extends SdkContext< + PythonAzureEmitterOptions, + TServiceOperation +> { __endpointPathParameters: Record[]; } diff --git a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py index 0cfccaee38..803c377925 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py +++ b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py @@ -7,12 +7,21 @@ import pytest from payload.xml.aio import XmlClient from payload.xml.models import ( + Author, + Book, SimpleModel, ModelWithSimpleArrays, ModelWithArrayOfModel, ModelWithAttributes, ModelWithUnwrappedArray, + ModelWithUnwrappedModelArray, ModelWithRenamedArrays, + ModelWithRenamedProperty, + ModelWithRenamedAttribute, + ModelWithRenamedNestedModel, + ModelWithRenamedWrappedModelArray, + ModelWithRenamedUnwrappedModelArray, + ModelWithRenamedWrappedAndItemModelArray, ModelWithOptionalField, ModelWithRenamedFields, ModelWithEmptyArray, @@ -21,6 +30,10 @@ ModelWithEncodedNames, ModelWithEnum, ModelWithDatetime, + ModelWithNamespace, + ModelWithNamespaceOnProperties, + ModelWithNestedModel, + ModelWithWrappedPrimitiveCustomItemNames, ) @@ -37,6 +50,13 @@ async def test_simple_model(client: XmlClient): await client.simple_model_value.put(model) +@pytest.mark.asyncio +async def test_model_with_renamed_property(client: XmlClient): + model = ModelWithRenamedProperty(title="foo", author="bar") + assert await client.model_with_renamed_property_value.get() == model + await client.model_with_renamed_property_value.put(model) + + @pytest.mark.asyncio async def test_model_with_simple_arrays(client: XmlClient): model = ModelWithSimpleArrays(colors=["red", "green", "blue"], counts=[1, 2]) @@ -44,6 +64,13 @@ async def test_model_with_simple_arrays(client: XmlClient): await client.model_with_simple_arrays_value.put(model) +@pytest.mark.asyncio +async def test_model_with_wrapped_primitive_custom_item_names(client: XmlClient): + model = ModelWithWrappedPrimitiveCustomItemNames(tags=["fiction", "classic"]) + assert await client.model_with_wrapped_primitive_custom_item_names_value.get() == model + await client.model_with_wrapped_primitive_custom_item_names_value.put(model) + + @pytest.mark.asyncio async def test_model_with_array_of_model(client: XmlClient): model = ModelWithArrayOfModel( @@ -56,6 +83,56 @@ async def test_model_with_array_of_model(client: XmlClient): await client.model_with_array_of_model_value.put(model) +@pytest.mark.asyncio +@pytest.mark.skip(reason="Generator bug: unwrapped model arrays use type name instead of itemsName for serialization") +async def test_model_with_unwrapped_model_array(client: XmlClient): + model = ModelWithUnwrappedModelArray( + items_property=[ + SimpleModel(name="foo", age=123), + SimpleModel(name="bar", age=456), + ] + ) + assert await client.model_with_unwrapped_model_array_value.get() == model + await client.model_with_unwrapped_model_array_value.put(model) + + +@pytest.mark.asyncio +async def test_model_with_renamed_wrapped_model_array(client: XmlClient): + model = ModelWithRenamedWrappedModelArray( + items_property=[ + SimpleModel(name="foo", age=123), + SimpleModel(name="bar", age=456), + ] + ) + assert await client.model_with_renamed_wrapped_model_array_value.get() == model + await client.model_with_renamed_wrapped_model_array_value.put(model) + + +@pytest.mark.asyncio +@pytest.mark.skip(reason="Generator bug: unwrapped model arrays use type name instead of itemsName for serialization") +async def test_model_with_renamed_unwrapped_model_array(client: XmlClient): + model = ModelWithRenamedUnwrappedModelArray( + items_property=[ + SimpleModel(name="foo", age=123), + SimpleModel(name="bar", age=456), + ] + ) + assert await client.model_with_renamed_unwrapped_model_array_value.get() == model + await client.model_with_renamed_unwrapped_model_array_value.put(model) + + +@pytest.mark.asyncio +async def test_model_with_renamed_wrapped_and_item_model_array(client: XmlClient): + model = ModelWithRenamedWrappedAndItemModelArray( + books=[ + Book(title="The Great Gatsby"), + Book(title="Les Miserables"), + ] + ) + assert await client.model_with_renamed_wrapped_and_item_model_array_value.get() == model + await client.model_with_renamed_wrapped_and_item_model_array_value.put(model) + + @pytest.mark.asyncio async def test_model_with_attributes(client: XmlClient): model = ModelWithAttributes(id1=123, id2="foo", enabled=True) @@ -63,6 +140,13 @@ async def test_model_with_attributes(client: XmlClient): await client.model_with_attributes_value.put(model) +@pytest.mark.asyncio +async def test_model_with_renamed_attribute(client: XmlClient): + model = ModelWithRenamedAttribute(id=123, title="The Great Gatsby", author="F. Scott Fitzgerald") + assert await client.model_with_renamed_attribute_value.get() == model + await client.model_with_renamed_attribute_value.put(model) + + @pytest.mark.asyncio async def test_model_with_unwrapped_array(client: XmlClient): model = ModelWithUnwrappedArray(colors=["red", "green", "blue"], counts=[1, 2]) @@ -84,6 +168,20 @@ async def test_model_with_optional_field(client: XmlClient): await client.model_with_optional_field_value.put(model) +@pytest.mark.asyncio +async def test_model_with_nested_model(client: XmlClient): + model = ModelWithNestedModel(nested=SimpleModel(name="foo", age=123)) + assert await client.model_with_nested_model_value.get() == model + await client.model_with_nested_model_value.put(model) + + +@pytest.mark.asyncio +async def test_model_with_renamed_nested_model(client: XmlClient): + model = ModelWithRenamedNestedModel(author=Author(name="foo")) + assert await client.model_with_renamed_nested_model_value.get() == model + await client.model_with_renamed_nested_model_value.put(model) + + @pytest.mark.asyncio async def test_model_with_renamed_fields(client: XmlClient): model = ModelWithRenamedFields( @@ -141,6 +239,22 @@ async def test_model_with_datetime(client: XmlClient): await client.model_with_datetime_value.put(model) +@pytest.mark.asyncio +@pytest.mark.skip(reason="Generator bug: XML namespace prefix not serialized in PUT request body") +async def test_model_with_namespace(client: XmlClient): + model = ModelWithNamespace(id=123, title="The Great Gatsby") + assert await client.model_with_namespace_value.get() == model + await client.model_with_namespace_value.put(model) + + +@pytest.mark.asyncio +@pytest.mark.skip(reason="Generator bug: namespace-qualified XML elements not correctly deserialized to model fields") +async def test_model_with_namespace_on_properties(client: XmlClient): + model = ModelWithNamespaceOnProperties(id=123, title="The Great Gatsby", author="F. Scott Fitzgerald") + assert await client.model_with_namespace_on_properties_value.get() == model + await client.model_with_namespace_on_properties_value.put(model) + + @pytest.mark.asyncio async def test_xml_error_value(client: XmlClient, core_library): with pytest.raises(core_library.exceptions.HttpResponseError) as ex: diff --git a/packages/typespec-python/test/generic_mock_api_tests/test_payload_xml.py b/packages/typespec-python/test/generic_mock_api_tests/test_payload_xml.py index 22f1c6f7c7..cb63cbf8b4 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/test_payload_xml.py +++ b/packages/typespec-python/test/generic_mock_api_tests/test_payload_xml.py @@ -7,12 +7,21 @@ import pytest from payload.xml import XmlClient from payload.xml.models import ( + Author, + Book, SimpleModel, ModelWithSimpleArrays, ModelWithArrayOfModel, ModelWithAttributes, ModelWithUnwrappedArray, + ModelWithUnwrappedModelArray, ModelWithRenamedArrays, + ModelWithRenamedProperty, + ModelWithRenamedAttribute, + ModelWithRenamedNestedModel, + ModelWithRenamedWrappedModelArray, + ModelWithRenamedUnwrappedModelArray, + ModelWithRenamedWrappedAndItemModelArray, ModelWithOptionalField, ModelWithRenamedFields, ModelWithEmptyArray, @@ -21,6 +30,10 @@ ModelWithEncodedNames, ModelWithEnum, ModelWithDatetime, + ModelWithNamespace, + ModelWithNamespaceOnProperties, + ModelWithNestedModel, + ModelWithWrappedPrimitiveCustomItemNames, ) @@ -36,12 +49,24 @@ def test_simple_model(client: XmlClient): client.simple_model_value.put(model) +def test_model_with_renamed_property(client: XmlClient): + model = ModelWithRenamedProperty(title="foo", author="bar") + assert client.model_with_renamed_property_value.get() == model + client.model_with_renamed_property_value.put(model) + + def test_model_with_simple_arrays(client: XmlClient): model = ModelWithSimpleArrays(colors=["red", "green", "blue"], counts=[1, 2]) assert client.model_with_simple_arrays_value.get() == model client.model_with_simple_arrays_value.put(model) +def test_model_with_wrapped_primitive_custom_item_names(client: XmlClient): + model = ModelWithWrappedPrimitiveCustomItemNames(tags=["fiction", "classic"]) + assert client.model_with_wrapped_primitive_custom_item_names_value.get() == model + client.model_with_wrapped_primitive_custom_item_names_value.put(model) + + def test_model_with_array_of_model(client: XmlClient): model = ModelWithArrayOfModel( items_property=[ @@ -53,12 +78,64 @@ def test_model_with_array_of_model(client: XmlClient): client.model_with_array_of_model_value.put(model) +@pytest.mark.skip(reason="Generator bug: unwrapped model arrays use type name instead of itemsName for serialization") +def test_model_with_unwrapped_model_array(client: XmlClient): + model = ModelWithUnwrappedModelArray( + items_property=[ + SimpleModel(name="foo", age=123), + SimpleModel(name="bar", age=456), + ] + ) + assert client.model_with_unwrapped_model_array_value.get() == model + client.model_with_unwrapped_model_array_value.put(model) + + +def test_model_with_renamed_wrapped_model_array(client: XmlClient): + model = ModelWithRenamedWrappedModelArray( + items_property=[ + SimpleModel(name="foo", age=123), + SimpleModel(name="bar", age=456), + ] + ) + assert client.model_with_renamed_wrapped_model_array_value.get() == model + client.model_with_renamed_wrapped_model_array_value.put(model) + + +@pytest.mark.skip(reason="Generator bug: unwrapped model arrays use type name instead of itemsName for serialization") +def test_model_with_renamed_unwrapped_model_array(client: XmlClient): + model = ModelWithRenamedUnwrappedModelArray( + items_property=[ + SimpleModel(name="foo", age=123), + SimpleModel(name="bar", age=456), + ] + ) + assert client.model_with_renamed_unwrapped_model_array_value.get() == model + client.model_with_renamed_unwrapped_model_array_value.put(model) + + +def test_model_with_renamed_wrapped_and_item_model_array(client: XmlClient): + model = ModelWithRenamedWrappedAndItemModelArray( + books=[ + Book(title="The Great Gatsby"), + Book(title="Les Miserables"), + ] + ) + assert client.model_with_renamed_wrapped_and_item_model_array_value.get() == model + client.model_with_renamed_wrapped_and_item_model_array_value.put(model) + + def test_model_with_attributes(client: XmlClient): model = ModelWithAttributes(id1=123, id2="foo", enabled=True) assert client.model_with_attributes_value.get() == model client.model_with_attributes_value.put(model) +def test_model_with_renamed_attribute(client: XmlClient): + model = ModelWithRenamedAttribute(id=123, title="The Great Gatsby", author="F. Scott Fitzgerald") + assert client.model_with_renamed_attribute_value.get() == model + client.model_with_renamed_attribute_value.put(model) + + def test_model_with_unwrapped_array(client: XmlClient): model = ModelWithUnwrappedArray(colors=["red", "green", "blue"], counts=[1, 2]) assert client.model_with_unwrapped_array_value.get() == model @@ -77,6 +154,18 @@ def test_model_with_optional_field(client: XmlClient): client.model_with_optional_field_value.put(model) +def test_model_with_nested_model(client: XmlClient): + model = ModelWithNestedModel(nested=SimpleModel(name="foo", age=123)) + assert client.model_with_nested_model_value.get() == model + client.model_with_nested_model_value.put(model) + + +def test_model_with_renamed_nested_model(client: XmlClient): + model = ModelWithRenamedNestedModel(author=Author(name="foo")) + assert client.model_with_renamed_nested_model_value.get() == model + client.model_with_renamed_nested_model_value.put(model) + + def test_model_with_renamed_fields(client: XmlClient): model = ModelWithRenamedFields( input_data=SimpleModel(name="foo", age=123), @@ -127,6 +216,20 @@ def test_model_with_datetime(client: XmlClient): client.model_with_datetime_value.put(model) +@pytest.mark.skip(reason="Generator bug: XML namespace prefix not serialized in PUT request body") +def test_model_with_namespace(client: XmlClient): + model = ModelWithNamespace(id=123, title="The Great Gatsby") + assert client.model_with_namespace_value.get() == model + client.model_with_namespace_value.put(model) + + +@pytest.mark.skip(reason="Generator bug: namespace-qualified XML elements not correctly deserialized to model fields") +def test_model_with_namespace_on_properties(client: XmlClient): + model = ModelWithNamespaceOnProperties(id=123, title="The Great Gatsby", author="F. Scott Fitzgerald") + assert client.model_with_namespace_on_properties_value.get() == model + client.model_with_namespace_on_properties_value.put(model) + + def test_xml_error_value(client: XmlClient, core_library): with pytest.raises(core_library.exceptions.HttpResponseError) as ex: client.xml_error_value.get() From 23d3497270801cc14baa4ba78fbc9ec181d6c0ee Mon Sep 17 00:00:00 2001 From: AutoPrFromHttpClientPython Date: Fri, 20 Mar 2026 01:09:12 +0000 Subject: [PATCH 3/5] Add changelog --- .../fix_pkg_manager_detection-2026-2-19-14-33-30.md | 8 ++++++++ .../jolov-publish-always-internal-2026-2-19-10-50-1.md | 8 ++++++++ .../changes/python-xml-test-cases-2026-3-19-22-47-48.md | 8 ++++++++ 3 files changed, 24 insertions(+) create mode 100644 .chronus/changes/fix_pkg_manager_detection-2026-2-19-14-33-30.md create mode 100644 .chronus/changes/jolov-publish-always-internal-2026-2-19-10-50-1.md create mode 100644 .chronus/changes/python-xml-test-cases-2026-3-19-22-47-48.md diff --git a/.chronus/changes/fix_pkg_manager_detection-2026-2-19-14-33-30.md b/.chronus/changes/fix_pkg_manager_detection-2026-2-19-14-33-30.md new file mode 100644 index 0000000000..3d5377e5cc --- /dev/null +++ b/.chronus/changes/fix_pkg_manager_detection-2026-2-19-14-33-30.md @@ -0,0 +1,8 @@ +--- +changeKind: fix +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Fix PermissionError when detecting package manager on WSL \ No newline at end of file diff --git a/.chronus/changes/jolov-publish-always-internal-2026-2-19-10-50-1.md b/.chronus/changes/jolov-publish-always-internal-2026-2-19-10-50-1.md new file mode 100644 index 0000000000..4bd58b37e4 --- /dev/null +++ b/.chronus/changes/jolov-publish-always-internal-2026-2-19-10-50-1.md @@ -0,0 +1,8 @@ +--- +changeKind: internal +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Update internal npm feed from azure-sdk-for-js-test-autorest to azure-sdk-for-js \ No newline at end of file diff --git a/.chronus/changes/python-xml-test-cases-2026-3-19-22-47-48.md b/.chronus/changes/python-xml-test-cases-2026-3-19-22-47-48.md new file mode 100644 index 0000000000..0634f52f78 --- /dev/null +++ b/.chronus/changes/python-xml-test-cases-2026-3-19-22-47-48.md @@ -0,0 +1,8 @@ +--- +changeKind: internal +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Add mock API test cases for XML scenarios introduced in https://github.com/microsoft/typespec/pull/10063, covering: renamed property, nested model, renamed nested model, wrapped primitive with custom item names, model array variants (wrapped/unwrapped/renamed), renamed attribute, namespace, and namespace-on-properties. Tests for unwrapped model array serialization and namespace handling are skipped pending generator bug fixes. From c629d7774f3925cb2b4c4ba9c68f41dcb4a70512 Mon Sep 17 00:00:00 2001 From: AutoPrFromHttpClientPython Date: Fri, 20 Mar 2026 01:10:13 +0000 Subject: [PATCH 4/5] Update dependencies (2026-03-20 01:10:13) --- .../scripts/eng/regenerate-common.ts | 811 +++++++++--------- packages/typespec-python/src/lib.ts | 6 +- pnpm-lock.yaml | 24 +- 3 files changed, 408 insertions(+), 433 deletions(-) diff --git a/packages/typespec-python/scripts/eng/regenerate-common.ts b/packages/typespec-python/scripts/eng/regenerate-common.ts index 9f9a91266d..9880418935 100644 --- a/packages/typespec-python/scripts/eng/regenerate-common.ts +++ b/packages/typespec-python/scripts/eng/regenerate-common.ts @@ -6,467 +6,444 @@ import { dirname, join, relative, resolve } from "path"; export const SKIP_SPECS: string[] = ["type/file"]; export const SpecialFlags: Record> = { - azure: { - "generate-test": true, - "generate-sample": true, - }, + azure: { + "generate-test": true, + "generate-sample": true, + }, }; // ---- Base emitter options (shared across repos) ---- -export const BASE_AZURE_EMITTER_OPTIONS: Record< - string, - Record | Record[] -> = { - "azure/client-generator-core/access": { - namespace: "specs.azure.clientgenerator.core.access", - }, - "azure/client-generator-core/alternate-type": { - namespace: "specs.azure.clientgenerator.core.alternatetype", - }, - "azure/client-generator-core/api-version": { - namespace: "specs.azure.clientgenerator.core.apiversion", - }, - "azure/client-generator-core/client-initialization/default": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.default", - }, - "azure/client-generator-core/client-initialization/individually": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.individually", - }, - "azure/client-generator-core/client-initialization/individuallyParent": { - namespace: "specs.azure.clientgenerator.core.clientinitialization.individuallyparent", - }, - "azure/client-generator-core/client-location": { - namespace: "specs.azure.clientgenerator.core.clientlocation", - }, - "azure/client-generator-core/deserialize-empty-string-as-null": { - namespace: "specs.azure.clientgenerator.core.emptystring", - }, - "azure/client-generator-core/flatten-property": { - namespace: "specs.azure.clientgenerator.core.flattenproperty", - }, - "azure/client-generator-core/usage": { - namespace: "specs.azure.clientgenerator.core.usage", - }, - "azure/client-generator-core/override": { - namespace: "specs.azure.clientgenerator.core.override", - }, - "azure/client-generator-core/hierarchy-building": { - namespace: "specs.azure.clientgenerator.core.hierarchybuilding", - }, - "azure/core/basic": { - namespace: "specs.azure.core.basic", - }, - "azure/core/lro/rpc": { - namespace: "specs.azure.core.lro.rpc", - }, - "azure/core/lro/standard": { - namespace: "specs.azure.core.lro.standard", - }, - "azure/core/model": { - namespace: "specs.azure.core.model", - }, - "azure/core/page": { - namespace: "specs.azure.core.page", - }, - "azure/core/scalar": { - namespace: "specs.azure.core.scalar", - }, - "azure/core/traits": { - namespace: "specs.azure.core.traits", - }, - "azure/encode/duration": { - namespace: "specs.azure.encode.duration", - }, - "azure/example/basic": { - namespace: "specs.azure.example.basic", - }, - "azure/payload/pageable": { - namespace: "specs.azure.payload.pageable", - }, - "azure/versioning/previewVersion": { - namespace: "specs.azure.versioning.previewversion", - }, - "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.main", - }, - "client/overload": { - namespace: "client.overload", - }, - "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", - }, - "service/multi-service": { - namespace: "service.multiservice", - }, +export const BASE_AZURE_EMITTER_OPTIONS: Record | Record[]> = { + "azure/client-generator-core/access": { + namespace: "specs.azure.clientgenerator.core.access", + }, + "azure/client-generator-core/alternate-type": { + namespace: "specs.azure.clientgenerator.core.alternatetype", + }, + "azure/client-generator-core/api-version": { + namespace: "specs.azure.clientgenerator.core.apiversion", + }, + "azure/client-generator-core/client-initialization/default": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.default", + }, + "azure/client-generator-core/client-initialization/individually": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.individually", + }, + "azure/client-generator-core/client-initialization/individuallyParent": { + namespace: "specs.azure.clientgenerator.core.clientinitialization.individuallyparent", + }, + "azure/client-generator-core/client-location": { + namespace: "specs.azure.clientgenerator.core.clientlocation", + }, + "azure/client-generator-core/deserialize-empty-string-as-null": { + namespace: "specs.azure.clientgenerator.core.emptystring", + }, + "azure/client-generator-core/flatten-property": { + namespace: "specs.azure.clientgenerator.core.flattenproperty", + }, + "azure/client-generator-core/usage": { + namespace: "specs.azure.clientgenerator.core.usage", + }, + "azure/client-generator-core/override": { + namespace: "specs.azure.clientgenerator.core.override", + }, + "azure/client-generator-core/hierarchy-building": { + namespace: "specs.azure.clientgenerator.core.hierarchybuilding", + }, + "azure/core/basic": { + namespace: "specs.azure.core.basic", + }, + "azure/core/lro/rpc": { + namespace: "specs.azure.core.lro.rpc", + }, + "azure/core/lro/standard": { + namespace: "specs.azure.core.lro.standard", + }, + "azure/core/model": { + namespace: "specs.azure.core.model", + }, + "azure/core/page": { + namespace: "specs.azure.core.page", + }, + "azure/core/scalar": { + namespace: "specs.azure.core.scalar", + }, + "azure/core/traits": { + namespace: "specs.azure.core.traits", + }, + "azure/encode/duration": { + namespace: "specs.azure.encode.duration", + }, + "azure/example/basic": { + namespace: "specs.azure.example.basic", + }, + "azure/payload/pageable": { + namespace: "specs.azure.payload.pageable", + }, + "azure/versioning/previewVersion": { + namespace: "specs.azure.versioning.previewversion", + }, + "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.main", + }, + "client/overload": { + namespace: "client.overload", + }, + "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", + }, + "service/multi-service": { + namespace: "service.multiservice", + }, }; -export const BASE_EMITTER_OPTIONS: Record< - string, - 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/api-key": { - "clear-output-folder": "true", - }, - "authentication/http/custom": { - "package-name": "authentication-http-custom", - namespace: "authentication.http.custom", - "package-pprint-name": "Authentication Http Custom", - }, - "authentication/union": [ - { - "package-name": "authentication-union", - namespace: "authentication.union", - }, - { - "package-name": "setuppy-authentication-union", - namespace: "setuppy.authentication.union", - "keep-setup-py": "true", - }, - ], - "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", - 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", - }, - "type/union/discriminated": { - "package-name": "typetest-discriminatedunion", - namespace: "typetest.discriminatedunion", - }, - "type/file": { - "package-name": "typetest-file", - namespace: "typetest.file", - }, - documentation: { - "package-name": "specs-documentation", - namespace: "specs.documentation", - }, +export const BASE_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/api-key": { + "clear-output-folder": "true", + }, + "authentication/http/custom": { + "package-name": "authentication-http-custom", + "namespace": "authentication.http.custom", + "package-pprint-name": "Authentication Http Custom", + }, + "authentication/union": [ + { + "package-name": "authentication-union", + "namespace": "authentication.union", + }, + { + "package-name": "setuppy-authentication-union", + "namespace": "setuppy.authentication.union", + "keep-setup-py": "true", + }, + ], + "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", + "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", + }, + "type/union/discriminated": { + "package-name": "typetest-discriminatedunion", + "namespace": "typetest.discriminatedunion", + }, + "type/file": { + "package-name": "typetest-file", + "namespace": "typetest.file", + }, + "documentation": { + "package-name": "specs-documentation", + "namespace": "specs.documentation", + }, }; // ---- Shared interfaces ---- export interface TspCommand { - outputDir: string; - command: string | string[]; + outputDir: string; + command: string | string[]; } export interface RegenerateFlagsInput { - flavor?: string; - debug?: boolean; - name?: string; - pyodide?: boolean; + flavor?: string; + debug?: boolean; + name?: string; + pyodide?: boolean; } export interface RegenerateFlags { - flavor: string; - debug: boolean; - name?: string; - pyodide?: boolean; + flavor: string; + debug: boolean; + name?: string; + pyodide?: boolean; } export interface ProcessedEmitterOption { - options: Record; - outputDir: string; + options: Record; + outputDir: string; } export interface RegenerateConfig { - azureHttpSpecs: string; - httpSpecs: string; - emitterOptions: Record | Record[]>; - azureEmitterOptions: Record | Record[]>; - preprocess: (flags: RegenerateFlagsInput) => Promise; - getCmdList: (spec: string, flags: RegenerateFlags) => TspCommand[]; - executeCommand: (cmd: TspCommand) => Promise; + azureHttpSpecs: string; + httpSpecs: string; + emitterOptions: Record | Record[]>; + azureEmitterOptions: Record | Record[]>; + preprocess: (flags: RegenerateFlagsInput) => Promise; + getCmdList: (spec: string, flags: RegenerateFlags) => TspCommand[]; + executeCommand: (cmd: TspCommand) => Promise; } // ---- Shared utility functions ---- export function toPosix(dir: string): string { - return dir.replace(/\\/g, "/"); + return dir.replace(/\\/g, "/"); } -export function getEmitterOption( - spec: string, - flavor: string, - config: RegenerateConfig, -): Record[] { - const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; - const relativeSpec = toPosix(relative(specDir, spec)); - const key = relativeSpec.includes("resiliency/srv-driven/old.tsp") - ? relativeSpec - : dirname(relativeSpec); - const emitter_options = config.emitterOptions[key] || - (flavor === "azure" ? config.azureEmitterOptions[key] : [{}]) || [{}]; - return Array.isArray(emitter_options) ? emitter_options : [emitter_options]; +export function getEmitterOption(spec: string, flavor: string, config: RegenerateConfig): Record[] { + const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; + const relativeSpec = toPosix(relative(specDir, spec)); + const key = relativeSpec.includes("resiliency/srv-driven/old.tsp") ? relativeSpec : dirname(relativeSpec); + const emitter_options = config.emitterOptions[key] || + (flavor === "azure" ? config.azureEmitterOptions[key] : [{}]) || [{}]; + return Array.isArray(emitter_options) ? emitter_options : [emitter_options]; } -export async function getSubdirectories( - baseDir: string, - flags: RegenerateFlags, -): Promise { - const subdirectories: string[] = []; - - async function searchDir(currentDir: string) { - const items = await promises.readdir(currentDir, { withFileTypes: true }); - - const promisesArray = items.map(async (item) => { - const subDirPath = join(currentDir, item.name); - if (item.isDirectory()) { - const mainTspPath = join(subDirPath, "main.tsp"); - const clientTspPath = join(subDirPath, "client.tsp"); - - const mainTspRelativePath = toPosix(relative(baseDir, mainTspPath)); - - if (SKIP_SPECS.some((skipSpec) => mainTspRelativePath.includes(skipSpec))) return; - - const hasMainTsp = await promises - .access(mainTspPath) - .then(() => true) - .catch(() => false); - const hasClientTsp = await promises - .access(clientTspPath) - .then(() => true) - .catch(() => false); - - if (mainTspRelativePath.toLowerCase().includes(flags.name || "")) { - if (mainTspRelativePath.includes("resiliency/srv-driven")) { - subdirectories.push(resolve(subDirPath, "old.tsp")); - } - if (hasClientTsp) { - subdirectories.push(resolve(subDirPath, "client.tsp")); - } else if (hasMainTsp) { - subdirectories.push(resolve(subDirPath, "main.tsp")); - } - } - - // Recursively search in the subdirectory - await searchDir(subDirPath); - } - }); - - await Promise.all(promisesArray); - } +export async function getSubdirectories(baseDir: string, flags: RegenerateFlags): Promise { + const subdirectories: string[] = []; + + async function searchDir(currentDir: string) { + const items = await promises.readdir(currentDir, { withFileTypes: true }); + + const promisesArray = items.map(async (item) => { + const subDirPath = join(currentDir, item.name); + if (item.isDirectory()) { + const mainTspPath = join(subDirPath, "main.tsp"); + const clientTspPath = join(subDirPath, "client.tsp"); + + const mainTspRelativePath = toPosix(relative(baseDir, mainTspPath)); + + if (SKIP_SPECS.some((skipSpec) => mainTspRelativePath.includes(skipSpec))) return; + + const hasMainTsp = await promises + .access(mainTspPath) + .then(() => true) + .catch(() => false); + const hasClientTsp = await promises + .access(clientTspPath) + .then(() => true) + .catch(() => false); + + if (mainTspRelativePath.toLowerCase().includes(flags.name || "")) { + if (mainTspRelativePath.includes("resiliency/srv-driven")) { + subdirectories.push(resolve(subDirPath, "old.tsp")); + } + if (hasClientTsp) { + subdirectories.push(resolve(subDirPath, "client.tsp")); + } else if (hasMainTsp) { + subdirectories.push(resolve(subDirPath, "main.tsp")); + } + } + + // Recursively search in the subdirectory + await searchDir(subDirPath); + } + }); + + await Promise.all(promisesArray); + } - await searchDir(baseDir); - return subdirectories; + await searchDir(baseDir); + return subdirectories; } export function defaultPackageName(spec: string, config: RegenerateConfig): string { - const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; - return toPosix(relative(specDir, dirname(spec))) - .replace(/\//g, "-") - .toLowerCase(); + const specDir = spec.includes("azure") ? config.azureHttpSpecs : config.httpSpecs; + return toPosix(relative(specDir, dirname(spec))) + .replace(/\//g, "-") + .toLowerCase(); } export function buildOptions( - spec: string, - generatedFolder: string, - flags: RegenerateFlags, - config: RegenerateConfig, + spec: string, + generatedFolder: string, + flags: RegenerateFlags, + config: RegenerateConfig, ): ProcessedEmitterOption[] { - const results: ProcessedEmitterOption[] = []; - for (const emitterConfig of getEmitterOption(spec, flags.flavor, config)) { - const options: Record = { ...emitterConfig }; - if (flags.pyodide) { - options["use-pyodide"] = "true"; - } - options["flavor"] = flags.flavor; - for (const [k, v] of Object.entries(SpecialFlags[flags.flavor] ?? {})) { - options[k] = v; - } - if (options["emitter-output-dir"] === undefined) { - const packageName = options["package-name"] || defaultPackageName(spec, config); - options["emitter-output-dir"] = toPosix( - `${generatedFolder}/test/${flags.flavor}/generated/${packageName}`, - ); - } - if (flags.debug) { - options["debug"] = "true"; + const results: ProcessedEmitterOption[] = []; + for (const emitterConfig of getEmitterOption(spec, flags.flavor, config)) { + const options: Record = { ...emitterConfig }; + if (flags.pyodide) { + options["use-pyodide"] = "true"; + } + options["flavor"] = flags.flavor; + for (const [k, v] of Object.entries(SpecialFlags[flags.flavor] ?? {})) { + options[k] = v; + } + if (options["emitter-output-dir"] === undefined) { + const packageName = options["package-name"] || defaultPackageName(spec, config); + options["emitter-output-dir"] = toPosix(`${generatedFolder}/test/${flags.flavor}/generated/${packageName}`); + } + if (flags.debug) { + options["debug"] = "true"; + } + options["examples-dir"] = toPosix(join(dirname(spec), "examples")); + results.push({ + options, + outputDir: options["emitter-output-dir"], + }); } - options["examples-dir"] = toPosix(join(dirname(spec), "examples")); - results.push({ - options, - outputDir: options["emitter-output-dir"], - }); - } - return results; + return results; } -export async function runTaskPool( - tasks: Array<() => Promise>, - poolLimit: number, -): Promise { - async function worker(start: number, end: number) { - while (start < end) { - await tasks[start](); - start++; +export async function runTaskPool(tasks: Array<() => Promise>, poolLimit: number): Promise { + async function worker(start: number, end: number) { + while (start < end) { + await tasks[start](); + start++; + } + } + + const workers = []; + let start = 0; + while (start < tasks.length) { + const end = Math.min(start + poolLimit, tasks.length); + workers.push((async () => await worker(start, end))()); + start = end; } - } - - const workers = []; - let start = 0; - while (start < tasks.length) { - const end = Math.min(start + poolLimit, tasks.length); - workers.push((async () => await worker(start, end))()); - start = end; - } - await Promise.all(workers); + await Promise.all(workers); } -export async function regenerate( - flags: RegenerateFlagsInput, - config: RegenerateConfig, -): Promise { - if (flags.flavor === undefined) { - await regenerate({ flavor: "azure", ...flags }, config); - await regenerate({ flavor: "unbranded", ...flags }, config); - } else { - await config.preprocess(flags); - - const flagsResolved: RegenerateFlags = { debug: false, flavor: flags.flavor, ...flags }; - const subdirectoriesForAzure = await getSubdirectories(config.azureHttpSpecs, flagsResolved); - const subdirectoriesForNonAzure = await getSubdirectories(config.httpSpecs, flagsResolved); - const subdirectories = - flags.flavor === "azure" - ? [...subdirectoriesForAzure, ...subdirectoriesForNonAzure] - : subdirectoriesForNonAzure; - const cmdList: TspCommand[] = subdirectories.flatMap((subdirectory) => - config.getCmdList(subdirectory, flagsResolved), - ); - - // Create tasks as functions for the pool - const tasks: Array<() => Promise> = cmdList.map((tspCommand) => { - return () => config.executeCommand(tspCommand); - }); - - // Run tasks with a concurrency limit - await runTaskPool(tasks, 30); - } +export async function regenerate(flags: RegenerateFlagsInput, config: RegenerateConfig): Promise { + if (flags.flavor === undefined) { + await regenerate({ flavor: "azure", ...flags }, config); + await regenerate({ flavor: "unbranded", ...flags }, config); + } else { + await config.preprocess(flags); + + const flagsResolved: RegenerateFlags = { debug: false, flavor: flags.flavor, ...flags }; + const subdirectoriesForAzure = await getSubdirectories(config.azureHttpSpecs, flagsResolved); + const subdirectoriesForNonAzure = await getSubdirectories(config.httpSpecs, flagsResolved); + const subdirectories = + flags.flavor === "azure" + ? [...subdirectoriesForAzure, ...subdirectoriesForNonAzure] + : subdirectoriesForNonAzure; + const cmdList: TspCommand[] = subdirectories.flatMap((subdirectory) => + config.getCmdList(subdirectory, flagsResolved), + ); + + // Create tasks as functions for the pool + const tasks: Array<() => Promise> = cmdList.map((tspCommand) => { + return () => config.executeCommand(tspCommand); + }); + + // Run tasks with a concurrency limit + await runTaskPool(tasks, 30); + } } diff --git a/packages/typespec-python/src/lib.ts b/packages/typespec-python/src/lib.ts index 8062bf9cc4..6e85d60424 100644 --- a/packages/typespec-python/src/lib.ts +++ b/packages/typespec-python/src/lib.ts @@ -12,10 +12,8 @@ export interface PythonAzureEmitterOptions extends PythonEmitterOptions { "generate-test"?: boolean; } -export interface PythonSdkContext extends SdkContext< - PythonAzureEmitterOptions, - TServiceOperation -> { +export interface PythonSdkContext + extends SdkContext { __endpointPathParameters: Record[]; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 709c1d0be1..23e7f56025 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -60,8 +60,8 @@ importers: specifier: ~1.0.2 version: 1.0.2 '@typespec/http-client-python': - specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzMjIxMi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz - version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzMjIxMi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz(pisc6uv4zd7xvwrcrvtbcnjl6i) + specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzODE4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz + version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzODE4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz(pisc6uv4zd7xvwrcrvtbcnjl6i) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -82,8 +82,8 @@ importers: packages/typespec-python: dependencies: '@typespec/http-client-python': - specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzMjIxMi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz - version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzMjIxMi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz(pisc6uv4zd7xvwrcrvtbcnjl6i) + specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzODE4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz + version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzODE4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz(pisc6uv4zd7xvwrcrvtbcnjl6i) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -140,8 +140,8 @@ importers: specifier: ^1.10.0 version: 1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))) '@typespec/http-specs': - specifier: 0.1.0-alpha.35-dev.4 - version: 0.1.0-alpha.35-dev.4(@types/node@25.0.10)(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/http@1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))))(@typespec/rest@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/http@1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))(@typespec/versioning@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))(@typespec/xml@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))) + specifier: 0.1.0-alpha.35-dev.5 + version: 0.1.0-alpha.35-dev.5(@types/node@25.0.10)(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/http@1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))))(@typespec/rest@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/http@1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))(@typespec/versioning@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))(@typespec/xml@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))) '@typespec/openapi': specifier: ^1.10.0 version: 1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/http@1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))) @@ -1721,8 +1721,8 @@ packages: peerDependencies: '@typespec/compiler': ^1.10.0 - '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzMjIxMi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz': - resolution: {tarball: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzMjIxMi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz} + '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzODE4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz': + resolution: {tarball: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzODE4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz} version: 0.28.0 engines: {node: '>=20.0.0'} peerDependencies: @@ -1741,8 +1741,8 @@ packages: '@typespec/versioning': '>=0.80.0 <1.0.0' '@typespec/xml': '>=0.80.0 <1.0.0' - '@typespec/http-specs@0.1.0-alpha.35-dev.4': - resolution: {integrity: sha512-KI8b/wJDdWhNM8ypJEeOgl0Fj9xTxKqSQfmOUqgcQYqlaNeU+jpvqS/xD3wEOguh6YMrCUD9FG9h6mgp8409KA==} + '@typespec/http-specs@0.1.0-alpha.35-dev.5': + resolution: {integrity: sha512-RYp2KkmlmLZYlTtLfSNXw9P4YySpWBDmbCd1j4RCNbIN3Ww7aSpsZSFgcv7br+6jW8n7h0IJhWnh6vWaPuPrvw==} engines: {node: '>=16.0.0'} peerDependencies: '@typespec/compiler': ^1.10.0 || >= 1.11.0-dev.4 @@ -6699,7 +6699,7 @@ snapshots: dependencies: '@typespec/compiler': 1.10.0(@types/node@25.0.10) - '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzMjIxMi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz(pisc6uv4zd7xvwrcrvtbcnjl6i)': + '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjAzODE4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz(pisc6uv4zd7xvwrcrvtbcnjl6i)': dependencies: '@azure-tools/typespec-autorest': 0.66.0(7lmnrtcw3mexeptv5wn3xrpwpi) '@azure-tools/typespec-azure-core': 0.66.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/http@1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))))(@typespec/rest@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/http@1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))))) @@ -6724,7 +6724,7 @@ snapshots: - bufferutil - utf-8-validate - '@typespec/http-specs@0.1.0-alpha.35-dev.4(@types/node@25.0.10)(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/http@1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))))(@typespec/rest@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/http@1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))(@typespec/versioning@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))(@typespec/xml@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))': + '@typespec/http-specs@0.1.0-alpha.35-dev.5(@types/node@25.0.10)(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/http@1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))))(@typespec/rest@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/http@1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))(@typespec/versioning@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))(@typespec/xml@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10)))': dependencies: '@typespec/compiler': 1.10.0(@types/node@25.0.10) '@typespec/http': 1.10.0(@typespec/compiler@1.10.0(@types/node@25.0.10))(@typespec/streams@0.80.0(@typespec/compiler@1.10.0(@types/node@25.0.10))) From e0902c5ec37caa0da16a77be639e573b9221b5c6 Mon Sep 17 00:00:00 2001 From: AutoPrFromHttpClientPython Date: Fri, 20 Mar 2026 01:15:35 +0000 Subject: [PATCH 5/5] Regenerate for typespec-python (2026-03-20 01:15:35) --- .../payload-xml/apiview-properties.json | 97 +- ...amespace_on_properties_value_operations.py | 34 + ...ce_on_properties_value_operations_async.py | 35 + ...l_model_with_namespace_value_operations.py | 34 + ...l_with_namespace_value_operations_async.py | 35 + ...odel_with_nested_model_value_operations.py | 34 + ...ith_nested_model_value_operations_async.py | 35 + ...with_renamed_attribute_value_operations.py | 34 + ...enamed_attribute_value_operations_async.py | 35 + ...h_renamed_nested_model_value_operations.py | 34 + ...med_nested_model_value_operations_async.py | 35 + ..._with_renamed_property_value_operations.py | 34 + ...renamed_property_value_operations_async.py | 35 + ..._unwrapped_model_array_value_operations.py | 34 + ...pped_model_array_value_operations_async.py | 35 + ...d_and_item_model_array_value_operations.py | 34 + ...item_model_array_value_operations_async.py | 35 + ...ed_wrapped_model_array_value_operations.py | 34 + ...pped_model_array_value_operations_async.py | 35 + ..._unwrapped_model_array_value_operations.py | 34 + ...pped_model_array_value_operations_async.py | 35 + ...tive_custom_item_names_value_operations.py | 34 + ...ustom_item_names_value_operations_async.py | 35 + .../payload-xml/payload/xml/_client.py | 125 +- .../payload-xml/payload/xml/aio/_client.py | 128 +- .../payload/xml/aio/operations/__init__.py | 42 +- .../payload/xml/aio/operations/_operations.py | 1604 ++++++++++++- .../payload/xml/models/__init__.py | 26 + .../payload-xml/payload/xml/models/_models.py | 530 +++- .../payload/xml/operations/__init__.py | 42 +- .../payload/xml/operations/_operations.py | 2129 +++++++++++++++-- .../payload-xml/payload/xml/_client.py | 125 +- .../payload-xml/payload/xml/aio/_client.py | 128 +- .../payload/xml/aio/operations/__init__.py | 42 +- .../payload/xml/aio/operations/_operations.py | 1538 +++++++++++- .../payload/xml/models/__init__.py | 26 + .../payload-xml/payload/xml/models/_models.py | 530 +++- .../payload/xml/operations/__init__.py | 42 +- .../payload/xml/operations/_operations.py | 2067 ++++++++++++++-- 39 files changed, 9314 insertions(+), 666 deletions(-) create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_on_properties_value_operations.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_on_properties_value_operations_async.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_value_operations.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_value_operations_async.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_nested_model_value_operations.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_nested_model_value_operations_async.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_attribute_value_operations.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_attribute_value_operations_async.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_nested_model_value_operations.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_nested_model_value_operations_async.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_property_value_operations.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_property_value_operations_async.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_unwrapped_model_array_value_operations.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_unwrapped_model_array_value_operations_async.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_and_item_model_array_value_operations.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_and_item_model_array_value_operations_async.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_model_array_value_operations.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_model_array_value_operations_async.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_unwrapped_model_array_value_operations.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_unwrapped_model_array_value_operations_async.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_wrapped_primitive_custom_item_names_value_operations.py create mode 100644 packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_wrapped_primitive_custom_item_names_value_operations_async.py diff --git a/packages/typespec-python/test/azure/generated/payload-xml/apiview-properties.json b/packages/typespec-python/test/azure/generated/payload-xml/apiview-properties.json index 36b83986c6..af4e4592a3 100644 --- a/packages/typespec-python/test/azure/generated/payload-xml/apiview-properties.json +++ b/packages/typespec-python/test/azure/generated/payload-xml/apiview-properties.json @@ -1,6 +1,8 @@ { "CrossLanguagePackageId": "Payload.Xml", "CrossLanguageDefinitionId": { + "payload.xml.models.Author": "Payload.Xml.Author", + "payload.xml.models.Book": "Payload.Xml.Book", "payload.xml.models.ModelWithArrayOfModel": "Payload.Xml.ModelWithArrayOfModel", "payload.xml.models.ModelWithAttributes": "Payload.Xml.ModelWithAttributes", "payload.xml.models.ModelWithDatetime": "Payload.Xml.ModelWithDatetime", @@ -8,12 +10,23 @@ "payload.xml.models.ModelWithEmptyArray": "Payload.Xml.ModelWithEmptyArray", "payload.xml.models.ModelWithEncodedNames": "Payload.Xml.ModelWithEncodedNames", "payload.xml.models.ModelWithEnum": "Payload.Xml.ModelWithEnum", + "payload.xml.models.ModelWithNamespace": "Payload.Xml.ModelWithNamespace", + "payload.xml.models.ModelWithNamespaceOnProperties": "Payload.Xml.ModelWithNamespaceOnProperties", + "payload.xml.models.ModelWithNestedModel": "Payload.Xml.ModelWithNestedModel", "payload.xml.models.ModelWithOptionalField": "Payload.Xml.ModelWithOptionalField", "payload.xml.models.ModelWithRenamedArrays": "Payload.Xml.ModelWithRenamedArrays", + "payload.xml.models.ModelWithRenamedAttribute": "Payload.Xml.ModelWithRenamedAttribute", "payload.xml.models.ModelWithRenamedFields": "Payload.Xml.ModelWithRenamedFields", + "payload.xml.models.ModelWithRenamedNestedModel": "Payload.Xml.ModelWithRenamedNestedModel", + "payload.xml.models.ModelWithRenamedProperty": "Payload.Xml.ModelWithRenamedProperty", + "payload.xml.models.ModelWithRenamedUnwrappedModelArray": "Payload.Xml.ModelWithRenamedUnwrappedModelArray", + "payload.xml.models.ModelWithRenamedWrappedAndItemModelArray": "Payload.Xml.ModelWithRenamedWrappedAndItemModelArray", + "payload.xml.models.ModelWithRenamedWrappedModelArray": "Payload.Xml.ModelWithRenamedWrappedModelArray", "payload.xml.models.ModelWithSimpleArrays": "Payload.Xml.ModelWithSimpleArrays", "payload.xml.models.ModelWithText": "Payload.Xml.ModelWithText", "payload.xml.models.ModelWithUnwrappedArray": "Payload.Xml.ModelWithUnwrappedArray", + "payload.xml.models.ModelWithUnwrappedModelArray": "Payload.Xml.ModelWithUnwrappedModelArray", + "payload.xml.models.ModelWithWrappedPrimitiveCustomItemNames": "Payload.Xml.ModelWithWrappedPrimitiveCustomItemNames", "payload.xml.models.SimpleModel": "Payload.Xml.SimpleModel", "payload.xml.models.XmlErrorBody": "Payload.Xml.XmlErrorBody", "payload.xml.models.Status": "Payload.Xml.Status", @@ -21,22 +34,26 @@ "payload.xml.aio.operations.SimpleModelValueOperations.get": "Payload.Xml.SimpleModelValue.get", "payload.xml.operations.SimpleModelValueOperations.put": "Payload.Xml.SimpleModelValue.put", "payload.xml.aio.operations.SimpleModelValueOperations.put": "Payload.Xml.SimpleModelValue.put", + "payload.xml.operations.ModelWithRenamedPropertyValueOperations.get": "Payload.Xml.ModelWithRenamedPropertyValue.get", + "payload.xml.aio.operations.ModelWithRenamedPropertyValueOperations.get": "Payload.Xml.ModelWithRenamedPropertyValue.get", + "payload.xml.operations.ModelWithRenamedPropertyValueOperations.put": "Payload.Xml.ModelWithRenamedPropertyValue.put", + "payload.xml.aio.operations.ModelWithRenamedPropertyValueOperations.put": "Payload.Xml.ModelWithRenamedPropertyValue.put", + "payload.xml.operations.ModelWithRenamedFieldsValueOperations.get": "Payload.Xml.ModelWithRenamedFieldsValue.get", + "payload.xml.aio.operations.ModelWithRenamedFieldsValueOperations.get": "Payload.Xml.ModelWithRenamedFieldsValue.get", + "payload.xml.operations.ModelWithRenamedFieldsValueOperations.put": "Payload.Xml.ModelWithRenamedFieldsValue.put", + "payload.xml.aio.operations.ModelWithRenamedFieldsValueOperations.put": "Payload.Xml.ModelWithRenamedFieldsValue.put", + "payload.xml.operations.ModelWithNestedModelValueOperations.get": "Payload.Xml.ModelWithNestedModelValue.get", + "payload.xml.aio.operations.ModelWithNestedModelValueOperations.get": "Payload.Xml.ModelWithNestedModelValue.get", + "payload.xml.operations.ModelWithNestedModelValueOperations.put": "Payload.Xml.ModelWithNestedModelValue.put", + "payload.xml.aio.operations.ModelWithNestedModelValueOperations.put": "Payload.Xml.ModelWithNestedModelValue.put", + "payload.xml.operations.ModelWithRenamedNestedModelValueOperations.get": "Payload.Xml.ModelWithRenamedNestedModelValue.get", + "payload.xml.aio.operations.ModelWithRenamedNestedModelValueOperations.get": "Payload.Xml.ModelWithRenamedNestedModelValue.get", + "payload.xml.operations.ModelWithRenamedNestedModelValueOperations.put": "Payload.Xml.ModelWithRenamedNestedModelValue.put", + "payload.xml.aio.operations.ModelWithRenamedNestedModelValueOperations.put": "Payload.Xml.ModelWithRenamedNestedModelValue.put", "payload.xml.operations.ModelWithSimpleArraysValueOperations.get": "Payload.Xml.ModelWithSimpleArraysValue.get", "payload.xml.aio.operations.ModelWithSimpleArraysValueOperations.get": "Payload.Xml.ModelWithSimpleArraysValue.get", "payload.xml.operations.ModelWithSimpleArraysValueOperations.put": "Payload.Xml.ModelWithSimpleArraysValue.put", "payload.xml.aio.operations.ModelWithSimpleArraysValueOperations.put": "Payload.Xml.ModelWithSimpleArraysValue.put", - "payload.xml.operations.ModelWithArrayOfModelValueOperations.get": "Payload.Xml.ModelWithArrayOfModelValue.get", - "payload.xml.aio.operations.ModelWithArrayOfModelValueOperations.get": "Payload.Xml.ModelWithArrayOfModelValue.get", - "payload.xml.operations.ModelWithArrayOfModelValueOperations.put": "Payload.Xml.ModelWithArrayOfModelValue.put", - "payload.xml.aio.operations.ModelWithArrayOfModelValueOperations.put": "Payload.Xml.ModelWithArrayOfModelValue.put", - "payload.xml.operations.ModelWithOptionalFieldValueOperations.get": "Payload.Xml.ModelWithOptionalFieldValue.get", - "payload.xml.aio.operations.ModelWithOptionalFieldValueOperations.get": "Payload.Xml.ModelWithOptionalFieldValue.get", - "payload.xml.operations.ModelWithOptionalFieldValueOperations.put": "Payload.Xml.ModelWithOptionalFieldValue.put", - "payload.xml.aio.operations.ModelWithOptionalFieldValueOperations.put": "Payload.Xml.ModelWithOptionalFieldValue.put", - "payload.xml.operations.ModelWithAttributesValueOperations.get": "Payload.Xml.ModelWithAttributesValue.get", - "payload.xml.aio.operations.ModelWithAttributesValueOperations.get": "Payload.Xml.ModelWithAttributesValue.get", - "payload.xml.operations.ModelWithAttributesValueOperations.put": "Payload.Xml.ModelWithAttributesValue.put", - "payload.xml.aio.operations.ModelWithAttributesValueOperations.put": "Payload.Xml.ModelWithAttributesValue.put", "payload.xml.operations.ModelWithUnwrappedArrayValueOperations.get": "Payload.Xml.ModelWithUnwrappedArrayValue.get", "payload.xml.aio.operations.ModelWithUnwrappedArrayValueOperations.get": "Payload.Xml.ModelWithUnwrappedArrayValue.get", "payload.xml.operations.ModelWithUnwrappedArrayValueOperations.put": "Payload.Xml.ModelWithUnwrappedArrayValue.put", @@ -45,18 +62,58 @@ "payload.xml.aio.operations.ModelWithRenamedArraysValueOperations.get": "Payload.Xml.ModelWithRenamedArraysValue.get", "payload.xml.operations.ModelWithRenamedArraysValueOperations.put": "Payload.Xml.ModelWithRenamedArraysValue.put", "payload.xml.aio.operations.ModelWithRenamedArraysValueOperations.put": "Payload.Xml.ModelWithRenamedArraysValue.put", - "payload.xml.operations.ModelWithRenamedFieldsValueOperations.get": "Payload.Xml.ModelWithRenamedFieldsValue.get", - "payload.xml.aio.operations.ModelWithRenamedFieldsValueOperations.get": "Payload.Xml.ModelWithRenamedFieldsValue.get", - "payload.xml.operations.ModelWithRenamedFieldsValueOperations.put": "Payload.Xml.ModelWithRenamedFieldsValue.put", - "payload.xml.aio.operations.ModelWithRenamedFieldsValueOperations.put": "Payload.Xml.ModelWithRenamedFieldsValue.put", - "payload.xml.operations.ModelWithEmptyArrayValueOperations.get": "Payload.Xml.ModelWithEmptyArrayValue.get", - "payload.xml.aio.operations.ModelWithEmptyArrayValueOperations.get": "Payload.Xml.ModelWithEmptyArrayValue.get", - "payload.xml.operations.ModelWithEmptyArrayValueOperations.put": "Payload.Xml.ModelWithEmptyArrayValue.put", - "payload.xml.aio.operations.ModelWithEmptyArrayValueOperations.put": "Payload.Xml.ModelWithEmptyArrayValue.put", + "payload.xml.operations.ModelWithWrappedPrimitiveCustomItemNamesValueOperations.get": "Payload.Xml.ModelWithWrappedPrimitiveCustomItemNamesValue.get", + "payload.xml.aio.operations.ModelWithWrappedPrimitiveCustomItemNamesValueOperations.get": "Payload.Xml.ModelWithWrappedPrimitiveCustomItemNamesValue.get", + "payload.xml.operations.ModelWithWrappedPrimitiveCustomItemNamesValueOperations.put": "Payload.Xml.ModelWithWrappedPrimitiveCustomItemNamesValue.put", + "payload.xml.aio.operations.ModelWithWrappedPrimitiveCustomItemNamesValueOperations.put": "Payload.Xml.ModelWithWrappedPrimitiveCustomItemNamesValue.put", + "payload.xml.operations.ModelWithArrayOfModelValueOperations.get": "Payload.Xml.ModelWithArrayOfModelValue.get", + "payload.xml.aio.operations.ModelWithArrayOfModelValueOperations.get": "Payload.Xml.ModelWithArrayOfModelValue.get", + "payload.xml.operations.ModelWithArrayOfModelValueOperations.put": "Payload.Xml.ModelWithArrayOfModelValue.put", + "payload.xml.aio.operations.ModelWithArrayOfModelValueOperations.put": "Payload.Xml.ModelWithArrayOfModelValue.put", + "payload.xml.operations.ModelWithUnwrappedModelArrayValueOperations.get": "Payload.Xml.ModelWithUnwrappedModelArrayValue.get", + "payload.xml.aio.operations.ModelWithUnwrappedModelArrayValueOperations.get": "Payload.Xml.ModelWithUnwrappedModelArrayValue.get", + "payload.xml.operations.ModelWithUnwrappedModelArrayValueOperations.put": "Payload.Xml.ModelWithUnwrappedModelArrayValue.put", + "payload.xml.aio.operations.ModelWithUnwrappedModelArrayValueOperations.put": "Payload.Xml.ModelWithUnwrappedModelArrayValue.put", + "payload.xml.operations.ModelWithRenamedWrappedModelArrayValueOperations.get": "Payload.Xml.ModelWithRenamedWrappedModelArrayValue.get", + "payload.xml.aio.operations.ModelWithRenamedWrappedModelArrayValueOperations.get": "Payload.Xml.ModelWithRenamedWrappedModelArrayValue.get", + "payload.xml.operations.ModelWithRenamedWrappedModelArrayValueOperations.put": "Payload.Xml.ModelWithRenamedWrappedModelArrayValue.put", + "payload.xml.aio.operations.ModelWithRenamedWrappedModelArrayValueOperations.put": "Payload.Xml.ModelWithRenamedWrappedModelArrayValue.put", + "payload.xml.operations.ModelWithRenamedUnwrappedModelArrayValueOperations.get": "Payload.Xml.ModelWithRenamedUnwrappedModelArrayValue.get", + "payload.xml.aio.operations.ModelWithRenamedUnwrappedModelArrayValueOperations.get": "Payload.Xml.ModelWithRenamedUnwrappedModelArrayValue.get", + "payload.xml.operations.ModelWithRenamedUnwrappedModelArrayValueOperations.put": "Payload.Xml.ModelWithRenamedUnwrappedModelArrayValue.put", + "payload.xml.aio.operations.ModelWithRenamedUnwrappedModelArrayValueOperations.put": "Payload.Xml.ModelWithRenamedUnwrappedModelArrayValue.put", + "payload.xml.operations.ModelWithRenamedWrappedAndItemModelArrayValueOperations.get": "Payload.Xml.ModelWithRenamedWrappedAndItemModelArrayValue.get", + "payload.xml.aio.operations.ModelWithRenamedWrappedAndItemModelArrayValueOperations.get": "Payload.Xml.ModelWithRenamedWrappedAndItemModelArrayValue.get", + "payload.xml.operations.ModelWithRenamedWrappedAndItemModelArrayValueOperations.put": "Payload.Xml.ModelWithRenamedWrappedAndItemModelArrayValue.put", + "payload.xml.aio.operations.ModelWithRenamedWrappedAndItemModelArrayValueOperations.put": "Payload.Xml.ModelWithRenamedWrappedAndItemModelArrayValue.put", + "payload.xml.operations.ModelWithAttributesValueOperations.get": "Payload.Xml.ModelWithAttributesValue.get", + "payload.xml.aio.operations.ModelWithAttributesValueOperations.get": "Payload.Xml.ModelWithAttributesValue.get", + "payload.xml.operations.ModelWithAttributesValueOperations.put": "Payload.Xml.ModelWithAttributesValue.put", + "payload.xml.aio.operations.ModelWithAttributesValueOperations.put": "Payload.Xml.ModelWithAttributesValue.put", + "payload.xml.operations.ModelWithRenamedAttributeValueOperations.get": "Payload.Xml.ModelWithRenamedAttributeValue.get", + "payload.xml.aio.operations.ModelWithRenamedAttributeValueOperations.get": "Payload.Xml.ModelWithRenamedAttributeValue.get", + "payload.xml.operations.ModelWithRenamedAttributeValueOperations.put": "Payload.Xml.ModelWithRenamedAttributeValue.put", + "payload.xml.aio.operations.ModelWithRenamedAttributeValueOperations.put": "Payload.Xml.ModelWithRenamedAttributeValue.put", + "payload.xml.operations.ModelWithNamespaceValueOperations.get": "Payload.Xml.ModelWithNamespaceValue.get", + "payload.xml.aio.operations.ModelWithNamespaceValueOperations.get": "Payload.Xml.ModelWithNamespaceValue.get", + "payload.xml.operations.ModelWithNamespaceValueOperations.put": "Payload.Xml.ModelWithNamespaceValue.put", + "payload.xml.aio.operations.ModelWithNamespaceValueOperations.put": "Payload.Xml.ModelWithNamespaceValue.put", + "payload.xml.operations.ModelWithNamespaceOnPropertiesValueOperations.get": "Payload.Xml.ModelWithNamespaceOnPropertiesValue.get", + "payload.xml.aio.operations.ModelWithNamespaceOnPropertiesValueOperations.get": "Payload.Xml.ModelWithNamespaceOnPropertiesValue.get", + "payload.xml.operations.ModelWithNamespaceOnPropertiesValueOperations.put": "Payload.Xml.ModelWithNamespaceOnPropertiesValue.put", + "payload.xml.aio.operations.ModelWithNamespaceOnPropertiesValueOperations.put": "Payload.Xml.ModelWithNamespaceOnPropertiesValue.put", "payload.xml.operations.ModelWithTextValueOperations.get": "Payload.Xml.ModelWithTextValue.get", "payload.xml.aio.operations.ModelWithTextValueOperations.get": "Payload.Xml.ModelWithTextValue.get", "payload.xml.operations.ModelWithTextValueOperations.put": "Payload.Xml.ModelWithTextValue.put", "payload.xml.aio.operations.ModelWithTextValueOperations.put": "Payload.Xml.ModelWithTextValue.put", + "payload.xml.operations.ModelWithOptionalFieldValueOperations.get": "Payload.Xml.ModelWithOptionalFieldValue.get", + "payload.xml.aio.operations.ModelWithOptionalFieldValueOperations.get": "Payload.Xml.ModelWithOptionalFieldValue.get", + "payload.xml.operations.ModelWithOptionalFieldValueOperations.put": "Payload.Xml.ModelWithOptionalFieldValue.put", + "payload.xml.aio.operations.ModelWithOptionalFieldValueOperations.put": "Payload.Xml.ModelWithOptionalFieldValue.put", + "payload.xml.operations.ModelWithEmptyArrayValueOperations.get": "Payload.Xml.ModelWithEmptyArrayValue.get", + "payload.xml.aio.operations.ModelWithEmptyArrayValueOperations.get": "Payload.Xml.ModelWithEmptyArrayValue.get", + "payload.xml.operations.ModelWithEmptyArrayValueOperations.put": "Payload.Xml.ModelWithEmptyArrayValue.put", + "payload.xml.aio.operations.ModelWithEmptyArrayValueOperations.put": "Payload.Xml.ModelWithEmptyArrayValue.put", "payload.xml.operations.ModelWithDictionaryValueOperations.get": "Payload.Xml.ModelWithDictionaryValue.get", "payload.xml.aio.operations.ModelWithDictionaryValueOperations.get": "Payload.Xml.ModelWithDictionaryValue.get", "payload.xml.operations.ModelWithDictionaryValueOperations.put": "Payload.Xml.ModelWithDictionaryValue.put", diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_on_properties_value_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_on_properties_value_operations.py new file mode 100644 index 0000000000..227881dbd8 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_on_properties_value_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import XmlClientTestBase, XmlPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithNamespaceOnPropertiesValueOperations(XmlClientTestBase): + @XmlPreparer() + @recorded_by_proxy + def test_model_with_namespace_on_properties_value_get(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_namespace_on_properties_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy + def test_model_with_namespace_on_properties_value_put(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_namespace_on_properties_value.put( + input={"author": "str", "id": 0, "title": "str"}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_on_properties_value_operations_async.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_on_properties_value_operations_async.py new file mode 100644 index 0000000000..1185ed69d5 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_on_properties_value_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import XmlPreparer +from testpreparer_async import XmlClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithNamespaceOnPropertiesValueOperationsAsync(XmlClientTestBaseAsync): + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_namespace_on_properties_value_get(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_namespace_on_properties_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_namespace_on_properties_value_put(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_namespace_on_properties_value.put( + input={"author": "str", "id": 0, "title": "str"}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_value_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_value_operations.py new file mode 100644 index 0000000000..4fa26c51ed --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_value_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import XmlClientTestBase, XmlPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithNamespaceValueOperations(XmlClientTestBase): + @XmlPreparer() + @recorded_by_proxy + def test_model_with_namespace_value_get(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_namespace_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy + def test_model_with_namespace_value_put(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_namespace_value.put( + input={"id": 0, "title": "str"}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_value_operations_async.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_value_operations_async.py new file mode 100644 index 0000000000..b2b116055f --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_namespace_value_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import XmlPreparer +from testpreparer_async import XmlClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithNamespaceValueOperationsAsync(XmlClientTestBaseAsync): + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_namespace_value_get(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_namespace_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_namespace_value_put(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_namespace_value.put( + input={"id": 0, "title": "str"}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_nested_model_value_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_nested_model_value_operations.py new file mode 100644 index 0000000000..2710e14f3f --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_nested_model_value_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import XmlClientTestBase, XmlPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithNestedModelValueOperations(XmlClientTestBase): + @XmlPreparer() + @recorded_by_proxy + def test_model_with_nested_model_value_get(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_nested_model_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy + def test_model_with_nested_model_value_put(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_nested_model_value.put( + input={"nested": {"age": 0, "name": "str"}}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_nested_model_value_operations_async.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_nested_model_value_operations_async.py new file mode 100644 index 0000000000..79fcb92d43 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_nested_model_value_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import XmlPreparer +from testpreparer_async import XmlClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithNestedModelValueOperationsAsync(XmlClientTestBaseAsync): + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_nested_model_value_get(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_nested_model_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_nested_model_value_put(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_nested_model_value.put( + input={"nested": {"age": 0, "name": "str"}}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_attribute_value_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_attribute_value_operations.py new file mode 100644 index 0000000000..1d735df0c4 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_attribute_value_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import XmlClientTestBase, XmlPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedAttributeValueOperations(XmlClientTestBase): + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_attribute_value_get(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_attribute_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_attribute_value_put(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_attribute_value.put( + input={"author": "str", "id": 0, "title": "str"}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_attribute_value_operations_async.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_attribute_value_operations_async.py new file mode 100644 index 0000000000..0aec62ed9d --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_attribute_value_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import XmlPreparer +from testpreparer_async import XmlClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedAttributeValueOperationsAsync(XmlClientTestBaseAsync): + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_attribute_value_get(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_attribute_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_attribute_value_put(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_attribute_value.put( + input={"author": "str", "id": 0, "title": "str"}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_nested_model_value_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_nested_model_value_operations.py new file mode 100644 index 0000000000..554a4300ef --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_nested_model_value_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import XmlClientTestBase, XmlPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedNestedModelValueOperations(XmlClientTestBase): + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_nested_model_value_get(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_nested_model_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_nested_model_value_put(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_nested_model_value.put( + input={"author": {"name": "str"}}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_nested_model_value_operations_async.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_nested_model_value_operations_async.py new file mode 100644 index 0000000000..5db0aef094 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_nested_model_value_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import XmlPreparer +from testpreparer_async import XmlClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedNestedModelValueOperationsAsync(XmlClientTestBaseAsync): + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_nested_model_value_get(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_nested_model_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_nested_model_value_put(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_nested_model_value.put( + input={"author": {"name": "str"}}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_property_value_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_property_value_operations.py new file mode 100644 index 0000000000..1c02b9a520 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_property_value_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import XmlClientTestBase, XmlPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedPropertyValueOperations(XmlClientTestBase): + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_property_value_get(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_property_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_property_value_put(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_property_value.put( + input={"author": "str", "title": "str"}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_property_value_operations_async.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_property_value_operations_async.py new file mode 100644 index 0000000000..1c92e21a8f --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_property_value_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import XmlPreparer +from testpreparer_async import XmlClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedPropertyValueOperationsAsync(XmlClientTestBaseAsync): + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_property_value_get(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_property_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_property_value_put(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_property_value.put( + input={"author": "str", "title": "str"}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_unwrapped_model_array_value_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_unwrapped_model_array_value_operations.py new file mode 100644 index 0000000000..0275bcdd62 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_unwrapped_model_array_value_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import XmlClientTestBase, XmlPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedUnwrappedModelArrayValueOperations(XmlClientTestBase): + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_unwrapped_model_array_value_get(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_unwrapped_model_array_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_unwrapped_model_array_value_put(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_unwrapped_model_array_value.put( + input={"items": [{"age": 0, "name": "str"}]}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_unwrapped_model_array_value_operations_async.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_unwrapped_model_array_value_operations_async.py new file mode 100644 index 0000000000..63ec28d0ad --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_unwrapped_model_array_value_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import XmlPreparer +from testpreparer_async import XmlClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedUnwrappedModelArrayValueOperationsAsync(XmlClientTestBaseAsync): + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_unwrapped_model_array_value_get(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_unwrapped_model_array_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_unwrapped_model_array_value_put(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_unwrapped_model_array_value.put( + input={"items": [{"age": 0, "name": "str"}]}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_and_item_model_array_value_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_and_item_model_array_value_operations.py new file mode 100644 index 0000000000..a35fce338d --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_and_item_model_array_value_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import XmlClientTestBase, XmlPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedWrappedAndItemModelArrayValueOperations(XmlClientTestBase): + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_wrapped_and_item_model_array_value_get(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_wrapped_and_item_model_array_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_wrapped_and_item_model_array_value_put(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_wrapped_and_item_model_array_value.put( + input={"books": [{"title": "str"}]}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_and_item_model_array_value_operations_async.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_and_item_model_array_value_operations_async.py new file mode 100644 index 0000000000..868e739322 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_and_item_model_array_value_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import XmlPreparer +from testpreparer_async import XmlClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedWrappedAndItemModelArrayValueOperationsAsync(XmlClientTestBaseAsync): + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_wrapped_and_item_model_array_value_get(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_wrapped_and_item_model_array_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_wrapped_and_item_model_array_value_put(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_wrapped_and_item_model_array_value.put( + input={"books": [{"title": "str"}]}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_model_array_value_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_model_array_value_operations.py new file mode 100644 index 0000000000..87e644adab --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_model_array_value_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import XmlClientTestBase, XmlPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedWrappedModelArrayValueOperations(XmlClientTestBase): + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_wrapped_model_array_value_get(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_wrapped_model_array_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy + def test_model_with_renamed_wrapped_model_array_value_put(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_renamed_wrapped_model_array_value.put( + input={"items": [{"age": 0, "name": "str"}]}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_model_array_value_operations_async.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_model_array_value_operations_async.py new file mode 100644 index 0000000000..0959211503 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_renamed_wrapped_model_array_value_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import XmlPreparer +from testpreparer_async import XmlClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithRenamedWrappedModelArrayValueOperationsAsync(XmlClientTestBaseAsync): + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_wrapped_model_array_value_get(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_wrapped_model_array_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_renamed_wrapped_model_array_value_put(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_renamed_wrapped_model_array_value.put( + input={"items": [{"age": 0, "name": "str"}]}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_unwrapped_model_array_value_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_unwrapped_model_array_value_operations.py new file mode 100644 index 0000000000..f440c850f1 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_unwrapped_model_array_value_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import XmlClientTestBase, XmlPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithUnwrappedModelArrayValueOperations(XmlClientTestBase): + @XmlPreparer() + @recorded_by_proxy + def test_model_with_unwrapped_model_array_value_get(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_unwrapped_model_array_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy + def test_model_with_unwrapped_model_array_value_put(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_unwrapped_model_array_value.put( + input={"items": [{"age": 0, "name": "str"}]}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_unwrapped_model_array_value_operations_async.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_unwrapped_model_array_value_operations_async.py new file mode 100644 index 0000000000..20521d6b99 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_unwrapped_model_array_value_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import XmlPreparer +from testpreparer_async import XmlClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithUnwrappedModelArrayValueOperationsAsync(XmlClientTestBaseAsync): + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_unwrapped_model_array_value_get(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_unwrapped_model_array_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_unwrapped_model_array_value_put(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_unwrapped_model_array_value.put( + input={"items": [{"age": 0, "name": "str"}]}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_wrapped_primitive_custom_item_names_value_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_wrapped_primitive_custom_item_names_value_operations.py new file mode 100644 index 0000000000..59419358e0 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_wrapped_primitive_custom_item_names_value_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import XmlClientTestBase, XmlPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithWrappedPrimitiveCustomItemNamesValueOperations(XmlClientTestBase): + @XmlPreparer() + @recorded_by_proxy + def test_model_with_wrapped_primitive_custom_item_names_value_get(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_wrapped_primitive_custom_item_names_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy + def test_model_with_wrapped_primitive_custom_item_names_value_put(self, xml_endpoint): + client = self.create_client(endpoint=xml_endpoint) + response = client.model_with_wrapped_primitive_custom_item_names_value.put( + input={"tags": ["str"]}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_wrapped_primitive_custom_item_names_value_operations_async.py b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_wrapped_primitive_custom_item_names_value_operations_async.py new file mode 100644 index 0000000000..90a9e05bc9 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/payload-xml/generated_tests/test_xml_model_with_wrapped_primitive_custom_item_names_value_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import XmlPreparer +from testpreparer_async import XmlClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestXmlModelWithWrappedPrimitiveCustomItemNamesValueOperationsAsync(XmlClientTestBaseAsync): + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_wrapped_primitive_custom_item_names_value_get(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_wrapped_primitive_custom_item_names_value.get() + + # please add some check logic here by yourself + # ... + + @XmlPreparer() + @recorded_by_proxy_async + async def test_model_with_wrapped_primitive_custom_item_names_value_put(self, xml_endpoint): + client = self.create_async_client(endpoint=xml_endpoint) + response = await client.model_with_wrapped_primitive_custom_item_names_value.put( + input={"tags": ["str"]}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/_client.py b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/_client.py index 0d392fe3a1..ace3cc0b6a 100644 --- a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/_client.py +++ b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/_client.py @@ -24,12 +24,23 @@ ModelWithEmptyArrayValueOperations, ModelWithEncodedNamesValueOperations, ModelWithEnumValueOperations, + ModelWithNamespaceOnPropertiesValueOperations, + ModelWithNamespaceValueOperations, + ModelWithNestedModelValueOperations, ModelWithOptionalFieldValueOperations, ModelWithRenamedArraysValueOperations, + ModelWithRenamedAttributeValueOperations, ModelWithRenamedFieldsValueOperations, + ModelWithRenamedNestedModelValueOperations, + ModelWithRenamedPropertyValueOperations, + ModelWithRenamedUnwrappedModelArrayValueOperations, + ModelWithRenamedWrappedAndItemModelArrayValueOperations, + ModelWithRenamedWrappedModelArrayValueOperations, ModelWithSimpleArraysValueOperations, ModelWithTextValueOperations, ModelWithUnwrappedArrayValueOperations, + ModelWithUnwrappedModelArrayValueOperations, + ModelWithWrappedPrimitiveCustomItemNamesValueOperations, SimpleModelValueOperations, XmlErrorValueOperations, ) @@ -40,31 +51,70 @@ class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many- :ivar simple_model_value: SimpleModelValueOperations operations :vartype simple_model_value: payload.xml.operations.SimpleModelValueOperations + :ivar model_with_renamed_property_value: ModelWithRenamedPropertyValueOperations operations + :vartype model_with_renamed_property_value: + payload.xml.operations.ModelWithRenamedPropertyValueOperations + :ivar model_with_renamed_fields_value: ModelWithRenamedFieldsValueOperations operations + :vartype model_with_renamed_fields_value: + payload.xml.operations.ModelWithRenamedFieldsValueOperations + :ivar model_with_nested_model_value: ModelWithNestedModelValueOperations operations + :vartype model_with_nested_model_value: + payload.xml.operations.ModelWithNestedModelValueOperations + :ivar model_with_renamed_nested_model_value: ModelWithRenamedNestedModelValueOperations + operations + :vartype model_with_renamed_nested_model_value: + payload.xml.operations.ModelWithRenamedNestedModelValueOperations :ivar model_with_simple_arrays_value: ModelWithSimpleArraysValueOperations operations :vartype model_with_simple_arrays_value: payload.xml.operations.ModelWithSimpleArraysValueOperations - :ivar model_with_array_of_model_value: ModelWithArrayOfModelValueOperations operations - :vartype model_with_array_of_model_value: - payload.xml.operations.ModelWithArrayOfModelValueOperations - :ivar model_with_optional_field_value: ModelWithOptionalFieldValueOperations operations - :vartype model_with_optional_field_value: - payload.xml.operations.ModelWithOptionalFieldValueOperations - :ivar model_with_attributes_value: ModelWithAttributesValueOperations operations - :vartype model_with_attributes_value: payload.xml.operations.ModelWithAttributesValueOperations :ivar model_with_unwrapped_array_value: ModelWithUnwrappedArrayValueOperations operations :vartype model_with_unwrapped_array_value: payload.xml.operations.ModelWithUnwrappedArrayValueOperations :ivar model_with_renamed_arrays_value: ModelWithRenamedArraysValueOperations operations :vartype model_with_renamed_arrays_value: payload.xml.operations.ModelWithRenamedArraysValueOperations - :ivar model_with_renamed_fields_value: ModelWithRenamedFieldsValueOperations operations - :vartype model_with_renamed_fields_value: - payload.xml.operations.ModelWithRenamedFieldsValueOperations + :ivar model_with_wrapped_primitive_custom_item_names_value: + ModelWithWrappedPrimitiveCustomItemNamesValueOperations operations + :vartype model_with_wrapped_primitive_custom_item_names_value: + payload.xml.operations.ModelWithWrappedPrimitiveCustomItemNamesValueOperations + :ivar model_with_array_of_model_value: ModelWithArrayOfModelValueOperations operations + :vartype model_with_array_of_model_value: + payload.xml.operations.ModelWithArrayOfModelValueOperations + :ivar model_with_unwrapped_model_array_value: ModelWithUnwrappedModelArrayValueOperations + operations + :vartype model_with_unwrapped_model_array_value: + payload.xml.operations.ModelWithUnwrappedModelArrayValueOperations + :ivar model_with_renamed_wrapped_model_array_value: + ModelWithRenamedWrappedModelArrayValueOperations operations + :vartype model_with_renamed_wrapped_model_array_value: + payload.xml.operations.ModelWithRenamedWrappedModelArrayValueOperations + :ivar model_with_renamed_unwrapped_model_array_value: + ModelWithRenamedUnwrappedModelArrayValueOperations operations + :vartype model_with_renamed_unwrapped_model_array_value: + payload.xml.operations.ModelWithRenamedUnwrappedModelArrayValueOperations + :ivar model_with_renamed_wrapped_and_item_model_array_value: + ModelWithRenamedWrappedAndItemModelArrayValueOperations operations + :vartype model_with_renamed_wrapped_and_item_model_array_value: + payload.xml.operations.ModelWithRenamedWrappedAndItemModelArrayValueOperations + :ivar model_with_attributes_value: ModelWithAttributesValueOperations operations + :vartype model_with_attributes_value: payload.xml.operations.ModelWithAttributesValueOperations + :ivar model_with_renamed_attribute_value: ModelWithRenamedAttributeValueOperations operations + :vartype model_with_renamed_attribute_value: + payload.xml.operations.ModelWithRenamedAttributeValueOperations + :ivar model_with_namespace_value: ModelWithNamespaceValueOperations operations + :vartype model_with_namespace_value: payload.xml.operations.ModelWithNamespaceValueOperations + :ivar model_with_namespace_on_properties_value: ModelWithNamespaceOnPropertiesValueOperations + operations + :vartype model_with_namespace_on_properties_value: + payload.xml.operations.ModelWithNamespaceOnPropertiesValueOperations + :ivar model_with_text_value: ModelWithTextValueOperations operations + :vartype model_with_text_value: payload.xml.operations.ModelWithTextValueOperations + :ivar model_with_optional_field_value: ModelWithOptionalFieldValueOperations operations + :vartype model_with_optional_field_value: + payload.xml.operations.ModelWithOptionalFieldValueOperations :ivar model_with_empty_array_value: ModelWithEmptyArrayValueOperations operations :vartype model_with_empty_array_value: payload.xml.operations.ModelWithEmptyArrayValueOperations - :ivar model_with_text_value: ModelWithTextValueOperations operations - :vartype model_with_text_value: payload.xml.operations.ModelWithTextValueOperations :ivar model_with_dictionary_value: ModelWithDictionaryValueOperations operations :vartype model_with_dictionary_value: payload.xml.operations.ModelWithDictionaryValueOperations :ivar model_with_encoded_names_value: ModelWithEncodedNamesValueOperations operations @@ -111,16 +161,19 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.simple_model_value = SimpleModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_simple_arrays_value = ModelWithSimpleArraysValueOperations( + self.model_with_renamed_property_value = ModelWithRenamedPropertyValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_array_of_model_value = ModelWithArrayOfModelValueOperations( + self.model_with_renamed_fields_value = ModelWithRenamedFieldsValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_optional_field_value = ModelWithOptionalFieldValueOperations( + self.model_with_nested_model_value = ModelWithNestedModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_attributes_value = ModelWithAttributesValueOperations( + self.model_with_renamed_nested_model_value = ModelWithRenamedNestedModelValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_simple_arrays_value = ModelWithSimpleArraysValueOperations( self._client, self._config, self._serialize, self._deserialize ) self.model_with_unwrapped_array_value = ModelWithUnwrappedArrayValueOperations( @@ -129,15 +182,49 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.model_with_renamed_arrays_value = ModelWithRenamedArraysValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_renamed_fields_value = ModelWithRenamedFieldsValueOperations( + self.model_with_wrapped_primitive_custom_item_names_value = ( + ModelWithWrappedPrimitiveCustomItemNamesValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + ) + self.model_with_array_of_model_value = ModelWithArrayOfModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_empty_array_value = ModelWithEmptyArrayValueOperations( + self.model_with_unwrapped_model_array_value = ModelWithUnwrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_wrapped_model_array_value = ModelWithRenamedWrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_unwrapped_model_array_value = ModelWithRenamedUnwrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_wrapped_and_item_model_array_value = ( + ModelWithRenamedWrappedAndItemModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + ) + self.model_with_attributes_value = ModelWithAttributesValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_attribute_value = ModelWithRenamedAttributeValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_namespace_value = ModelWithNamespaceValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_namespace_on_properties_value = ModelWithNamespaceOnPropertiesValueOperations( self._client, self._config, self._serialize, self._deserialize ) self.model_with_text_value = ModelWithTextValueOperations( self._client, self._config, self._serialize, self._deserialize ) + self.model_with_optional_field_value = ModelWithOptionalFieldValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_empty_array_value = ModelWithEmptyArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.model_with_dictionary_value = ModelWithDictionaryValueOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/_client.py b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/_client.py index 7159875ea0..f714d4a975 100644 --- a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/_client.py @@ -24,12 +24,23 @@ ModelWithEmptyArrayValueOperations, ModelWithEncodedNamesValueOperations, ModelWithEnumValueOperations, + ModelWithNamespaceOnPropertiesValueOperations, + ModelWithNamespaceValueOperations, + ModelWithNestedModelValueOperations, ModelWithOptionalFieldValueOperations, ModelWithRenamedArraysValueOperations, + ModelWithRenamedAttributeValueOperations, ModelWithRenamedFieldsValueOperations, + ModelWithRenamedNestedModelValueOperations, + ModelWithRenamedPropertyValueOperations, + ModelWithRenamedUnwrappedModelArrayValueOperations, + ModelWithRenamedWrappedAndItemModelArrayValueOperations, + ModelWithRenamedWrappedModelArrayValueOperations, ModelWithSimpleArraysValueOperations, ModelWithTextValueOperations, ModelWithUnwrappedArrayValueOperations, + ModelWithUnwrappedModelArrayValueOperations, + ModelWithWrappedPrimitiveCustomItemNamesValueOperations, SimpleModelValueOperations, XmlErrorValueOperations, ) @@ -40,32 +51,72 @@ class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many- :ivar simple_model_value: SimpleModelValueOperations operations :vartype simple_model_value: payload.xml.aio.operations.SimpleModelValueOperations + :ivar model_with_renamed_property_value: ModelWithRenamedPropertyValueOperations operations + :vartype model_with_renamed_property_value: + payload.xml.aio.operations.ModelWithRenamedPropertyValueOperations + :ivar model_with_renamed_fields_value: ModelWithRenamedFieldsValueOperations operations + :vartype model_with_renamed_fields_value: + payload.xml.aio.operations.ModelWithRenamedFieldsValueOperations + :ivar model_with_nested_model_value: ModelWithNestedModelValueOperations operations + :vartype model_with_nested_model_value: + payload.xml.aio.operations.ModelWithNestedModelValueOperations + :ivar model_with_renamed_nested_model_value: ModelWithRenamedNestedModelValueOperations + operations + :vartype model_with_renamed_nested_model_value: + payload.xml.aio.operations.ModelWithRenamedNestedModelValueOperations :ivar model_with_simple_arrays_value: ModelWithSimpleArraysValueOperations operations :vartype model_with_simple_arrays_value: payload.xml.aio.operations.ModelWithSimpleArraysValueOperations - :ivar model_with_array_of_model_value: ModelWithArrayOfModelValueOperations operations - :vartype model_with_array_of_model_value: - payload.xml.aio.operations.ModelWithArrayOfModelValueOperations - :ivar model_with_optional_field_value: ModelWithOptionalFieldValueOperations operations - :vartype model_with_optional_field_value: - payload.xml.aio.operations.ModelWithOptionalFieldValueOperations - :ivar model_with_attributes_value: ModelWithAttributesValueOperations operations - :vartype model_with_attributes_value: - payload.xml.aio.operations.ModelWithAttributesValueOperations :ivar model_with_unwrapped_array_value: ModelWithUnwrappedArrayValueOperations operations :vartype model_with_unwrapped_array_value: payload.xml.aio.operations.ModelWithUnwrappedArrayValueOperations :ivar model_with_renamed_arrays_value: ModelWithRenamedArraysValueOperations operations :vartype model_with_renamed_arrays_value: payload.xml.aio.operations.ModelWithRenamedArraysValueOperations - :ivar model_with_renamed_fields_value: ModelWithRenamedFieldsValueOperations operations - :vartype model_with_renamed_fields_value: - payload.xml.aio.operations.ModelWithRenamedFieldsValueOperations + :ivar model_with_wrapped_primitive_custom_item_names_value: + ModelWithWrappedPrimitiveCustomItemNamesValueOperations operations + :vartype model_with_wrapped_primitive_custom_item_names_value: + payload.xml.aio.operations.ModelWithWrappedPrimitiveCustomItemNamesValueOperations + :ivar model_with_array_of_model_value: ModelWithArrayOfModelValueOperations operations + :vartype model_with_array_of_model_value: + payload.xml.aio.operations.ModelWithArrayOfModelValueOperations + :ivar model_with_unwrapped_model_array_value: ModelWithUnwrappedModelArrayValueOperations + operations + :vartype model_with_unwrapped_model_array_value: + payload.xml.aio.operations.ModelWithUnwrappedModelArrayValueOperations + :ivar model_with_renamed_wrapped_model_array_value: + ModelWithRenamedWrappedModelArrayValueOperations operations + :vartype model_with_renamed_wrapped_model_array_value: + payload.xml.aio.operations.ModelWithRenamedWrappedModelArrayValueOperations + :ivar model_with_renamed_unwrapped_model_array_value: + ModelWithRenamedUnwrappedModelArrayValueOperations operations + :vartype model_with_renamed_unwrapped_model_array_value: + payload.xml.aio.operations.ModelWithRenamedUnwrappedModelArrayValueOperations + :ivar model_with_renamed_wrapped_and_item_model_array_value: + ModelWithRenamedWrappedAndItemModelArrayValueOperations operations + :vartype model_with_renamed_wrapped_and_item_model_array_value: + payload.xml.aio.operations.ModelWithRenamedWrappedAndItemModelArrayValueOperations + :ivar model_with_attributes_value: ModelWithAttributesValueOperations operations + :vartype model_with_attributes_value: + payload.xml.aio.operations.ModelWithAttributesValueOperations + :ivar model_with_renamed_attribute_value: ModelWithRenamedAttributeValueOperations operations + :vartype model_with_renamed_attribute_value: + payload.xml.aio.operations.ModelWithRenamedAttributeValueOperations + :ivar model_with_namespace_value: ModelWithNamespaceValueOperations operations + :vartype model_with_namespace_value: + payload.xml.aio.operations.ModelWithNamespaceValueOperations + :ivar model_with_namespace_on_properties_value: ModelWithNamespaceOnPropertiesValueOperations + operations + :vartype model_with_namespace_on_properties_value: + payload.xml.aio.operations.ModelWithNamespaceOnPropertiesValueOperations + :ivar model_with_text_value: ModelWithTextValueOperations operations + :vartype model_with_text_value: payload.xml.aio.operations.ModelWithTextValueOperations + :ivar model_with_optional_field_value: ModelWithOptionalFieldValueOperations operations + :vartype model_with_optional_field_value: + payload.xml.aio.operations.ModelWithOptionalFieldValueOperations :ivar model_with_empty_array_value: ModelWithEmptyArrayValueOperations operations :vartype model_with_empty_array_value: payload.xml.aio.operations.ModelWithEmptyArrayValueOperations - :ivar model_with_text_value: ModelWithTextValueOperations operations - :vartype model_with_text_value: payload.xml.aio.operations.ModelWithTextValueOperations :ivar model_with_dictionary_value: ModelWithDictionaryValueOperations operations :vartype model_with_dictionary_value: payload.xml.aio.operations.ModelWithDictionaryValueOperations @@ -113,16 +164,19 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.simple_model_value = SimpleModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_simple_arrays_value = ModelWithSimpleArraysValueOperations( + self.model_with_renamed_property_value = ModelWithRenamedPropertyValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_array_of_model_value = ModelWithArrayOfModelValueOperations( + self.model_with_renamed_fields_value = ModelWithRenamedFieldsValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_optional_field_value = ModelWithOptionalFieldValueOperations( + self.model_with_nested_model_value = ModelWithNestedModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_attributes_value = ModelWithAttributesValueOperations( + self.model_with_renamed_nested_model_value = ModelWithRenamedNestedModelValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_simple_arrays_value = ModelWithSimpleArraysValueOperations( self._client, self._config, self._serialize, self._deserialize ) self.model_with_unwrapped_array_value = ModelWithUnwrappedArrayValueOperations( @@ -131,15 +185,49 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.model_with_renamed_arrays_value = ModelWithRenamedArraysValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_renamed_fields_value = ModelWithRenamedFieldsValueOperations( + self.model_with_wrapped_primitive_custom_item_names_value = ( + ModelWithWrappedPrimitiveCustomItemNamesValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + ) + self.model_with_array_of_model_value = ModelWithArrayOfModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_empty_array_value = ModelWithEmptyArrayValueOperations( + self.model_with_unwrapped_model_array_value = ModelWithUnwrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_wrapped_model_array_value = ModelWithRenamedWrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_unwrapped_model_array_value = ModelWithRenamedUnwrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_wrapped_and_item_model_array_value = ( + ModelWithRenamedWrappedAndItemModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + ) + self.model_with_attributes_value = ModelWithAttributesValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_attribute_value = ModelWithRenamedAttributeValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_namespace_value = ModelWithNamespaceValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_namespace_on_properties_value = ModelWithNamespaceOnPropertiesValueOperations( self._client, self._config, self._serialize, self._deserialize ) self.model_with_text_value = ModelWithTextValueOperations( self._client, self._config, self._serialize, self._deserialize ) + self.model_with_optional_field_value = ModelWithOptionalFieldValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_empty_array_value = ModelWithEmptyArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.model_with_dictionary_value = ModelWithDictionaryValueOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/operations/__init__.py index 115dd22e44..3ad13f607b 100644 --- a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/operations/__init__.py @@ -13,15 +13,26 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import SimpleModelValueOperations # type: ignore +from ._operations import ModelWithRenamedPropertyValueOperations # type: ignore +from ._operations import ModelWithRenamedFieldsValueOperations # type: ignore +from ._operations import ModelWithNestedModelValueOperations # type: ignore +from ._operations import ModelWithRenamedNestedModelValueOperations # type: ignore from ._operations import ModelWithSimpleArraysValueOperations # type: ignore -from ._operations import ModelWithArrayOfModelValueOperations # type: ignore -from ._operations import ModelWithOptionalFieldValueOperations # type: ignore -from ._operations import ModelWithAttributesValueOperations # type: ignore from ._operations import ModelWithUnwrappedArrayValueOperations # type: ignore from ._operations import ModelWithRenamedArraysValueOperations # type: ignore -from ._operations import ModelWithRenamedFieldsValueOperations # type: ignore -from ._operations import ModelWithEmptyArrayValueOperations # type: ignore +from ._operations import ModelWithWrappedPrimitiveCustomItemNamesValueOperations # type: ignore +from ._operations import ModelWithArrayOfModelValueOperations # type: ignore +from ._operations import ModelWithUnwrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedWrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedUnwrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedWrappedAndItemModelArrayValueOperations # type: ignore +from ._operations import ModelWithAttributesValueOperations # type: ignore +from ._operations import ModelWithRenamedAttributeValueOperations # type: ignore +from ._operations import ModelWithNamespaceValueOperations # type: ignore +from ._operations import ModelWithNamespaceOnPropertiesValueOperations # type: ignore from ._operations import ModelWithTextValueOperations # type: ignore +from ._operations import ModelWithOptionalFieldValueOperations # type: ignore +from ._operations import ModelWithEmptyArrayValueOperations # type: ignore from ._operations import ModelWithDictionaryValueOperations # type: ignore from ._operations import ModelWithEncodedNamesValueOperations # type: ignore from ._operations import ModelWithEnumValueOperations # type: ignore @@ -34,15 +45,26 @@ __all__ = [ "SimpleModelValueOperations", + "ModelWithRenamedPropertyValueOperations", + "ModelWithRenamedFieldsValueOperations", + "ModelWithNestedModelValueOperations", + "ModelWithRenamedNestedModelValueOperations", "ModelWithSimpleArraysValueOperations", - "ModelWithArrayOfModelValueOperations", - "ModelWithOptionalFieldValueOperations", - "ModelWithAttributesValueOperations", "ModelWithUnwrappedArrayValueOperations", "ModelWithRenamedArraysValueOperations", - "ModelWithRenamedFieldsValueOperations", - "ModelWithEmptyArrayValueOperations", + "ModelWithWrappedPrimitiveCustomItemNamesValueOperations", + "ModelWithArrayOfModelValueOperations", + "ModelWithUnwrappedModelArrayValueOperations", + "ModelWithRenamedWrappedModelArrayValueOperations", + "ModelWithRenamedUnwrappedModelArrayValueOperations", + "ModelWithRenamedWrappedAndItemModelArrayValueOperations", + "ModelWithAttributesValueOperations", + "ModelWithRenamedAttributeValueOperations", + "ModelWithNamespaceValueOperations", + "ModelWithNamespaceOnPropertiesValueOperations", "ModelWithTextValueOperations", + "ModelWithOptionalFieldValueOperations", + "ModelWithEmptyArrayValueOperations", "ModelWithDictionaryValueOperations", "ModelWithEncodedNamesValueOperations", "ModelWithEnumValueOperations", diff --git a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/operations/_operations.py index 7d29656810..bdd8ad4a65 100644 --- a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/aio/operations/_operations.py @@ -43,18 +43,40 @@ build_model_with_encoded_names_value_put_request, build_model_with_enum_value_get_request, build_model_with_enum_value_put_request, + build_model_with_namespace_on_properties_value_get_request, + build_model_with_namespace_on_properties_value_put_request, + build_model_with_namespace_value_get_request, + build_model_with_namespace_value_put_request, + build_model_with_nested_model_value_get_request, + build_model_with_nested_model_value_put_request, build_model_with_optional_field_value_get_request, build_model_with_optional_field_value_put_request, build_model_with_renamed_arrays_value_get_request, build_model_with_renamed_arrays_value_put_request, + build_model_with_renamed_attribute_value_get_request, + build_model_with_renamed_attribute_value_put_request, build_model_with_renamed_fields_value_get_request, build_model_with_renamed_fields_value_put_request, + build_model_with_renamed_nested_model_value_get_request, + build_model_with_renamed_nested_model_value_put_request, + build_model_with_renamed_property_value_get_request, + build_model_with_renamed_property_value_put_request, + build_model_with_renamed_unwrapped_model_array_value_get_request, + build_model_with_renamed_unwrapped_model_array_value_put_request, + build_model_with_renamed_wrapped_and_item_model_array_value_get_request, + build_model_with_renamed_wrapped_and_item_model_array_value_put_request, + build_model_with_renamed_wrapped_model_array_value_get_request, + build_model_with_renamed_wrapped_model_array_value_put_request, build_model_with_simple_arrays_value_get_request, build_model_with_simple_arrays_value_put_request, build_model_with_text_value_get_request, build_model_with_text_value_put_request, build_model_with_unwrapped_array_value_get_request, build_model_with_unwrapped_array_value_put_request, + build_model_with_unwrapped_model_array_value_get_request, + build_model_with_unwrapped_model_array_value_put_request, + build_model_with_wrapped_primitive_custom_item_names_value_get_request, + build_model_with_wrapped_primitive_custom_item_names_value_put_request, build_simple_model_value_get_request, build_simple_model_value_put_request, build_xml_error_value_get_request, @@ -194,14 +216,14 @@ async def put(self, input: _models.SimpleModel, **kwargs: Any) -> None: return cls(pipeline_response, None, {}) # type: ignore -class ModelWithSimpleArraysValueOperations: +class ModelWithRenamedPropertyValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_simple_arrays_value` attribute. + :attr:`model_with_renamed_property_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -212,11 +234,12 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: + async def get(self, **kwargs: Any) -> _models.ModelWithRenamedProperty: """get. - :return: ModelWithSimpleArrays. The ModelWithSimpleArrays is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithSimpleArrays + :return: ModelWithRenamedProperty. The ModelWithRenamedProperty is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedProperty :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -230,9 +253,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithSimpleArrays] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedProperty] = kwargs.pop("cls", None) - _request = build_model_with_simple_arrays_value_get_request( + _request = build_model_with_renamed_property_value_get_request( headers=_headers, params=_params, ) @@ -264,7 +287,7 @@ async def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithSimpleArrays, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedProperty, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -272,11 +295,11 @@ async def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: return deserialized # type: ignore @distributed_trace_async - async def put(self, input: _models.ModelWithSimpleArrays, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithRenamedProperty, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithSimpleArrays + :type input: ~payload.xml.models.ModelWithRenamedProperty :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -297,7 +320,7 @@ async def put(self, input: _models.ModelWithSimpleArrays, **kwargs: Any) -> None _content = _get_element(input) - _request = build_model_with_simple_arrays_value_put_request( + _request = build_model_with_renamed_property_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -323,14 +346,14 @@ async def put(self, input: _models.ModelWithSimpleArrays, **kwargs: Any) -> None return cls(pipeline_response, None, {}) # type: ignore -class ModelWithArrayOfModelValueOperations: +class ModelWithRenamedFieldsValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_array_of_model_value` attribute. + :attr:`model_with_renamed_fields_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -341,11 +364,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: + async def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: """get. - :return: ModelWithArrayOfModel. The ModelWithArrayOfModel is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithArrayOfModel + :return: ModelWithRenamedFields. The ModelWithRenamedFields is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedFields :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -359,9 +382,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithArrayOfModel] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedFields] = kwargs.pop("cls", None) - _request = build_model_with_array_of_model_value_get_request( + _request = build_model_with_renamed_fields_value_get_request( headers=_headers, params=_params, ) @@ -393,7 +416,7 @@ async def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithArrayOfModel, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedFields, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -401,11 +424,11 @@ async def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: return deserialized # type: ignore @distributed_trace_async - async def put(self, input: _models.ModelWithArrayOfModel, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithRenamedFields, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithArrayOfModel + :type input: ~payload.xml.models.ModelWithRenamedFields :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -426,7 +449,7 @@ async def put(self, input: _models.ModelWithArrayOfModel, **kwargs: Any) -> None _content = _get_element(input) - _request = build_model_with_array_of_model_value_put_request( + _request = build_model_with_renamed_fields_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -452,14 +475,14 @@ async def put(self, input: _models.ModelWithArrayOfModel, **kwargs: Any) -> None return cls(pipeline_response, None, {}) # type: ignore -class ModelWithOptionalFieldValueOperations: +class ModelWithNestedModelValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_optional_field_value` attribute. + :attr:`model_with_nested_model_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -470,11 +493,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: + async def get(self, **kwargs: Any) -> _models.ModelWithNestedModel: """get. - :return: ModelWithOptionalField. The ModelWithOptionalField is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithOptionalField + :return: ModelWithNestedModel. The ModelWithNestedModel is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithNestedModel :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -488,9 +511,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithOptionalField] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithNestedModel] = kwargs.pop("cls", None) - _request = build_model_with_optional_field_value_get_request( + _request = build_model_with_nested_model_value_get_request( headers=_headers, params=_params, ) @@ -522,7 +545,7 @@ async def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithOptionalField, response.text()) + deserialized = _deserialize_xml(_models.ModelWithNestedModel, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -530,11 +553,11 @@ async def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: return deserialized # type: ignore @distributed_trace_async - async def put(self, input: _models.ModelWithOptionalField, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithNestedModel, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithOptionalField + :type input: ~payload.xml.models.ModelWithNestedModel :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -555,7 +578,7 @@ async def put(self, input: _models.ModelWithOptionalField, **kwargs: Any) -> Non _content = _get_element(input) - _request = build_model_with_optional_field_value_put_request( + _request = build_model_with_nested_model_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -581,14 +604,14 @@ async def put(self, input: _models.ModelWithOptionalField, **kwargs: Any) -> Non return cls(pipeline_response, None, {}) # type: ignore -class ModelWithAttributesValueOperations: +class ModelWithRenamedNestedModelValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_attributes_value` attribute. + :attr:`model_with_renamed_nested_model_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -599,11 +622,12 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, **kwargs: Any) -> _models.ModelWithAttributes: + async def get(self, **kwargs: Any) -> _models.ModelWithRenamedNestedModel: """get. - :return: ModelWithAttributes. The ModelWithAttributes is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithAttributes + :return: ModelWithRenamedNestedModel. The ModelWithRenamedNestedModel is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedNestedModel :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -617,9 +641,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithAttributes: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithAttributes] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedNestedModel] = kwargs.pop("cls", None) - _request = build_model_with_attributes_value_get_request( + _request = build_model_with_renamed_nested_model_value_get_request( headers=_headers, params=_params, ) @@ -651,7 +675,7 @@ async def get(self, **kwargs: Any) -> _models.ModelWithAttributes: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithAttributes, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedNestedModel, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -659,11 +683,11 @@ async def get(self, **kwargs: Any) -> _models.ModelWithAttributes: return deserialized # type: ignore @distributed_trace_async - async def put(self, input: _models.ModelWithAttributes, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithRenamedNestedModel, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithAttributes + :type input: ~payload.xml.models.ModelWithRenamedNestedModel :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -684,7 +708,136 @@ async def put(self, input: _models.ModelWithAttributes, **kwargs: Any) -> None: _content = _get_element(input) - _request = build_model_with_attributes_value_put_request( + _request = build_model_with_renamed_nested_model_value_put_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 ModelWithSimpleArraysValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_simple_arrays_value` 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: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: + """get. + + :return: ModelWithSimpleArrays. The ModelWithSimpleArrays is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithSimpleArrays + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithSimpleArrays] = kwargs.pop("cls", None) + + _request = build_model_with_simple_arrays_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithSimpleArrays, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, input: _models.ModelWithSimpleArrays, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithSimpleArrays + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_simple_arrays_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -968,14 +1121,14 @@ async def put(self, input: _models.ModelWithRenamedArrays, **kwargs: Any) -> Non return cls(pipeline_response, None, {}) # type: ignore -class ModelWithRenamedFieldsValueOperations: +class ModelWithWrappedPrimitiveCustomItemNamesValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_renamed_fields_value` attribute. + :attr:`model_with_wrapped_primitive_custom_item_names_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -986,11 +1139,12 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: + async def get(self, **kwargs: Any) -> _models.ModelWithWrappedPrimitiveCustomItemNames: """get. - :return: ModelWithRenamedFields. The ModelWithRenamedFields is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithRenamedFields + :return: ModelWithWrappedPrimitiveCustomItemNames. The ModelWithWrappedPrimitiveCustomItemNames + is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithWrappedPrimitiveCustomItemNames :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1004,9 +1158,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithRenamedFields] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithWrappedPrimitiveCustomItemNames] = kwargs.pop("cls", None) - _request = build_model_with_renamed_fields_value_get_request( + _request = build_model_with_wrapped_primitive_custom_item_names_value_get_request( headers=_headers, params=_params, ) @@ -1038,7 +1192,7 @@ async def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithRenamedFields, response.text()) + deserialized = _deserialize_xml(_models.ModelWithWrappedPrimitiveCustomItemNames, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1046,11 +1200,11 @@ async def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: return deserialized # type: ignore @distributed_trace_async - async def put(self, input: _models.ModelWithRenamedFields, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithWrappedPrimitiveCustomItemNames, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithRenamedFields + :type input: ~payload.xml.models.ModelWithWrappedPrimitiveCustomItemNames :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1071,7 +1225,7 @@ async def put(self, input: _models.ModelWithRenamedFields, **kwargs: Any) -> Non _content = _get_element(input) - _request = build_model_with_renamed_fields_value_put_request( + _request = build_model_with_wrapped_primitive_custom_item_names_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1097,14 +1251,14 @@ async def put(self, input: _models.ModelWithRenamedFields, **kwargs: Any) -> Non return cls(pipeline_response, None, {}) # type: ignore -class ModelWithEmptyArrayValueOperations: +class ModelWithArrayOfModelValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_empty_array_value` attribute. + :attr:`model_with_array_of_model_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1115,11 +1269,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: + async def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: """get. - :return: ModelWithEmptyArray. The ModelWithEmptyArray is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithEmptyArray + :return: ModelWithArrayOfModel. The ModelWithArrayOfModel is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithArrayOfModel :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1133,9 +1287,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithEmptyArray] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithArrayOfModel] = kwargs.pop("cls", None) - _request = build_model_with_empty_array_value_get_request( + _request = build_model_with_array_of_model_value_get_request( headers=_headers, params=_params, ) @@ -1167,7 +1321,7 @@ async def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithEmptyArray, response.text()) + deserialized = _deserialize_xml(_models.ModelWithArrayOfModel, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1175,11 +1329,11 @@ async def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: return deserialized # type: ignore @distributed_trace_async - async def put(self, input: _models.ModelWithEmptyArray, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithArrayOfModel, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithEmptyArray + :type input: ~payload.xml.models.ModelWithArrayOfModel :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1200,7 +1354,7 @@ async def put(self, input: _models.ModelWithEmptyArray, **kwargs: Any) -> None: _content = _get_element(input) - _request = build_model_with_empty_array_value_put_request( + _request = build_model_with_array_of_model_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1226,14 +1380,14 @@ async def put(self, input: _models.ModelWithEmptyArray, **kwargs: Any) -> None: return cls(pipeline_response, None, {}) # type: ignore -class ModelWithTextValueOperations: +class ModelWithUnwrappedModelArrayValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_text_value` attribute. + :attr:`model_with_unwrapped_model_array_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1244,11 +1398,12 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get(self, **kwargs: Any) -> _models.ModelWithText: + async def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedModelArray: """get. - :return: ModelWithText. The ModelWithText is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithText + :return: ModelWithUnwrappedModelArray. The ModelWithUnwrappedModelArray is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithUnwrappedModelArray :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1262,9 +1417,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithText: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithText] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithUnwrappedModelArray] = kwargs.pop("cls", None) - _request = build_model_with_text_value_get_request( + _request = build_model_with_unwrapped_model_array_value_get_request( headers=_headers, params=_params, ) @@ -1296,7 +1451,7 @@ async def get(self, **kwargs: Any) -> _models.ModelWithText: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithText, response.text()) + deserialized = _deserialize_xml(_models.ModelWithUnwrappedModelArray, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1304,11 +1459,11 @@ async def get(self, **kwargs: Any) -> _models.ModelWithText: return deserialized # type: ignore @distributed_trace_async - async def put(self, input: _models.ModelWithText, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithUnwrappedModelArray, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithText + :type input: ~payload.xml.models.ModelWithUnwrappedModelArray :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1329,7 +1484,1302 @@ async def put(self, input: _models.ModelWithText, **kwargs: Any) -> None: _content = _get_element(input) - _request = build_model_with_text_value_put_request( + _request = build_model_with_unwrapped_model_array_value_put_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 ModelWithRenamedWrappedModelArrayValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_renamed_wrapped_model_array_value` 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: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithRenamedWrappedModelArray: + """get. + + :return: ModelWithRenamedWrappedModelArray. The ModelWithRenamedWrappedModelArray is compatible + with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedWrappedModelArray + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedWrappedModelArray] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_wrapped_model_array_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedWrappedModelArray, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, input: _models.ModelWithRenamedWrappedModelArray, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedWrappedModelArray + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_wrapped_model_array_value_put_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 ModelWithRenamedUnwrappedModelArrayValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_renamed_unwrapped_model_array_value` 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: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithRenamedUnwrappedModelArray: + """get. + + :return: ModelWithRenamedUnwrappedModelArray. The ModelWithRenamedUnwrappedModelArray is + compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedUnwrappedModelArray + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedUnwrappedModelArray] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_unwrapped_model_array_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedUnwrappedModelArray, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, input: _models.ModelWithRenamedUnwrappedModelArray, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedUnwrappedModelArray + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_unwrapped_model_array_value_put_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 ModelWithRenamedWrappedAndItemModelArrayValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_renamed_wrapped_and_item_model_array_value` 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: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithRenamedWrappedAndItemModelArray: + """get. + + :return: ModelWithRenamedWrappedAndItemModelArray. The ModelWithRenamedWrappedAndItemModelArray + is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedWrappedAndItemModelArray + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedWrappedAndItemModelArray] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_wrapped_and_item_model_array_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedWrappedAndItemModelArray, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, input: _models.ModelWithRenamedWrappedAndItemModelArray, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedWrappedAndItemModelArray + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_wrapped_and_item_model_array_value_put_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 ModelWithAttributesValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_attributes_value` 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: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithAttributes: + """get. + + :return: ModelWithAttributes. The ModelWithAttributes is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithAttributes + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithAttributes] = kwargs.pop("cls", None) + + _request = build_model_with_attributes_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithAttributes, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, input: _models.ModelWithAttributes, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithAttributes + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_attributes_value_put_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 ModelWithRenamedAttributeValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_renamed_attribute_value` 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: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithRenamedAttribute: + """get. + + :return: ModelWithRenamedAttribute. The ModelWithRenamedAttribute is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedAttribute + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedAttribute] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_attribute_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedAttribute, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, input: _models.ModelWithRenamedAttribute, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedAttribute + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_attribute_value_put_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 ModelWithNamespaceValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_namespace_value` 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: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithNamespace: + """get. + + :return: ModelWithNamespace. The ModelWithNamespace is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithNamespace + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithNamespace] = kwargs.pop("cls", None) + + _request = build_model_with_namespace_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithNamespace, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, input: _models.ModelWithNamespace, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithNamespace + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_namespace_value_put_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 ModelWithNamespaceOnPropertiesValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_namespace_on_properties_value` 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: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithNamespaceOnProperties: + """get. + + :return: ModelWithNamespaceOnProperties. The ModelWithNamespaceOnProperties is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithNamespaceOnProperties + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithNamespaceOnProperties] = kwargs.pop("cls", None) + + _request = build_model_with_namespace_on_properties_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithNamespaceOnProperties, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, input: _models.ModelWithNamespaceOnProperties, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithNamespaceOnProperties + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_namespace_on_properties_value_put_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 ModelWithTextValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_text_value` 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: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithText: + """get. + + :return: ModelWithText. The ModelWithText is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithText + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithText] = kwargs.pop("cls", None) + + _request = build_model_with_text_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithText, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, input: _models.ModelWithText, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithText + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_text_value_put_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 ModelWithOptionalFieldValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_optional_field_value` 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: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithOptionalField: + """get. + + :return: ModelWithOptionalField. The ModelWithOptionalField is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithOptionalField + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithOptionalField] = kwargs.pop("cls", None) + + _request = build_model_with_optional_field_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithOptionalField, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, input: _models.ModelWithOptionalField, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithOptionalField + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_optional_field_value_put_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 ModelWithEmptyArrayValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_empty_array_value` 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: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: + """get. + + :return: ModelWithEmptyArray. The ModelWithEmptyArray is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithEmptyArray + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithEmptyArray] = kwargs.pop("cls", None) + + _request = build_model_with_empty_array_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithEmptyArray, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, input: _models.ModelWithEmptyArray, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithEmptyArray + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_empty_array_value_put_request( content_type=content_type, content=_content, headers=_headers, diff --git a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/models/__init__.py b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/models/__init__.py index aa125a5922..cee259be61 100644 --- a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/models/__init__.py +++ b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/models/__init__.py @@ -14,6 +14,8 @@ from ._models import ( # type: ignore + Author, + Book, ModelWithArrayOfModel, ModelWithAttributes, ModelWithDatetime, @@ -21,12 +23,23 @@ ModelWithEmptyArray, ModelWithEncodedNames, ModelWithEnum, + ModelWithNamespace, + ModelWithNamespaceOnProperties, + ModelWithNestedModel, ModelWithOptionalField, ModelWithRenamedArrays, + ModelWithRenamedAttribute, ModelWithRenamedFields, + ModelWithRenamedNestedModel, + ModelWithRenamedProperty, + ModelWithRenamedUnwrappedModelArray, + ModelWithRenamedWrappedAndItemModelArray, + ModelWithRenamedWrappedModelArray, ModelWithSimpleArrays, ModelWithText, ModelWithUnwrappedArray, + ModelWithUnwrappedModelArray, + ModelWithWrappedPrimitiveCustomItemNames, SimpleModel, XmlErrorBody, ) @@ -39,6 +52,8 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "Author", + "Book", "ModelWithArrayOfModel", "ModelWithAttributes", "ModelWithDatetime", @@ -46,12 +61,23 @@ "ModelWithEmptyArray", "ModelWithEncodedNames", "ModelWithEnum", + "ModelWithNamespace", + "ModelWithNamespaceOnProperties", + "ModelWithNestedModel", "ModelWithOptionalField", "ModelWithRenamedArrays", + "ModelWithRenamedAttribute", "ModelWithRenamedFields", + "ModelWithRenamedNestedModel", + "ModelWithRenamedProperty", + "ModelWithRenamedUnwrappedModelArray", + "ModelWithRenamedWrappedAndItemModelArray", + "ModelWithRenamedWrappedModelArray", "ModelWithSimpleArrays", "ModelWithText", "ModelWithUnwrappedArray", + "ModelWithUnwrappedModelArray", + "ModelWithWrappedPrimitiveCustomItemNames", "SimpleModel", "XmlErrorBody", "Status", diff --git a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/models/_models.py b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/models/_models.py index 5fcba77a78..e6f92b65da 100644 --- a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/models/_models.py +++ b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/models/_models.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -16,8 +17,74 @@ from .. import models as _models +class Author(_Model): + """Author model with a custom XML name. + + :ivar name: Required. + :vartype name: str + """ + + name: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "name", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "XmlAuthor", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Book(_Model): + """Book model with a custom XML name. + + :ivar title: Required. + :vartype title: str + """ + + title: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "title", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "XmlBook", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + title: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ModelWithArrayOfModel(_Model): - """Contains an array of models. + """§4.1 — Contains an array of models. :ivar items_property: Required. :vartype items_property: ~payload.xml.models.SimpleModel @@ -52,7 +119,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ModelWithAttributes(_Model): - """Contains fields that are XML attributes. + """§5.1 — Contains fields that are XML attributes. :ivar id1: Required. :vartype id1: int @@ -286,6 +353,157 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ModelWithNamespace(_Model): + """§6.1, §7.1 — Contains fields with XML namespace on the model. + + :ivar id: Required. + :vartype id: int + :ivar title: Required. + :vartype title: str + """ + + id: int = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "id", "text": False, "unwrapped": False}, + ) + """Required.""" + title: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "title", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = { + "attribute": False, + "name": "ModelWithNamespace", + "namespace": "http://example.com/schema", + "prefix": "smp", + "text": False, + "unwrapped": False, + } + + @overload + def __init__( + self, + *, + id: int, # pylint: disable=redefined-builtin + title: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithNamespaceOnProperties(_Model): + """§6.2, §7.2 — Contains fields with different XML namespaces on individual properties. + + :ivar id: Required. + :vartype id: int + :ivar title: Required. + :vartype title: str + :ivar author: Required. + :vartype author: str + """ + + id: int = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "id", "text": False, "unwrapped": False}, + ) + """Required.""" + title: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={ + "attribute": False, + "name": "title", + "namespace": "http://example.com/schema", + "prefix": "smp", + "text": False, + "unwrapped": False, + }, + ) + """Required.""" + author: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={ + "attribute": False, + "name": "author", + "namespace": "http://example.com/ns2", + "prefix": "ns2", + "text": False, + "unwrapped": False, + }, + ) + """Required.""" + + _xml = { + "attribute": False, + "name": "ModelWithNamespaceOnProperties", + "namespace": "http://example.com/schema", + "prefix": "smp", + "text": False, + "unwrapped": False, + } + + @overload + def __init__( + self, + *, + id: int, # pylint: disable=redefined-builtin + title: str, + author: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithNestedModel(_Model): + """§2.1 — Contains a property that references another model. + + :ivar nested: Required. + :vartype nested: ~payload.xml.models.SimpleModel + """ + + nested: "_models.SimpleModel" = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "nested", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithNestedModel", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + nested: "_models.SimpleModel", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ModelWithOptionalField(_Model): """Contains an optional field. @@ -327,8 +545,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ModelWithRenamedArrays(_Model): - """Contains fields of wrapped and unwrapped arrays of primitive types that have different XML - representations. + """§3.3, §3.4 — Contains fields of wrapped and unwrapped arrays of primitive types that have + different XML representations. :ivar colors: Required. :vartype colors: list[str] @@ -368,8 +586,57 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ModelWithRenamedAttribute(_Model): + """§5.2 — Contains a renamed XML attribute. + + :ivar id: Required. + :vartype id: int + :ivar title: Required. + :vartype title: str + :ivar author: Required. + :vartype author: str + """ + + id: int = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": True, "name": "xml-id", "text": False, "unwrapped": False}, + ) + """Required.""" + title: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "title", "text": False, "unwrapped": False}, + ) + """Required.""" + author: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "author", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedAttribute", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + id: int, # pylint: disable=redefined-builtin + title: str, + author: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ModelWithRenamedFields(_Model): - """Contains fields of the same type that have different XML representation. + """§1.3, §2.3 — Contains fields of the same type that have different XML representation. :ivar input_data: Required. :vartype input_data: ~payload.xml.models.SimpleModel @@ -411,8 +678,185 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ModelWithRenamedNestedModel(_Model): + """§2.2 — Contains a property whose type has. + + :ivar author: Required. + :vartype author: ~payload.xml.models.Author + """ + + author: "_models.Author" = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "author", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedNestedModel", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + author: "_models.Author", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithRenamedProperty(_Model): + """§1.2 — Contains a scalar property with a custom XML name. + + :ivar title: Required. + :vartype title: str + :ivar author: Required. + :vartype author: str + """ + + title: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "renamedTitle", "text": False, "unwrapped": False}, + ) + """Required.""" + author: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "author", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedProperty", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + title: str, + author: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithRenamedUnwrappedModelArray(_Model): + """§4.4 — Contains an unwrapped array of models with a custom item name. + + :ivar items_property: Required. + :vartype items_property: ~payload.xml.models.SimpleModel + """ + + items_property: list["_models.SimpleModel"] = rest_field( + name="items", + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "itemsName": "ModelItem", "name": "ModelItem", "text": False, "unwrapped": True}, + original_tsp_name="items", + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedUnwrappedModelArray", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + items_property: list["_models.SimpleModel"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithRenamedWrappedAndItemModelArray(_Model): + """§4.5 — Contains a wrapped array of models with custom wrapper and item names. + + :ivar books: Required. + :vartype books: ~payload.xml.models.Book + """ + + books: list["_models.Book"] = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "itemsName": "XmlBook", "name": "AllBooks", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedWrappedAndItemModelArray", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + books: list["_models.Book"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithRenamedWrappedModelArray(_Model): + """§4.3 — Contains a wrapped array of models with a custom wrapper name. + + :ivar items_property: Required. + :vartype items_property: ~payload.xml.models.SimpleModel + """ + + items_property: list["_models.SimpleModel"] = rest_field( + name="items", + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "itemsName": "SimpleModel", "name": "AllItems", "text": False, "unwrapped": False}, + original_tsp_name="items", + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedWrappedModelArray", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + items_property: list["_models.SimpleModel"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ModelWithSimpleArrays(_Model): - """Contains fields of arrays of primitive types. + """§3.1 — Contains fields of arrays of primitive types. :ivar colors: Required. :vartype colors: list[str] @@ -453,7 +897,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ModelWithText(_Model): - """Contains an attribute and text. + """§8.1 — Contains an attribute and text. :ivar language: Required. :vartype language: str @@ -494,7 +938,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ModelWithUnwrappedArray(_Model): - """Contains fields of wrapped and unwrapped arrays of primitive types. + """§3.2 — Contains fields of wrapped and unwrapped arrays of primitive types. :ivar colors: Required. :vartype colors: list[str] @@ -534,8 +978,76 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ModelWithUnwrappedModelArray(_Model): + """§4.2 — Contains an unwrapped array of models. + + :ivar items_property: Required. + :vartype items_property: ~payload.xml.models.SimpleModel + """ + + items_property: list["_models.SimpleModel"] = rest_field( + name="items", + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "itemsName": "items", "name": "items", "text": False, "unwrapped": True}, + original_tsp_name="items", + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithUnwrappedModelArray", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + items_property: list["_models.SimpleModel"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithWrappedPrimitiveCustomItemNames(_Model): + """§3.5 — Contains a wrapped primitive array with custom wrapper and item names. + + :ivar tags: Required. + :vartype tags: list[str] + """ + + tags: list[str] = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "itemsName": "ItemName", "name": "ItemsTags", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithWrappedPrimitiveCustomItemNames", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + tags: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class SimpleModel(_Model): - """Contains fields of primitive types. + """§1.1 — Contains fields of primitive types. :ivar name: Required. :vartype name: str diff --git a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/operations/__init__.py b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/operations/__init__.py index 115dd22e44..3ad13f607b 100644 --- a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/operations/__init__.py @@ -13,15 +13,26 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import SimpleModelValueOperations # type: ignore +from ._operations import ModelWithRenamedPropertyValueOperations # type: ignore +from ._operations import ModelWithRenamedFieldsValueOperations # type: ignore +from ._operations import ModelWithNestedModelValueOperations # type: ignore +from ._operations import ModelWithRenamedNestedModelValueOperations # type: ignore from ._operations import ModelWithSimpleArraysValueOperations # type: ignore -from ._operations import ModelWithArrayOfModelValueOperations # type: ignore -from ._operations import ModelWithOptionalFieldValueOperations # type: ignore -from ._operations import ModelWithAttributesValueOperations # type: ignore from ._operations import ModelWithUnwrappedArrayValueOperations # type: ignore from ._operations import ModelWithRenamedArraysValueOperations # type: ignore -from ._operations import ModelWithRenamedFieldsValueOperations # type: ignore -from ._operations import ModelWithEmptyArrayValueOperations # type: ignore +from ._operations import ModelWithWrappedPrimitiveCustomItemNamesValueOperations # type: ignore +from ._operations import ModelWithArrayOfModelValueOperations # type: ignore +from ._operations import ModelWithUnwrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedWrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedUnwrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedWrappedAndItemModelArrayValueOperations # type: ignore +from ._operations import ModelWithAttributesValueOperations # type: ignore +from ._operations import ModelWithRenamedAttributeValueOperations # type: ignore +from ._operations import ModelWithNamespaceValueOperations # type: ignore +from ._operations import ModelWithNamespaceOnPropertiesValueOperations # type: ignore from ._operations import ModelWithTextValueOperations # type: ignore +from ._operations import ModelWithOptionalFieldValueOperations # type: ignore +from ._operations import ModelWithEmptyArrayValueOperations # type: ignore from ._operations import ModelWithDictionaryValueOperations # type: ignore from ._operations import ModelWithEncodedNamesValueOperations # type: ignore from ._operations import ModelWithEnumValueOperations # type: ignore @@ -34,15 +45,26 @@ __all__ = [ "SimpleModelValueOperations", + "ModelWithRenamedPropertyValueOperations", + "ModelWithRenamedFieldsValueOperations", + "ModelWithNestedModelValueOperations", + "ModelWithRenamedNestedModelValueOperations", "ModelWithSimpleArraysValueOperations", - "ModelWithArrayOfModelValueOperations", - "ModelWithOptionalFieldValueOperations", - "ModelWithAttributesValueOperations", "ModelWithUnwrappedArrayValueOperations", "ModelWithRenamedArraysValueOperations", - "ModelWithRenamedFieldsValueOperations", - "ModelWithEmptyArrayValueOperations", + "ModelWithWrappedPrimitiveCustomItemNamesValueOperations", + "ModelWithArrayOfModelValueOperations", + "ModelWithUnwrappedModelArrayValueOperations", + "ModelWithRenamedWrappedModelArrayValueOperations", + "ModelWithRenamedUnwrappedModelArrayValueOperations", + "ModelWithRenamedWrappedAndItemModelArrayValueOperations", + "ModelWithAttributesValueOperations", + "ModelWithRenamedAttributeValueOperations", + "ModelWithNamespaceValueOperations", + "ModelWithNamespaceOnPropertiesValueOperations", "ModelWithTextValueOperations", + "ModelWithOptionalFieldValueOperations", + "ModelWithEmptyArrayValueOperations", "ModelWithDictionaryValueOperations", "ModelWithEncodedNamesValueOperations", "ModelWithEnumValueOperations", diff --git a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/operations/_operations.py index 819e462116..723c5df59b 100644 --- a/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-xml/payload/xml/operations/_operations.py @@ -64,13 +64,13 @@ def build_simple_model_value_put_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_simple_arrays_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_property_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithSimpleArrays" + _url = "/payload/xml/modelWithRenamedProperty" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -78,12 +78,12 @@ def build_model_with_simple_arrays_value_get_request(**kwargs: Any) -> HttpReque return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_simple_arrays_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_property_value_put_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 = "/payload/xml/modelWithSimpleArrays" + _url = "/payload/xml/modelWithRenamedProperty" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -91,13 +91,13 @@ def build_model_with_simple_arrays_value_put_request(**kwargs: Any) -> HttpReque return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_array_of_model_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_fields_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithArrayOfModel" + _url = "/payload/xml/modelWithRenamedFields" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -105,12 +105,12 @@ def build_model_with_array_of_model_value_get_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_array_of_model_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_fields_value_put_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 = "/payload/xml/modelWithArrayOfModel" + _url = "/payload/xml/modelWithRenamedFields" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -118,13 +118,13 @@ def build_model_with_array_of_model_value_put_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_optional_field_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_nested_model_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithOptionalField" + _url = "/payload/xml/modelWithNestedModel" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -132,12 +132,12 @@ def build_model_with_optional_field_value_get_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_optional_field_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_nested_model_value_put_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 = "/payload/xml/modelWithOptionalField" + _url = "/payload/xml/modelWithNestedModel" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -145,13 +145,15 @@ def build_model_with_optional_field_value_put_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_attributes_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_nested_model_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithAttributes" + _url = "/payload/xml/modelWithRenamedNestedModel" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -159,12 +161,41 @@ def build_model_with_attributes_value_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_attributes_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_nested_model_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: str = kwargs.pop("content_type") # Construct URL - _url = "/payload/xml/modelWithAttributes" + _url = "/payload/xml/modelWithRenamedNestedModel" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_simple_arrays_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithSimpleArrays" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_simple_arrays_value_put_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 = "/payload/xml/modelWithSimpleArrays" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -226,13 +257,15 @@ def build_model_with_renamed_arrays_value_put_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_renamed_fields_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_wrapped_primitive_custom_item_names_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithRenamedFields" + _url = "/payload/xml/modelWithWrappedPrimitiveCustomItemNames" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -240,12 +273,14 @@ def build_model_with_renamed_fields_value_get_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_renamed_fields_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_wrapped_primitive_custom_item_names_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: str = kwargs.pop("content_type") # Construct URL - _url = "/payload/xml/modelWithRenamedFields" + _url = "/payload/xml/modelWithWrappedPrimitiveCustomItemNames" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -253,13 +288,13 @@ def build_model_with_renamed_fields_value_put_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_empty_array_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_array_of_model_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithEmptyArray" + _url = "/payload/xml/modelWithArrayOfModel" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -267,12 +302,12 @@ def build_model_with_empty_array_value_get_request(**kwargs: Any) -> HttpRequest return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_empty_array_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_array_of_model_value_put_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 = "/payload/xml/modelWithEmptyArray" + _url = "/payload/xml/modelWithArrayOfModel" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -280,13 +315,15 @@ def build_model_with_empty_array_value_put_request(**kwargs: Any) -> HttpRequest return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_text_value_get_request(**kwargs: Any) -> HttpRequest: +def build_model_with_unwrapped_model_array_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithText" + _url = "/payload/xml/modelWithUnwrappedModelArray" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -294,12 +331,14 @@ def build_model_with_text_value_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_text_value_put_request(**kwargs: Any) -> HttpRequest: +def build_model_with_unwrapped_model_array_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: str = kwargs.pop("content_type") # Construct URL - _url = "/payload/xml/modelWithText" + _url = "/payload/xml/modelWithUnwrappedModelArray" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -307,13 +346,15 @@ def build_model_with_text_value_put_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_dictionary_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_wrapped_model_array_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithDictionary" + _url = "/payload/xml/modelWithRenamedWrappedModelArray" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -321,12 +362,14 @@ def build_model_with_dictionary_value_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_dictionary_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_wrapped_model_array_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: str = kwargs.pop("content_type") # Construct URL - _url = "/payload/xml/modelWithDictionary" + _url = "/payload/xml/modelWithRenamedWrappedModelArray" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -334,13 +377,15 @@ def build_model_with_dictionary_value_put_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_encoded_names_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_unwrapped_model_array_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithEncodedNames" + _url = "/payload/xml/modelWithRenamedUnwrappedModelArray" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -348,12 +393,14 @@ def build_model_with_encoded_names_value_get_request(**kwargs: Any) -> HttpReque return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_encoded_names_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_unwrapped_model_array_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: str = kwargs.pop("content_type") # Construct URL - _url = "/payload/xml/modelWithEncodedNames" + _url = "/payload/xml/modelWithRenamedUnwrappedModelArray" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -361,13 +408,15 @@ def build_model_with_encoded_names_value_put_request(**kwargs: Any) -> HttpReque return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_enum_value_get_request(**kwargs: Any) -> HttpRequest: +def build_model_with_renamed_wrapped_and_item_model_array_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithEnum" + _url = "/payload/xml/modelWithRenamedWrappedAndItemModelArray" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -375,68 +424,1787 @@ def build_model_with_enum_value_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_enum_value_put_request(**kwargs: Any) -> HttpRequest: +def build_model_with_renamed_wrapped_and_item_model_array_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: str = kwargs.pop("content_type") # Construct URL - _url = "/payload/xml/modelWithEnum" + _url = "/payload/xml/modelWithRenamedWrappedAndItemModelArray" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_attributes_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithAttributes" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_attributes_value_put_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 = "/payload/xml/modelWithAttributes" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_renamed_attribute_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithRenamedAttribute" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_renamed_attribute_value_put_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 = "/payload/xml/modelWithRenamedAttribute" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_namespace_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithNamespace" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_namespace_value_put_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 = "/payload/xml/modelWithNamespace" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_namespace_on_properties_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithNamespaceOnProperties" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_namespace_on_properties_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/payload/xml/modelWithNamespaceOnProperties" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_text_value_get_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithText" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_text_value_put_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/payload/xml/modelWithText" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_optional_field_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithOptionalField" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_optional_field_value_put_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 = "/payload/xml/modelWithOptionalField" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_empty_array_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithEmptyArray" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_empty_array_value_put_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 = "/payload/xml/modelWithEmptyArray" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_dictionary_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithDictionary" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_dictionary_value_put_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 = "/payload/xml/modelWithDictionary" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_encoded_names_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithEncodedNames" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_encoded_names_value_put_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 = "/payload/xml/modelWithEncodedNames" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_enum_value_get_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithEnum" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_enum_value_put_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/payload/xml/modelWithEnum" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_datetime_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithDatetime" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_datetime_value_put_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 = "/payload/xml/modelWithDatetime" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_xml_error_value_get_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/error" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +class SimpleModelValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`simple_model_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.SimpleModel: + """get. + + :return: SimpleModel. The SimpleModel is compatible with MutableMapping + :rtype: ~payload.xml.models.SimpleModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SimpleModel] = kwargs.pop("cls", None) + + _request = build_simple_model_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.SimpleModel, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def put(self, input: _models.SimpleModel, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """put. + + :param input: Required. + :type input: ~payload.xml.models.SimpleModel + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_simple_model_value_put_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 ModelWithRenamedPropertyValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_renamed_property_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithRenamedProperty: + """get. + + :return: ModelWithRenamedProperty. The ModelWithRenamedProperty is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedProperty + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedProperty] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_property_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedProperty, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithRenamedProperty, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedProperty + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_property_value_put_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 ModelWithRenamedFieldsValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_renamed_fields_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: + """get. + + :return: ModelWithRenamedFields. The ModelWithRenamedFields is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedFields + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedFields] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_fields_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedFields, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithRenamedFields, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedFields + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_fields_value_put_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 ModelWithNestedModelValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_nested_model_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithNestedModel: + """get. + + :return: ModelWithNestedModel. The ModelWithNestedModel is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithNestedModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithNestedModel] = kwargs.pop("cls", None) + + _request = build_model_with_nested_model_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithNestedModel, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithNestedModel, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithNestedModel + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_nested_model_value_put_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 ModelWithRenamedNestedModelValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_renamed_nested_model_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithRenamedNestedModel: + """get. + + :return: ModelWithRenamedNestedModel. The ModelWithRenamedNestedModel is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedNestedModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedNestedModel] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_nested_model_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedNestedModel, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithRenamedNestedModel, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedNestedModel + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_nested_model_value_put_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 ModelWithSimpleArraysValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_simple_arrays_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: + """get. + + :return: ModelWithSimpleArrays. The ModelWithSimpleArrays is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithSimpleArrays + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithSimpleArrays] = kwargs.pop("cls", None) + + _request = build_model_with_simple_arrays_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithSimpleArrays, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithSimpleArrays, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithSimpleArrays + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_simple_arrays_value_put_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 ModelWithUnwrappedArrayValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_unwrapped_array_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithUnwrappedArray: + """get. + + :return: ModelWithUnwrappedArray. The ModelWithUnwrappedArray is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithUnwrappedArray + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithUnwrappedArray] = kwargs.pop("cls", None) + + _request = build_model_with_unwrapped_array_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithUnwrappedArray, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithUnwrappedArray, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithUnwrappedArray + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_unwrapped_array_value_put_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 ModelWithRenamedArraysValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_renamed_arrays_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithRenamedArrays: + """get. + + :return: ModelWithRenamedArrays. The ModelWithRenamedArrays is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedArrays + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedArrays] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_arrays_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedArrays, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithRenamedArrays, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedArrays + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_arrays_value_put_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 ModelWithWrappedPrimitiveCustomItemNamesValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_wrapped_primitive_custom_item_names_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithWrappedPrimitiveCustomItemNames: + """get. + + :return: ModelWithWrappedPrimitiveCustomItemNames. The ModelWithWrappedPrimitiveCustomItemNames + is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithWrappedPrimitiveCustomItemNames + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithWrappedPrimitiveCustomItemNames] = kwargs.pop("cls", None) + + _request = build_model_with_wrapped_primitive_custom_item_names_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithWrappedPrimitiveCustomItemNames, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithWrappedPrimitiveCustomItemNames, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithWrappedPrimitiveCustomItemNames + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_wrapped_primitive_custom_item_names_value_put_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 ModelWithArrayOfModelValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_array_of_model_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: + """get. + + :return: ModelWithArrayOfModel. The ModelWithArrayOfModel is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithArrayOfModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithArrayOfModel] = kwargs.pop("cls", None) + + _request = build_model_with_array_of_model_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithArrayOfModel, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithArrayOfModel, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithArrayOfModel + :return: None + :rtype: None + :raises ~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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_array_of_model_value_put_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 ModelWithUnwrappedModelArrayValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_unwrapped_model_array_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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 get(self, **kwargs: Any) -> _models.ModelWithUnwrappedModelArray: + """get. + + :return: ModelWithUnwrappedModelArray. The ModelWithUnwrappedModelArray is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithUnwrappedModelArray + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + cls: ClsType[_models.ModelWithUnwrappedModelArray] = kwargs.pop("cls", None) + _request = build_model_with_unwrapped_model_array_value_get_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) -def build_model_with_datetime_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - accept = _headers.pop("Accept", "application/xml") + response = pipeline_response.http_response - # Construct URL - _url = "/payload/xml/modelWithDatetime" + 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) - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithUnwrappedModelArray, response.text()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore -def build_model_with_datetime_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + return deserialized # type: ignore - content_type: str = kwargs.pop("content_type") - # Construct URL - _url = "/payload/xml/modelWithDatetime" + @distributed_trace + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithUnwrappedModelArray, **kwargs: Any + ) -> None: + """put. - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + :param input: Required. + :type input: ~payload.xml.models.ModelWithUnwrappedModelArray + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + _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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) -def build_xml_error_value_get_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _content = _get_element(input) - accept = _headers.pop("Accept", "application/xml") + _request = build_model_with_unwrapped_model_array_value_put_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) - # Construct URL - _url = "/payload/xml/error" + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + response = pipeline_response.http_response - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + if response.status_code not in [204]: + map_error(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 SimpleModelValueOperations: + +class ModelWithRenamedWrappedModelArrayValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`simple_model_value` attribute. + :attr:`model_with_renamed_wrapped_model_array_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -447,11 +2215,12 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, **kwargs: Any) -> _models.SimpleModel: + def get(self, **kwargs: Any) -> _models.ModelWithRenamedWrappedModelArray: """get. - :return: SimpleModel. The SimpleModel is compatible with MutableMapping - :rtype: ~payload.xml.models.SimpleModel + :return: ModelWithRenamedWrappedModelArray. The ModelWithRenamedWrappedModelArray is compatible + with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedWrappedModelArray :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -465,9 +2234,9 @@ def get(self, **kwargs: Any) -> _models.SimpleModel: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SimpleModel] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedWrappedModelArray] = kwargs.pop("cls", None) - _request = build_simple_model_value_get_request( + _request = build_model_with_renamed_wrapped_model_array_value_get_request( headers=_headers, params=_params, ) @@ -499,7 +2268,7 @@ def get(self, **kwargs: Any) -> _models.SimpleModel: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.SimpleModel, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedWrappedModelArray, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -507,11 +2276,13 @@ def get(self, **kwargs: Any) -> _models.SimpleModel: return deserialized # type: ignore @distributed_trace - def put(self, input: _models.SimpleModel, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithRenamedWrappedModelArray, **kwargs: Any + ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.SimpleModel + :type input: ~payload.xml.models.ModelWithRenamedWrappedModelArray :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -532,7 +2303,7 @@ def put(self, input: _models.SimpleModel, **kwargs: Any) -> None: # pylint: dis _content = _get_element(input) - _request = build_simple_model_value_put_request( + _request = build_model_with_renamed_wrapped_model_array_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -558,14 +2329,14 @@ def put(self, input: _models.SimpleModel, **kwargs: Any) -> None: # pylint: dis return cls(pipeline_response, None, {}) # type: ignore -class ModelWithSimpleArraysValueOperations: +class ModelWithRenamedUnwrappedModelArrayValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_simple_arrays_value` attribute. + :attr:`model_with_renamed_unwrapped_model_array_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -576,11 +2347,12 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: + def get(self, **kwargs: Any) -> _models.ModelWithRenamedUnwrappedModelArray: """get. - :return: ModelWithSimpleArrays. The ModelWithSimpleArrays is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithSimpleArrays + :return: ModelWithRenamedUnwrappedModelArray. The ModelWithRenamedUnwrappedModelArray is + compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedUnwrappedModelArray :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -594,9 +2366,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithSimpleArrays] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedUnwrappedModelArray] = kwargs.pop("cls", None) - _request = build_model_with_simple_arrays_value_get_request( + _request = build_model_with_renamed_unwrapped_model_array_value_get_request( headers=_headers, params=_params, ) @@ -628,7 +2400,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithSimpleArrays, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedUnwrappedModelArray, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -637,12 +2409,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: @distributed_trace def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithSimpleArrays, **kwargs: Any + self, input: _models.ModelWithRenamedUnwrappedModelArray, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithSimpleArrays + :type input: ~payload.xml.models.ModelWithRenamedUnwrappedModelArray :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -663,7 +2435,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_simple_arrays_value_put_request( + _request = build_model_with_renamed_unwrapped_model_array_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -689,14 +2461,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithArrayOfModelValueOperations: +class ModelWithRenamedWrappedAndItemModelArrayValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_array_of_model_value` attribute. + :attr:`model_with_renamed_wrapped_and_item_model_array_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -707,11 +2479,12 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: + def get(self, **kwargs: Any) -> _models.ModelWithRenamedWrappedAndItemModelArray: """get. - :return: ModelWithArrayOfModel. The ModelWithArrayOfModel is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithArrayOfModel + :return: ModelWithRenamedWrappedAndItemModelArray. The ModelWithRenamedWrappedAndItemModelArray + is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedWrappedAndItemModelArray :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -725,9 +2498,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithArrayOfModel] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedWrappedAndItemModelArray] = kwargs.pop("cls", None) - _request = build_model_with_array_of_model_value_get_request( + _request = build_model_with_renamed_wrapped_and_item_model_array_value_get_request( headers=_headers, params=_params, ) @@ -759,7 +2532,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithArrayOfModel, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedWrappedAndItemModelArray, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -768,12 +2541,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: @distributed_trace def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithArrayOfModel, **kwargs: Any + self, input: _models.ModelWithRenamedWrappedAndItemModelArray, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithArrayOfModel + :type input: ~payload.xml.models.ModelWithRenamedWrappedAndItemModelArray :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -794,7 +2567,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_array_of_model_value_put_request( + _request = build_model_with_renamed_wrapped_and_item_model_array_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -820,14 +2593,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithOptionalFieldValueOperations: +class ModelWithAttributesValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_optional_field_value` attribute. + :attr:`model_with_attributes_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -838,11 +2611,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: + def get(self, **kwargs: Any) -> _models.ModelWithAttributes: """get. - :return: ModelWithOptionalField. The ModelWithOptionalField is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithOptionalField + :return: ModelWithAttributes. The ModelWithAttributes is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithAttributes :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -856,9 +2629,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithOptionalField] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithAttributes] = kwargs.pop("cls", None) - _request = build_model_with_optional_field_value_get_request( + _request = build_model_with_attributes_value_get_request( headers=_headers, params=_params, ) @@ -890,7 +2663,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithOptionalField, response.text()) + deserialized = _deserialize_xml(_models.ModelWithAttributes, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -899,12 +2672,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: @distributed_trace def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithOptionalField, **kwargs: Any + self, input: _models.ModelWithAttributes, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithOptionalField + :type input: ~payload.xml.models.ModelWithAttributes :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -925,7 +2698,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_optional_field_value_put_request( + _request = build_model_with_attributes_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -951,14 +2724,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithAttributesValueOperations: +class ModelWithRenamedAttributeValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_attributes_value` attribute. + :attr:`model_with_renamed_attribute_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -969,11 +2742,12 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, **kwargs: Any) -> _models.ModelWithAttributes: + def get(self, **kwargs: Any) -> _models.ModelWithRenamedAttribute: """get. - :return: ModelWithAttributes. The ModelWithAttributes is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithAttributes + :return: ModelWithRenamedAttribute. The ModelWithRenamedAttribute is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedAttribute :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -987,9 +2761,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithAttributes: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithAttributes] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedAttribute] = kwargs.pop("cls", None) - _request = build_model_with_attributes_value_get_request( + _request = build_model_with_renamed_attribute_value_get_request( headers=_headers, params=_params, ) @@ -1021,7 +2795,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithAttributes: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithAttributes, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedAttribute, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1030,12 +2804,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithAttributes: @distributed_trace def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithAttributes, **kwargs: Any + self, input: _models.ModelWithRenamedAttribute, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithAttributes + :type input: ~payload.xml.models.ModelWithRenamedAttribute :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1056,7 +2830,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_attributes_value_put_request( + _request = build_model_with_renamed_attribute_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1082,14 +2856,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithUnwrappedArrayValueOperations: +class ModelWithNamespaceValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_unwrapped_array_value` attribute. + :attr:`model_with_namespace_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1100,11 +2874,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedArray: + def get(self, **kwargs: Any) -> _models.ModelWithNamespace: """get. - :return: ModelWithUnwrappedArray. The ModelWithUnwrappedArray is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithUnwrappedArray + :return: ModelWithNamespace. The ModelWithNamespace is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithNamespace :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1118,9 +2892,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedArray: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithUnwrappedArray] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithNamespace] = kwargs.pop("cls", None) - _request = build_model_with_unwrapped_array_value_get_request( + _request = build_model_with_namespace_value_get_request( headers=_headers, params=_params, ) @@ -1152,7 +2926,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedArray: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithUnwrappedArray, response.text()) + deserialized = _deserialize_xml(_models.ModelWithNamespace, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1161,12 +2935,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedArray: @distributed_trace def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithUnwrappedArray, **kwargs: Any + self, input: _models.ModelWithNamespace, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithUnwrappedArray + :type input: ~payload.xml.models.ModelWithNamespace :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1187,7 +2961,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_unwrapped_array_value_put_request( + _request = build_model_with_namespace_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1213,14 +2987,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithRenamedArraysValueOperations: +class ModelWithNamespaceOnPropertiesValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_renamed_arrays_value` attribute. + :attr:`model_with_namespace_on_properties_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1231,11 +3005,12 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, **kwargs: Any) -> _models.ModelWithRenamedArrays: + def get(self, **kwargs: Any) -> _models.ModelWithNamespaceOnProperties: """get. - :return: ModelWithRenamedArrays. The ModelWithRenamedArrays is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithRenamedArrays + :return: ModelWithNamespaceOnProperties. The ModelWithNamespaceOnProperties is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithNamespaceOnProperties :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1249,9 +3024,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedArrays: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithRenamedArrays] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithNamespaceOnProperties] = kwargs.pop("cls", None) - _request = build_model_with_renamed_arrays_value_get_request( + _request = build_model_with_namespace_on_properties_value_get_request( headers=_headers, params=_params, ) @@ -1283,7 +3058,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedArrays: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithRenamedArrays, response.text()) + deserialized = _deserialize_xml(_models.ModelWithNamespaceOnProperties, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1292,12 +3067,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedArrays: @distributed_trace def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithRenamedArrays, **kwargs: Any + self, input: _models.ModelWithNamespaceOnProperties, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithRenamedArrays + :type input: ~payload.xml.models.ModelWithNamespaceOnProperties :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1318,7 +3093,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_renamed_arrays_value_put_request( + _request = build_model_with_namespace_on_properties_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1344,14 +3119,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithRenamedFieldsValueOperations: +class ModelWithTextValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_renamed_fields_value` attribute. + :attr:`model_with_text_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1362,11 +3137,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: + def get(self, **kwargs: Any) -> _models.ModelWithText: """get. - :return: ModelWithRenamedFields. The ModelWithRenamedFields is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithRenamedFields + :return: ModelWithText. The ModelWithText is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithText :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1380,9 +3155,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithRenamedFields] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithText] = kwargs.pop("cls", None) - _request = build_model_with_renamed_fields_value_get_request( + _request = build_model_with_text_value_get_request( headers=_headers, params=_params, ) @@ -1414,7 +3189,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithRenamedFields, response.text()) + deserialized = _deserialize_xml(_models.ModelWithText, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1423,12 +3198,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: @distributed_trace def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithRenamedFields, **kwargs: Any + self, input: _models.ModelWithText, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithRenamedFields + :type input: ~payload.xml.models.ModelWithText :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1449,7 +3224,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_renamed_fields_value_put_request( + _request = build_model_with_text_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1475,14 +3250,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithEmptyArrayValueOperations: +class ModelWithOptionalFieldValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_empty_array_value` attribute. + :attr:`model_with_optional_field_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1493,11 +3268,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: + def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: """get. - :return: ModelWithEmptyArray. The ModelWithEmptyArray is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithEmptyArray + :return: ModelWithOptionalField. The ModelWithOptionalField is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithOptionalField :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1511,9 +3286,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithEmptyArray] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithOptionalField] = kwargs.pop("cls", None) - _request = build_model_with_empty_array_value_get_request( + _request = build_model_with_optional_field_value_get_request( headers=_headers, params=_params, ) @@ -1545,7 +3320,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithEmptyArray, response.text()) + deserialized = _deserialize_xml(_models.ModelWithOptionalField, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1554,12 +3329,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: @distributed_trace def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithEmptyArray, **kwargs: Any + self, input: _models.ModelWithOptionalField, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithEmptyArray + :type input: ~payload.xml.models.ModelWithOptionalField :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1580,7 +3355,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_empty_array_value_put_request( + _request = build_model_with_optional_field_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1606,14 +3381,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithTextValueOperations: +class ModelWithEmptyArrayValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_text_value` attribute. + :attr:`model_with_empty_array_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1624,11 +3399,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, **kwargs: Any) -> _models.ModelWithText: + def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: """get. - :return: ModelWithText. The ModelWithText is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithText + :return: ModelWithEmptyArray. The ModelWithEmptyArray is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithEmptyArray :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1642,9 +3417,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithText: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithText] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithEmptyArray] = kwargs.pop("cls", None) - _request = build_model_with_text_value_get_request( + _request = build_model_with_empty_array_value_get_request( headers=_headers, params=_params, ) @@ -1676,7 +3451,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithText: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithText, response.text()) + deserialized = _deserialize_xml(_models.ModelWithEmptyArray, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1685,12 +3460,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithText: @distributed_trace def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithText, **kwargs: Any + self, input: _models.ModelWithEmptyArray, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithText + :type input: ~payload.xml.models.ModelWithEmptyArray :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1711,7 +3486,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_text_value_put_request( + _request = build_model_with_empty_array_value_put_request( content_type=content_type, content=_content, headers=_headers, diff --git a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/_client.py b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/_client.py index 84aa0595c5..c10596c721 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/_client.py +++ b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/_client.py @@ -17,12 +17,23 @@ ModelWithEmptyArrayValueOperations, ModelWithEncodedNamesValueOperations, ModelWithEnumValueOperations, + ModelWithNamespaceOnPropertiesValueOperations, + ModelWithNamespaceValueOperations, + ModelWithNestedModelValueOperations, ModelWithOptionalFieldValueOperations, ModelWithRenamedArraysValueOperations, + ModelWithRenamedAttributeValueOperations, ModelWithRenamedFieldsValueOperations, + ModelWithRenamedNestedModelValueOperations, + ModelWithRenamedPropertyValueOperations, + ModelWithRenamedUnwrappedModelArrayValueOperations, + ModelWithRenamedWrappedAndItemModelArrayValueOperations, + ModelWithRenamedWrappedModelArrayValueOperations, ModelWithSimpleArraysValueOperations, ModelWithTextValueOperations, ModelWithUnwrappedArrayValueOperations, + ModelWithUnwrappedModelArrayValueOperations, + ModelWithWrappedPrimitiveCustomItemNamesValueOperations, SimpleModelValueOperations, XmlErrorValueOperations, ) @@ -33,31 +44,70 @@ class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many- :ivar simple_model_value: SimpleModelValueOperations operations :vartype simple_model_value: payload.xml.operations.SimpleModelValueOperations + :ivar model_with_renamed_property_value: ModelWithRenamedPropertyValueOperations operations + :vartype model_with_renamed_property_value: + payload.xml.operations.ModelWithRenamedPropertyValueOperations + :ivar model_with_renamed_fields_value: ModelWithRenamedFieldsValueOperations operations + :vartype model_with_renamed_fields_value: + payload.xml.operations.ModelWithRenamedFieldsValueOperations + :ivar model_with_nested_model_value: ModelWithNestedModelValueOperations operations + :vartype model_with_nested_model_value: + payload.xml.operations.ModelWithNestedModelValueOperations + :ivar model_with_renamed_nested_model_value: ModelWithRenamedNestedModelValueOperations + operations + :vartype model_with_renamed_nested_model_value: + payload.xml.operations.ModelWithRenamedNestedModelValueOperations :ivar model_with_simple_arrays_value: ModelWithSimpleArraysValueOperations operations :vartype model_with_simple_arrays_value: payload.xml.operations.ModelWithSimpleArraysValueOperations - :ivar model_with_array_of_model_value: ModelWithArrayOfModelValueOperations operations - :vartype model_with_array_of_model_value: - payload.xml.operations.ModelWithArrayOfModelValueOperations - :ivar model_with_optional_field_value: ModelWithOptionalFieldValueOperations operations - :vartype model_with_optional_field_value: - payload.xml.operations.ModelWithOptionalFieldValueOperations - :ivar model_with_attributes_value: ModelWithAttributesValueOperations operations - :vartype model_with_attributes_value: payload.xml.operations.ModelWithAttributesValueOperations :ivar model_with_unwrapped_array_value: ModelWithUnwrappedArrayValueOperations operations :vartype model_with_unwrapped_array_value: payload.xml.operations.ModelWithUnwrappedArrayValueOperations :ivar model_with_renamed_arrays_value: ModelWithRenamedArraysValueOperations operations :vartype model_with_renamed_arrays_value: payload.xml.operations.ModelWithRenamedArraysValueOperations - :ivar model_with_renamed_fields_value: ModelWithRenamedFieldsValueOperations operations - :vartype model_with_renamed_fields_value: - payload.xml.operations.ModelWithRenamedFieldsValueOperations + :ivar model_with_wrapped_primitive_custom_item_names_value: + ModelWithWrappedPrimitiveCustomItemNamesValueOperations operations + :vartype model_with_wrapped_primitive_custom_item_names_value: + payload.xml.operations.ModelWithWrappedPrimitiveCustomItemNamesValueOperations + :ivar model_with_array_of_model_value: ModelWithArrayOfModelValueOperations operations + :vartype model_with_array_of_model_value: + payload.xml.operations.ModelWithArrayOfModelValueOperations + :ivar model_with_unwrapped_model_array_value: ModelWithUnwrappedModelArrayValueOperations + operations + :vartype model_with_unwrapped_model_array_value: + payload.xml.operations.ModelWithUnwrappedModelArrayValueOperations + :ivar model_with_renamed_wrapped_model_array_value: + ModelWithRenamedWrappedModelArrayValueOperations operations + :vartype model_with_renamed_wrapped_model_array_value: + payload.xml.operations.ModelWithRenamedWrappedModelArrayValueOperations + :ivar model_with_renamed_unwrapped_model_array_value: + ModelWithRenamedUnwrappedModelArrayValueOperations operations + :vartype model_with_renamed_unwrapped_model_array_value: + payload.xml.operations.ModelWithRenamedUnwrappedModelArrayValueOperations + :ivar model_with_renamed_wrapped_and_item_model_array_value: + ModelWithRenamedWrappedAndItemModelArrayValueOperations operations + :vartype model_with_renamed_wrapped_and_item_model_array_value: + payload.xml.operations.ModelWithRenamedWrappedAndItemModelArrayValueOperations + :ivar model_with_attributes_value: ModelWithAttributesValueOperations operations + :vartype model_with_attributes_value: payload.xml.operations.ModelWithAttributesValueOperations + :ivar model_with_renamed_attribute_value: ModelWithRenamedAttributeValueOperations operations + :vartype model_with_renamed_attribute_value: + payload.xml.operations.ModelWithRenamedAttributeValueOperations + :ivar model_with_namespace_value: ModelWithNamespaceValueOperations operations + :vartype model_with_namespace_value: payload.xml.operations.ModelWithNamespaceValueOperations + :ivar model_with_namespace_on_properties_value: ModelWithNamespaceOnPropertiesValueOperations + operations + :vartype model_with_namespace_on_properties_value: + payload.xml.operations.ModelWithNamespaceOnPropertiesValueOperations + :ivar model_with_text_value: ModelWithTextValueOperations operations + :vartype model_with_text_value: payload.xml.operations.ModelWithTextValueOperations + :ivar model_with_optional_field_value: ModelWithOptionalFieldValueOperations operations + :vartype model_with_optional_field_value: + payload.xml.operations.ModelWithOptionalFieldValueOperations :ivar model_with_empty_array_value: ModelWithEmptyArrayValueOperations operations :vartype model_with_empty_array_value: payload.xml.operations.ModelWithEmptyArrayValueOperations - :ivar model_with_text_value: ModelWithTextValueOperations operations - :vartype model_with_text_value: payload.xml.operations.ModelWithTextValueOperations :ivar model_with_dictionary_value: ModelWithDictionaryValueOperations operations :vartype model_with_dictionary_value: payload.xml.operations.ModelWithDictionaryValueOperations :ivar model_with_encoded_names_value: ModelWithEncodedNamesValueOperations operations @@ -98,16 +148,19 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.simple_model_value = SimpleModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_simple_arrays_value = ModelWithSimpleArraysValueOperations( + self.model_with_renamed_property_value = ModelWithRenamedPropertyValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_array_of_model_value = ModelWithArrayOfModelValueOperations( + self.model_with_renamed_fields_value = ModelWithRenamedFieldsValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_optional_field_value = ModelWithOptionalFieldValueOperations( + self.model_with_nested_model_value = ModelWithNestedModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_attributes_value = ModelWithAttributesValueOperations( + self.model_with_renamed_nested_model_value = ModelWithRenamedNestedModelValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_simple_arrays_value = ModelWithSimpleArraysValueOperations( self._client, self._config, self._serialize, self._deserialize ) self.model_with_unwrapped_array_value = ModelWithUnwrappedArrayValueOperations( @@ -116,15 +169,49 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.model_with_renamed_arrays_value = ModelWithRenamedArraysValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_renamed_fields_value = ModelWithRenamedFieldsValueOperations( + self.model_with_wrapped_primitive_custom_item_names_value = ( + ModelWithWrappedPrimitiveCustomItemNamesValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + ) + self.model_with_array_of_model_value = ModelWithArrayOfModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_empty_array_value = ModelWithEmptyArrayValueOperations( + self.model_with_unwrapped_model_array_value = ModelWithUnwrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_wrapped_model_array_value = ModelWithRenamedWrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_unwrapped_model_array_value = ModelWithRenamedUnwrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_wrapped_and_item_model_array_value = ( + ModelWithRenamedWrappedAndItemModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + ) + self.model_with_attributes_value = ModelWithAttributesValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_attribute_value = ModelWithRenamedAttributeValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_namespace_value = ModelWithNamespaceValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_namespace_on_properties_value = ModelWithNamespaceOnPropertiesValueOperations( self._client, self._config, self._serialize, self._deserialize ) self.model_with_text_value = ModelWithTextValueOperations( self._client, self._config, self._serialize, self._deserialize ) + self.model_with_optional_field_value = ModelWithOptionalFieldValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_empty_array_value = ModelWithEmptyArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.model_with_dictionary_value = ModelWithDictionaryValueOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/_client.py b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/_client.py index d935954210..0b10891acd 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/_client.py @@ -17,12 +17,23 @@ ModelWithEmptyArrayValueOperations, ModelWithEncodedNamesValueOperations, ModelWithEnumValueOperations, + ModelWithNamespaceOnPropertiesValueOperations, + ModelWithNamespaceValueOperations, + ModelWithNestedModelValueOperations, ModelWithOptionalFieldValueOperations, ModelWithRenamedArraysValueOperations, + ModelWithRenamedAttributeValueOperations, ModelWithRenamedFieldsValueOperations, + ModelWithRenamedNestedModelValueOperations, + ModelWithRenamedPropertyValueOperations, + ModelWithRenamedUnwrappedModelArrayValueOperations, + ModelWithRenamedWrappedAndItemModelArrayValueOperations, + ModelWithRenamedWrappedModelArrayValueOperations, ModelWithSimpleArraysValueOperations, ModelWithTextValueOperations, ModelWithUnwrappedArrayValueOperations, + ModelWithUnwrappedModelArrayValueOperations, + ModelWithWrappedPrimitiveCustomItemNamesValueOperations, SimpleModelValueOperations, XmlErrorValueOperations, ) @@ -33,32 +44,72 @@ class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many- :ivar simple_model_value: SimpleModelValueOperations operations :vartype simple_model_value: payload.xml.aio.operations.SimpleModelValueOperations + :ivar model_with_renamed_property_value: ModelWithRenamedPropertyValueOperations operations + :vartype model_with_renamed_property_value: + payload.xml.aio.operations.ModelWithRenamedPropertyValueOperations + :ivar model_with_renamed_fields_value: ModelWithRenamedFieldsValueOperations operations + :vartype model_with_renamed_fields_value: + payload.xml.aio.operations.ModelWithRenamedFieldsValueOperations + :ivar model_with_nested_model_value: ModelWithNestedModelValueOperations operations + :vartype model_with_nested_model_value: + payload.xml.aio.operations.ModelWithNestedModelValueOperations + :ivar model_with_renamed_nested_model_value: ModelWithRenamedNestedModelValueOperations + operations + :vartype model_with_renamed_nested_model_value: + payload.xml.aio.operations.ModelWithRenamedNestedModelValueOperations :ivar model_with_simple_arrays_value: ModelWithSimpleArraysValueOperations operations :vartype model_with_simple_arrays_value: payload.xml.aio.operations.ModelWithSimpleArraysValueOperations - :ivar model_with_array_of_model_value: ModelWithArrayOfModelValueOperations operations - :vartype model_with_array_of_model_value: - payload.xml.aio.operations.ModelWithArrayOfModelValueOperations - :ivar model_with_optional_field_value: ModelWithOptionalFieldValueOperations operations - :vartype model_with_optional_field_value: - payload.xml.aio.operations.ModelWithOptionalFieldValueOperations - :ivar model_with_attributes_value: ModelWithAttributesValueOperations operations - :vartype model_with_attributes_value: - payload.xml.aio.operations.ModelWithAttributesValueOperations :ivar model_with_unwrapped_array_value: ModelWithUnwrappedArrayValueOperations operations :vartype model_with_unwrapped_array_value: payload.xml.aio.operations.ModelWithUnwrappedArrayValueOperations :ivar model_with_renamed_arrays_value: ModelWithRenamedArraysValueOperations operations :vartype model_with_renamed_arrays_value: payload.xml.aio.operations.ModelWithRenamedArraysValueOperations - :ivar model_with_renamed_fields_value: ModelWithRenamedFieldsValueOperations operations - :vartype model_with_renamed_fields_value: - payload.xml.aio.operations.ModelWithRenamedFieldsValueOperations + :ivar model_with_wrapped_primitive_custom_item_names_value: + ModelWithWrappedPrimitiveCustomItemNamesValueOperations operations + :vartype model_with_wrapped_primitive_custom_item_names_value: + payload.xml.aio.operations.ModelWithWrappedPrimitiveCustomItemNamesValueOperations + :ivar model_with_array_of_model_value: ModelWithArrayOfModelValueOperations operations + :vartype model_with_array_of_model_value: + payload.xml.aio.operations.ModelWithArrayOfModelValueOperations + :ivar model_with_unwrapped_model_array_value: ModelWithUnwrappedModelArrayValueOperations + operations + :vartype model_with_unwrapped_model_array_value: + payload.xml.aio.operations.ModelWithUnwrappedModelArrayValueOperations + :ivar model_with_renamed_wrapped_model_array_value: + ModelWithRenamedWrappedModelArrayValueOperations operations + :vartype model_with_renamed_wrapped_model_array_value: + payload.xml.aio.operations.ModelWithRenamedWrappedModelArrayValueOperations + :ivar model_with_renamed_unwrapped_model_array_value: + ModelWithRenamedUnwrappedModelArrayValueOperations operations + :vartype model_with_renamed_unwrapped_model_array_value: + payload.xml.aio.operations.ModelWithRenamedUnwrappedModelArrayValueOperations + :ivar model_with_renamed_wrapped_and_item_model_array_value: + ModelWithRenamedWrappedAndItemModelArrayValueOperations operations + :vartype model_with_renamed_wrapped_and_item_model_array_value: + payload.xml.aio.operations.ModelWithRenamedWrappedAndItemModelArrayValueOperations + :ivar model_with_attributes_value: ModelWithAttributesValueOperations operations + :vartype model_with_attributes_value: + payload.xml.aio.operations.ModelWithAttributesValueOperations + :ivar model_with_renamed_attribute_value: ModelWithRenamedAttributeValueOperations operations + :vartype model_with_renamed_attribute_value: + payload.xml.aio.operations.ModelWithRenamedAttributeValueOperations + :ivar model_with_namespace_value: ModelWithNamespaceValueOperations operations + :vartype model_with_namespace_value: + payload.xml.aio.operations.ModelWithNamespaceValueOperations + :ivar model_with_namespace_on_properties_value: ModelWithNamespaceOnPropertiesValueOperations + operations + :vartype model_with_namespace_on_properties_value: + payload.xml.aio.operations.ModelWithNamespaceOnPropertiesValueOperations + :ivar model_with_text_value: ModelWithTextValueOperations operations + :vartype model_with_text_value: payload.xml.aio.operations.ModelWithTextValueOperations + :ivar model_with_optional_field_value: ModelWithOptionalFieldValueOperations operations + :vartype model_with_optional_field_value: + payload.xml.aio.operations.ModelWithOptionalFieldValueOperations :ivar model_with_empty_array_value: ModelWithEmptyArrayValueOperations operations :vartype model_with_empty_array_value: payload.xml.aio.operations.ModelWithEmptyArrayValueOperations - :ivar model_with_text_value: ModelWithTextValueOperations operations - :vartype model_with_text_value: payload.xml.aio.operations.ModelWithTextValueOperations :ivar model_with_dictionary_value: ModelWithDictionaryValueOperations operations :vartype model_with_dictionary_value: payload.xml.aio.operations.ModelWithDictionaryValueOperations @@ -100,16 +151,19 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.simple_model_value = SimpleModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_simple_arrays_value = ModelWithSimpleArraysValueOperations( + self.model_with_renamed_property_value = ModelWithRenamedPropertyValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_array_of_model_value = ModelWithArrayOfModelValueOperations( + self.model_with_renamed_fields_value = ModelWithRenamedFieldsValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_optional_field_value = ModelWithOptionalFieldValueOperations( + self.model_with_nested_model_value = ModelWithNestedModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_attributes_value = ModelWithAttributesValueOperations( + self.model_with_renamed_nested_model_value = ModelWithRenamedNestedModelValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_simple_arrays_value = ModelWithSimpleArraysValueOperations( self._client, self._config, self._serialize, self._deserialize ) self.model_with_unwrapped_array_value = ModelWithUnwrappedArrayValueOperations( @@ -118,15 +172,49 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.model_with_renamed_arrays_value = ModelWithRenamedArraysValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_renamed_fields_value = ModelWithRenamedFieldsValueOperations( + self.model_with_wrapped_primitive_custom_item_names_value = ( + ModelWithWrappedPrimitiveCustomItemNamesValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + ) + self.model_with_array_of_model_value = ModelWithArrayOfModelValueOperations( self._client, self._config, self._serialize, self._deserialize ) - self.model_with_empty_array_value = ModelWithEmptyArrayValueOperations( + self.model_with_unwrapped_model_array_value = ModelWithUnwrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_wrapped_model_array_value = ModelWithRenamedWrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_unwrapped_model_array_value = ModelWithRenamedUnwrappedModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_wrapped_and_item_model_array_value = ( + ModelWithRenamedWrappedAndItemModelArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + ) + self.model_with_attributes_value = ModelWithAttributesValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_renamed_attribute_value = ModelWithRenamedAttributeValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_namespace_value = ModelWithNamespaceValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_namespace_on_properties_value = ModelWithNamespaceOnPropertiesValueOperations( self._client, self._config, self._serialize, self._deserialize ) self.model_with_text_value = ModelWithTextValueOperations( self._client, self._config, self._serialize, self._deserialize ) + self.model_with_optional_field_value = ModelWithOptionalFieldValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.model_with_empty_array_value = ModelWithEmptyArrayValueOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.model_with_dictionary_value = ModelWithDictionaryValueOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/operations/__init__.py b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/operations/__init__.py index 9fb7963fc4..65cf449c47 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/operations/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/operations/__init__.py @@ -7,15 +7,26 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import SimpleModelValueOperations # type: ignore +from ._operations import ModelWithRenamedPropertyValueOperations # type: ignore +from ._operations import ModelWithRenamedFieldsValueOperations # type: ignore +from ._operations import ModelWithNestedModelValueOperations # type: ignore +from ._operations import ModelWithRenamedNestedModelValueOperations # type: ignore from ._operations import ModelWithSimpleArraysValueOperations # type: ignore -from ._operations import ModelWithArrayOfModelValueOperations # type: ignore -from ._operations import ModelWithOptionalFieldValueOperations # type: ignore -from ._operations import ModelWithAttributesValueOperations # type: ignore from ._operations import ModelWithUnwrappedArrayValueOperations # type: ignore from ._operations import ModelWithRenamedArraysValueOperations # type: ignore -from ._operations import ModelWithRenamedFieldsValueOperations # type: ignore -from ._operations import ModelWithEmptyArrayValueOperations # type: ignore +from ._operations import ModelWithWrappedPrimitiveCustomItemNamesValueOperations # type: ignore +from ._operations import ModelWithArrayOfModelValueOperations # type: ignore +from ._operations import ModelWithUnwrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedWrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedUnwrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedWrappedAndItemModelArrayValueOperations # type: ignore +from ._operations import ModelWithAttributesValueOperations # type: ignore +from ._operations import ModelWithRenamedAttributeValueOperations # type: ignore +from ._operations import ModelWithNamespaceValueOperations # type: ignore +from ._operations import ModelWithNamespaceOnPropertiesValueOperations # type: ignore from ._operations import ModelWithTextValueOperations # type: ignore +from ._operations import ModelWithOptionalFieldValueOperations # type: ignore +from ._operations import ModelWithEmptyArrayValueOperations # type: ignore from ._operations import ModelWithDictionaryValueOperations # type: ignore from ._operations import ModelWithEncodedNamesValueOperations # type: ignore from ._operations import ModelWithEnumValueOperations # type: ignore @@ -28,15 +39,26 @@ __all__ = [ "SimpleModelValueOperations", + "ModelWithRenamedPropertyValueOperations", + "ModelWithRenamedFieldsValueOperations", + "ModelWithNestedModelValueOperations", + "ModelWithRenamedNestedModelValueOperations", "ModelWithSimpleArraysValueOperations", - "ModelWithArrayOfModelValueOperations", - "ModelWithOptionalFieldValueOperations", - "ModelWithAttributesValueOperations", "ModelWithUnwrappedArrayValueOperations", "ModelWithRenamedArraysValueOperations", - "ModelWithRenamedFieldsValueOperations", - "ModelWithEmptyArrayValueOperations", + "ModelWithWrappedPrimitiveCustomItemNamesValueOperations", + "ModelWithArrayOfModelValueOperations", + "ModelWithUnwrappedModelArrayValueOperations", + "ModelWithRenamedWrappedModelArrayValueOperations", + "ModelWithRenamedUnwrappedModelArrayValueOperations", + "ModelWithRenamedWrappedAndItemModelArrayValueOperations", + "ModelWithAttributesValueOperations", + "ModelWithRenamedAttributeValueOperations", + "ModelWithNamespaceValueOperations", + "ModelWithNamespaceOnPropertiesValueOperations", "ModelWithTextValueOperations", + "ModelWithOptionalFieldValueOperations", + "ModelWithEmptyArrayValueOperations", "ModelWithDictionaryValueOperations", "ModelWithEncodedNamesValueOperations", "ModelWithEnumValueOperations", diff --git a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/operations/_operations.py index f5d1b1391c..e7ae6502fd 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/aio/operations/_operations.py @@ -36,18 +36,40 @@ build_model_with_encoded_names_value_put_request, build_model_with_enum_value_get_request, build_model_with_enum_value_put_request, + build_model_with_namespace_on_properties_value_get_request, + build_model_with_namespace_on_properties_value_put_request, + build_model_with_namespace_value_get_request, + build_model_with_namespace_value_put_request, + build_model_with_nested_model_value_get_request, + build_model_with_nested_model_value_put_request, build_model_with_optional_field_value_get_request, build_model_with_optional_field_value_put_request, build_model_with_renamed_arrays_value_get_request, build_model_with_renamed_arrays_value_put_request, + build_model_with_renamed_attribute_value_get_request, + build_model_with_renamed_attribute_value_put_request, build_model_with_renamed_fields_value_get_request, build_model_with_renamed_fields_value_put_request, + build_model_with_renamed_nested_model_value_get_request, + build_model_with_renamed_nested_model_value_put_request, + build_model_with_renamed_property_value_get_request, + build_model_with_renamed_property_value_put_request, + build_model_with_renamed_unwrapped_model_array_value_get_request, + build_model_with_renamed_unwrapped_model_array_value_put_request, + build_model_with_renamed_wrapped_and_item_model_array_value_get_request, + build_model_with_renamed_wrapped_and_item_model_array_value_put_request, + build_model_with_renamed_wrapped_model_array_value_get_request, + build_model_with_renamed_wrapped_model_array_value_put_request, build_model_with_simple_arrays_value_get_request, build_model_with_simple_arrays_value_put_request, build_model_with_text_value_get_request, build_model_with_text_value_put_request, build_model_with_unwrapped_array_value_get_request, build_model_with_unwrapped_array_value_put_request, + build_model_with_unwrapped_model_array_value_get_request, + build_model_with_unwrapped_model_array_value_put_request, + build_model_with_wrapped_primitive_custom_item_names_value_get_request, + build_model_with_wrapped_primitive_custom_item_names_value_put_request, build_simple_model_value_get_request, build_simple_model_value_put_request, build_xml_error_value_get_request, @@ -181,14 +203,14 @@ async def put(self, input: _models.SimpleModel, **kwargs: Any) -> None: return cls(pipeline_response, None, {}) # type: ignore -class ModelWithSimpleArraysValueOperations: +class ModelWithRenamedPropertyValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_simple_arrays_value` attribute. + :attr:`model_with_renamed_property_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -198,11 +220,12 @@ 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") - async def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: + async def get(self, **kwargs: Any) -> _models.ModelWithRenamedProperty: """get. - :return: ModelWithSimpleArrays. The ModelWithSimpleArrays is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithSimpleArrays + :return: ModelWithRenamedProperty. The ModelWithRenamedProperty is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedProperty :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -216,9 +239,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithSimpleArrays] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedProperty] = kwargs.pop("cls", None) - _request = build_model_with_simple_arrays_value_get_request( + _request = build_model_with_renamed_property_value_get_request( headers=_headers, params=_params, ) @@ -248,18 +271,18 @@ async def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithSimpleArrays, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedProperty, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def put(self, input: _models.ModelWithSimpleArrays, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithRenamedProperty, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithSimpleArrays + :type input: ~payload.xml.models.ModelWithRenamedProperty :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -280,7 +303,7 @@ async def put(self, input: _models.ModelWithSimpleArrays, **kwargs: Any) -> None _content = _get_element(input) - _request = build_model_with_simple_arrays_value_put_request( + _request = build_model_with_renamed_property_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -304,14 +327,14 @@ async def put(self, input: _models.ModelWithSimpleArrays, **kwargs: Any) -> None return cls(pipeline_response, None, {}) # type: ignore -class ModelWithArrayOfModelValueOperations: +class ModelWithRenamedFieldsValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_array_of_model_value` attribute. + :attr:`model_with_renamed_fields_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -321,11 +344,11 @@ 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") - async def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: + async def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: """get. - :return: ModelWithArrayOfModel. The ModelWithArrayOfModel is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithArrayOfModel + :return: ModelWithRenamedFields. The ModelWithRenamedFields is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedFields :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -339,9 +362,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithArrayOfModel] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedFields] = kwargs.pop("cls", None) - _request = build_model_with_array_of_model_value_get_request( + _request = build_model_with_renamed_fields_value_get_request( headers=_headers, params=_params, ) @@ -371,18 +394,18 @@ async def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithArrayOfModel, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedFields, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def put(self, input: _models.ModelWithArrayOfModel, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithRenamedFields, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithArrayOfModel + :type input: ~payload.xml.models.ModelWithRenamedFields :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -403,7 +426,7 @@ async def put(self, input: _models.ModelWithArrayOfModel, **kwargs: Any) -> None _content = _get_element(input) - _request = build_model_with_array_of_model_value_put_request( + _request = build_model_with_renamed_fields_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -427,14 +450,14 @@ async def put(self, input: _models.ModelWithArrayOfModel, **kwargs: Any) -> None return cls(pipeline_response, None, {}) # type: ignore -class ModelWithOptionalFieldValueOperations: +class ModelWithNestedModelValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_optional_field_value` attribute. + :attr:`model_with_nested_model_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -444,11 +467,11 @@ 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") - async def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: + async def get(self, **kwargs: Any) -> _models.ModelWithNestedModel: """get. - :return: ModelWithOptionalField. The ModelWithOptionalField is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithOptionalField + :return: ModelWithNestedModel. The ModelWithNestedModel is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithNestedModel :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -462,9 +485,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithOptionalField] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithNestedModel] = kwargs.pop("cls", None) - _request = build_model_with_optional_field_value_get_request( + _request = build_model_with_nested_model_value_get_request( headers=_headers, params=_params, ) @@ -494,18 +517,18 @@ async def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithOptionalField, response.text()) + deserialized = _deserialize_xml(_models.ModelWithNestedModel, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def put(self, input: _models.ModelWithOptionalField, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithNestedModel, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithOptionalField + :type input: ~payload.xml.models.ModelWithNestedModel :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -526,7 +549,7 @@ async def put(self, input: _models.ModelWithOptionalField, **kwargs: Any) -> Non _content = _get_element(input) - _request = build_model_with_optional_field_value_put_request( + _request = build_model_with_nested_model_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -550,14 +573,14 @@ async def put(self, input: _models.ModelWithOptionalField, **kwargs: Any) -> Non return cls(pipeline_response, None, {}) # type: ignore -class ModelWithAttributesValueOperations: +class ModelWithRenamedNestedModelValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_attributes_value` attribute. + :attr:`model_with_renamed_nested_model_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -567,11 +590,12 @@ 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") - async def get(self, **kwargs: Any) -> _models.ModelWithAttributes: + async def get(self, **kwargs: Any) -> _models.ModelWithRenamedNestedModel: """get. - :return: ModelWithAttributes. The ModelWithAttributes is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithAttributes + :return: ModelWithRenamedNestedModel. The ModelWithRenamedNestedModel is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedNestedModel :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -585,9 +609,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithAttributes: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithAttributes] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedNestedModel] = kwargs.pop("cls", None) - _request = build_model_with_attributes_value_get_request( + _request = build_model_with_renamed_nested_model_value_get_request( headers=_headers, params=_params, ) @@ -617,18 +641,18 @@ async def get(self, **kwargs: Any) -> _models.ModelWithAttributes: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithAttributes, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedNestedModel, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def put(self, input: _models.ModelWithAttributes, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithRenamedNestedModel, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithAttributes + :type input: ~payload.xml.models.ModelWithRenamedNestedModel :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -649,7 +673,130 @@ async def put(self, input: _models.ModelWithAttributes, **kwargs: Any) -> None: _content = _get_element(input) - _request = build_model_with_attributes_value_put_request( + _request = build_model_with_renamed_nested_model_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithSimpleArraysValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_simple_arrays_value` 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: XmlClientConfiguration = 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") + + async def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: + """get. + + :return: ModelWithSimpleArrays. The ModelWithSimpleArrays is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithSimpleArrays + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithSimpleArrays] = kwargs.pop("cls", None) + + _request = build_model_with_simple_arrays_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithSimpleArrays, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def put(self, input: _models.ModelWithSimpleArrays, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithSimpleArrays + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_simple_arrays_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -919,14 +1066,14 @@ async def put(self, input: _models.ModelWithRenamedArrays, **kwargs: Any) -> Non return cls(pipeline_response, None, {}) # type: ignore -class ModelWithRenamedFieldsValueOperations: +class ModelWithWrappedPrimitiveCustomItemNamesValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_renamed_fields_value` attribute. + :attr:`model_with_wrapped_primitive_custom_item_names_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -936,11 +1083,12 @@ 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") - async def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: + async def get(self, **kwargs: Any) -> _models.ModelWithWrappedPrimitiveCustomItemNames: """get. - :return: ModelWithRenamedFields. The ModelWithRenamedFields is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithRenamedFields + :return: ModelWithWrappedPrimitiveCustomItemNames. The ModelWithWrappedPrimitiveCustomItemNames + is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithWrappedPrimitiveCustomItemNames :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -954,9 +1102,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithRenamedFields] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithWrappedPrimitiveCustomItemNames] = kwargs.pop("cls", None) - _request = build_model_with_renamed_fields_value_get_request( + _request = build_model_with_wrapped_primitive_custom_item_names_value_get_request( headers=_headers, params=_params, ) @@ -986,18 +1134,18 @@ async def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithRenamedFields, response.text()) + deserialized = _deserialize_xml(_models.ModelWithWrappedPrimitiveCustomItemNames, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def put(self, input: _models.ModelWithRenamedFields, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithWrappedPrimitiveCustomItemNames, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithRenamedFields + :type input: ~payload.xml.models.ModelWithWrappedPrimitiveCustomItemNames :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1018,7 +1166,7 @@ async def put(self, input: _models.ModelWithRenamedFields, **kwargs: Any) -> Non _content = _get_element(input) - _request = build_model_with_renamed_fields_value_put_request( + _request = build_model_with_wrapped_primitive_custom_item_names_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1042,14 +1190,14 @@ async def put(self, input: _models.ModelWithRenamedFields, **kwargs: Any) -> Non return cls(pipeline_response, None, {}) # type: ignore -class ModelWithEmptyArrayValueOperations: +class ModelWithArrayOfModelValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_empty_array_value` attribute. + :attr:`model_with_array_of_model_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1059,11 +1207,11 @@ 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") - async def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: + async def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: """get. - :return: ModelWithEmptyArray. The ModelWithEmptyArray is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithEmptyArray + :return: ModelWithArrayOfModel. The ModelWithArrayOfModel is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithArrayOfModel :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1077,9 +1225,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithEmptyArray] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithArrayOfModel] = kwargs.pop("cls", None) - _request = build_model_with_empty_array_value_get_request( + _request = build_model_with_array_of_model_value_get_request( headers=_headers, params=_params, ) @@ -1109,18 +1257,18 @@ async def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithEmptyArray, response.text()) + deserialized = _deserialize_xml(_models.ModelWithArrayOfModel, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def put(self, input: _models.ModelWithEmptyArray, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithArrayOfModel, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithEmptyArray + :type input: ~payload.xml.models.ModelWithArrayOfModel :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1141,7 +1289,7 @@ async def put(self, input: _models.ModelWithEmptyArray, **kwargs: Any) -> None: _content = _get_element(input) - _request = build_model_with_empty_array_value_put_request( + _request = build_model_with_array_of_model_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1165,14 +1313,14 @@ async def put(self, input: _models.ModelWithEmptyArray, **kwargs: Any) -> None: return cls(pipeline_response, None, {}) # type: ignore -class ModelWithTextValueOperations: +class ModelWithUnwrappedModelArrayValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.aio.XmlClient`'s - :attr:`model_with_text_value` attribute. + :attr:`model_with_unwrapped_model_array_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1182,11 +1330,12 @@ 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") - async def get(self, **kwargs: Any) -> _models.ModelWithText: + async def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedModelArray: """get. - :return: ModelWithText. The ModelWithText is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithText + :return: ModelWithUnwrappedModelArray. The ModelWithUnwrappedModelArray is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithUnwrappedModelArray :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1200,9 +1349,9 @@ async def get(self, **kwargs: Any) -> _models.ModelWithText: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithText] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithUnwrappedModelArray] = kwargs.pop("cls", None) - _request = build_model_with_text_value_get_request( + _request = build_model_with_unwrapped_model_array_value_get_request( headers=_headers, params=_params, ) @@ -1232,18 +1381,18 @@ async def get(self, **kwargs: Any) -> _models.ModelWithText: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithText, response.text()) + deserialized = _deserialize_xml(_models.ModelWithUnwrappedModelArray, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def put(self, input: _models.ModelWithText, **kwargs: Any) -> None: + async def put(self, input: _models.ModelWithUnwrappedModelArray, **kwargs: Any) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithText + :type input: ~payload.xml.models.ModelWithUnwrappedModelArray :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1264,7 +1413,1242 @@ async def put(self, input: _models.ModelWithText, **kwargs: Any) -> None: _content = _get_element(input) - _request = build_model_with_text_value_put_request( + _request = build_model_with_unwrapped_model_array_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithRenamedWrappedModelArrayValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_renamed_wrapped_model_array_value` 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: XmlClientConfiguration = 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") + + async def get(self, **kwargs: Any) -> _models.ModelWithRenamedWrappedModelArray: + """get. + + :return: ModelWithRenamedWrappedModelArray. The ModelWithRenamedWrappedModelArray is compatible + with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedWrappedModelArray + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedWrappedModelArray] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_wrapped_model_array_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedWrappedModelArray, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def put(self, input: _models.ModelWithRenamedWrappedModelArray, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedWrappedModelArray + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_wrapped_model_array_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithRenamedUnwrappedModelArrayValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_renamed_unwrapped_model_array_value` 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: XmlClientConfiguration = 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") + + async def get(self, **kwargs: Any) -> _models.ModelWithRenamedUnwrappedModelArray: + """get. + + :return: ModelWithRenamedUnwrappedModelArray. The ModelWithRenamedUnwrappedModelArray is + compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedUnwrappedModelArray + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedUnwrappedModelArray] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_unwrapped_model_array_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedUnwrappedModelArray, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def put(self, input: _models.ModelWithRenamedUnwrappedModelArray, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedUnwrappedModelArray + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_unwrapped_model_array_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithRenamedWrappedAndItemModelArrayValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_renamed_wrapped_and_item_model_array_value` 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: XmlClientConfiguration = 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") + + async def get(self, **kwargs: Any) -> _models.ModelWithRenamedWrappedAndItemModelArray: + """get. + + :return: ModelWithRenamedWrappedAndItemModelArray. The ModelWithRenamedWrappedAndItemModelArray + is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedWrappedAndItemModelArray + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedWrappedAndItemModelArray] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_wrapped_and_item_model_array_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedWrappedAndItemModelArray, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def put(self, input: _models.ModelWithRenamedWrappedAndItemModelArray, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedWrappedAndItemModelArray + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_wrapped_and_item_model_array_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithAttributesValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_attributes_value` 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: XmlClientConfiguration = 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") + + async def get(self, **kwargs: Any) -> _models.ModelWithAttributes: + """get. + + :return: ModelWithAttributes. The ModelWithAttributes is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithAttributes + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithAttributes] = kwargs.pop("cls", None) + + _request = build_model_with_attributes_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithAttributes, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def put(self, input: _models.ModelWithAttributes, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithAttributes + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_attributes_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithRenamedAttributeValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_renamed_attribute_value` 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: XmlClientConfiguration = 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") + + async def get(self, **kwargs: Any) -> _models.ModelWithRenamedAttribute: + """get. + + :return: ModelWithRenamedAttribute. The ModelWithRenamedAttribute is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedAttribute + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedAttribute] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_attribute_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedAttribute, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def put(self, input: _models.ModelWithRenamedAttribute, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedAttribute + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_attribute_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithNamespaceValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_namespace_value` 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: XmlClientConfiguration = 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") + + async def get(self, **kwargs: Any) -> _models.ModelWithNamespace: + """get. + + :return: ModelWithNamespace. The ModelWithNamespace is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithNamespace + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithNamespace] = kwargs.pop("cls", None) + + _request = build_model_with_namespace_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithNamespace, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def put(self, input: _models.ModelWithNamespace, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithNamespace + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_namespace_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithNamespaceOnPropertiesValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_namespace_on_properties_value` 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: XmlClientConfiguration = 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") + + async def get(self, **kwargs: Any) -> _models.ModelWithNamespaceOnProperties: + """get. + + :return: ModelWithNamespaceOnProperties. The ModelWithNamespaceOnProperties is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithNamespaceOnProperties + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithNamespaceOnProperties] = kwargs.pop("cls", None) + + _request = build_model_with_namespace_on_properties_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithNamespaceOnProperties, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def put(self, input: _models.ModelWithNamespaceOnProperties, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithNamespaceOnProperties + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_namespace_on_properties_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithTextValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_text_value` 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: XmlClientConfiguration = 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") + + async def get(self, **kwargs: Any) -> _models.ModelWithText: + """get. + + :return: ModelWithText. The ModelWithText is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithText + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithText] = kwargs.pop("cls", None) + + _request = build_model_with_text_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithText, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def put(self, input: _models.ModelWithText, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithText + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_text_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithOptionalFieldValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_optional_field_value` 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: XmlClientConfiguration = 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") + + async def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: + """get. + + :return: ModelWithOptionalField. The ModelWithOptionalField is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithOptionalField + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithOptionalField] = kwargs.pop("cls", None) + + _request = build_model_with_optional_field_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithOptionalField, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def put(self, input: _models.ModelWithOptionalField, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithOptionalField + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_optional_field_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithEmptyArrayValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.aio.XmlClient`'s + :attr:`model_with_empty_array_value` 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: XmlClientConfiguration = 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") + + async def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: + """get. + + :return: ModelWithEmptyArray. The ModelWithEmptyArray is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithEmptyArray + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithEmptyArray] = kwargs.pop("cls", None) + + _request = build_model_with_empty_array_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithEmptyArray, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + async def put(self, input: _models.ModelWithEmptyArray, **kwargs: Any) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithEmptyArray + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_empty_array_value_put_request( content_type=content_type, content=_content, headers=_headers, diff --git a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/models/__init__.py b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/models/__init__.py index e630c4a936..1113f4fea3 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/models/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/models/__init__.py @@ -8,6 +8,8 @@ from ._models import ( # type: ignore + Author, + Book, ModelWithArrayOfModel, ModelWithAttributes, ModelWithDatetime, @@ -15,12 +17,23 @@ ModelWithEmptyArray, ModelWithEncodedNames, ModelWithEnum, + ModelWithNamespace, + ModelWithNamespaceOnProperties, + ModelWithNestedModel, ModelWithOptionalField, ModelWithRenamedArrays, + ModelWithRenamedAttribute, ModelWithRenamedFields, + ModelWithRenamedNestedModel, + ModelWithRenamedProperty, + ModelWithRenamedUnwrappedModelArray, + ModelWithRenamedWrappedAndItemModelArray, + ModelWithRenamedWrappedModelArray, ModelWithSimpleArrays, ModelWithText, ModelWithUnwrappedArray, + ModelWithUnwrappedModelArray, + ModelWithWrappedPrimitiveCustomItemNames, SimpleModel, XmlErrorBody, ) @@ -33,6 +46,8 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ + "Author", + "Book", "ModelWithArrayOfModel", "ModelWithAttributes", "ModelWithDatetime", @@ -40,12 +55,23 @@ "ModelWithEmptyArray", "ModelWithEncodedNames", "ModelWithEnum", + "ModelWithNamespace", + "ModelWithNamespaceOnProperties", + "ModelWithNestedModel", "ModelWithOptionalField", "ModelWithRenamedArrays", + "ModelWithRenamedAttribute", "ModelWithRenamedFields", + "ModelWithRenamedNestedModel", + "ModelWithRenamedProperty", + "ModelWithRenamedUnwrappedModelArray", + "ModelWithRenamedWrappedAndItemModelArray", + "ModelWithRenamedWrappedModelArray", "ModelWithSimpleArrays", "ModelWithText", "ModelWithUnwrappedArray", + "ModelWithUnwrappedModelArray", + "ModelWithWrappedPrimitiveCustomItemNames", "SimpleModel", "XmlErrorBody", "Status", diff --git a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/models/_models.py b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/models/_models.py index 51dae4ba58..26e631e2e6 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/models/_models.py +++ b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/models/_models.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # pylint: disable=useless-super-delegation @@ -10,8 +11,74 @@ from .. import models as _models +class Author(_Model): + """Author model with a custom XML name. + + :ivar name: Required. + :vartype name: str + """ + + name: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "name", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "XmlAuthor", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Book(_Model): + """Book model with a custom XML name. + + :ivar title: Required. + :vartype title: str + """ + + title: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "title", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "XmlBook", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + title: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ModelWithArrayOfModel(_Model): - """Contains an array of models. + """§4.1 — Contains an array of models. :ivar items_property: Required. :vartype items_property: ~payload.xml.models.SimpleModel @@ -46,7 +113,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ModelWithAttributes(_Model): - """Contains fields that are XML attributes. + """§5.1 — Contains fields that are XML attributes. :ivar id1: Required. :vartype id1: int @@ -280,6 +347,157 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ModelWithNamespace(_Model): + """§6.1, §7.1 — Contains fields with XML namespace on the model. + + :ivar id: Required. + :vartype id: int + :ivar title: Required. + :vartype title: str + """ + + id: int = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "id", "text": False, "unwrapped": False}, + ) + """Required.""" + title: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "title", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = { + "attribute": False, + "name": "ModelWithNamespace", + "namespace": "http://example.com/schema", + "prefix": "smp", + "text": False, + "unwrapped": False, + } + + @overload + def __init__( + self, + *, + id: int, # pylint: disable=redefined-builtin + title: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithNamespaceOnProperties(_Model): + """§6.2, §7.2 — Contains fields with different XML namespaces on individual properties. + + :ivar id: Required. + :vartype id: int + :ivar title: Required. + :vartype title: str + :ivar author: Required. + :vartype author: str + """ + + id: int = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "id", "text": False, "unwrapped": False}, + ) + """Required.""" + title: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={ + "attribute": False, + "name": "title", + "namespace": "http://example.com/schema", + "prefix": "smp", + "text": False, + "unwrapped": False, + }, + ) + """Required.""" + author: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={ + "attribute": False, + "name": "author", + "namespace": "http://example.com/ns2", + "prefix": "ns2", + "text": False, + "unwrapped": False, + }, + ) + """Required.""" + + _xml = { + "attribute": False, + "name": "ModelWithNamespaceOnProperties", + "namespace": "http://example.com/schema", + "prefix": "smp", + "text": False, + "unwrapped": False, + } + + @overload + def __init__( + self, + *, + id: int, # pylint: disable=redefined-builtin + title: str, + author: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithNestedModel(_Model): + """§2.1 — Contains a property that references another model. + + :ivar nested: Required. + :vartype nested: ~payload.xml.models.SimpleModel + """ + + nested: "_models.SimpleModel" = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "nested", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithNestedModel", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + nested: "_models.SimpleModel", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ModelWithOptionalField(_Model): """Contains an optional field. @@ -321,8 +539,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ModelWithRenamedArrays(_Model): - """Contains fields of wrapped and unwrapped arrays of primitive types that have different XML - representations. + """§3.3, §3.4 — Contains fields of wrapped and unwrapped arrays of primitive types that have + different XML representations. :ivar colors: Required. :vartype colors: list[str] @@ -362,8 +580,57 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ModelWithRenamedAttribute(_Model): + """§5.2 — Contains a renamed XML attribute. + + :ivar id: Required. + :vartype id: int + :ivar title: Required. + :vartype title: str + :ivar author: Required. + :vartype author: str + """ + + id: int = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": True, "name": "xml-id", "text": False, "unwrapped": False}, + ) + """Required.""" + title: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "title", "text": False, "unwrapped": False}, + ) + """Required.""" + author: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "author", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedAttribute", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + id: int, # pylint: disable=redefined-builtin + title: str, + author: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ModelWithRenamedFields(_Model): - """Contains fields of the same type that have different XML representation. + """§1.3, §2.3 — Contains fields of the same type that have different XML representation. :ivar input_data: Required. :vartype input_data: ~payload.xml.models.SimpleModel @@ -405,8 +672,185 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ModelWithRenamedNestedModel(_Model): + """§2.2 — Contains a property whose type has. + + :ivar author: Required. + :vartype author: ~payload.xml.models.Author + """ + + author: "_models.Author" = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "author", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedNestedModel", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + author: "_models.Author", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithRenamedProperty(_Model): + """§1.2 — Contains a scalar property with a custom XML name. + + :ivar title: Required. + :vartype title: str + :ivar author: Required. + :vartype author: str + """ + + title: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "renamedTitle", "text": False, "unwrapped": False}, + ) + """Required.""" + author: str = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "name": "author", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedProperty", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + title: str, + author: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithRenamedUnwrappedModelArray(_Model): + """§4.4 — Contains an unwrapped array of models with a custom item name. + + :ivar items_property: Required. + :vartype items_property: ~payload.xml.models.SimpleModel + """ + + items_property: list["_models.SimpleModel"] = rest_field( + name="items", + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "itemsName": "ModelItem", "name": "ModelItem", "text": False, "unwrapped": True}, + original_tsp_name="items", + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedUnwrappedModelArray", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + items_property: list["_models.SimpleModel"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithRenamedWrappedAndItemModelArray(_Model): + """§4.5 — Contains a wrapped array of models with custom wrapper and item names. + + :ivar books: Required. + :vartype books: ~payload.xml.models.Book + """ + + books: list["_models.Book"] = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "itemsName": "XmlBook", "name": "AllBooks", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedWrappedAndItemModelArray", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + books: list["_models.Book"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithRenamedWrappedModelArray(_Model): + """§4.3 — Contains a wrapped array of models with a custom wrapper name. + + :ivar items_property: Required. + :vartype items_property: ~payload.xml.models.SimpleModel + """ + + items_property: list["_models.SimpleModel"] = rest_field( + name="items", + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "itemsName": "SimpleModel", "name": "AllItems", "text": False, "unwrapped": False}, + original_tsp_name="items", + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithRenamedWrappedModelArray", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + items_property: list["_models.SimpleModel"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class ModelWithSimpleArrays(_Model): - """Contains fields of arrays of primitive types. + """§3.1 — Contains fields of arrays of primitive types. :ivar colors: Required. :vartype colors: list[str] @@ -447,7 +891,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ModelWithText(_Model): - """Contains an attribute and text. + """§8.1 — Contains an attribute and text. :ivar language: Required. :vartype language: str @@ -488,7 +932,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ModelWithUnwrappedArray(_Model): - """Contains fields of wrapped and unwrapped arrays of primitive types. + """§3.2 — Contains fields of wrapped and unwrapped arrays of primitive types. :ivar colors: Required. :vartype colors: list[str] @@ -528,8 +972,76 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class ModelWithUnwrappedModelArray(_Model): + """§4.2 — Contains an unwrapped array of models. + + :ivar items_property: Required. + :vartype items_property: ~payload.xml.models.SimpleModel + """ + + items_property: list["_models.SimpleModel"] = rest_field( + name="items", + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "itemsName": "items", "name": "items", "text": False, "unwrapped": True}, + original_tsp_name="items", + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithUnwrappedModelArray", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + items_property: list["_models.SimpleModel"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ModelWithWrappedPrimitiveCustomItemNames(_Model): + """§3.5 — Contains a wrapped primitive array with custom wrapper and item names. + + :ivar tags: Required. + :vartype tags: list[str] + """ + + tags: list[str] = rest_field( + visibility=["read", "create", "update", "delete", "query"], + xml={"attribute": False, "itemsName": "ItemName", "name": "ItemsTags", "text": False, "unwrapped": False}, + ) + """Required.""" + + _xml = {"attribute": False, "name": "ModelWithWrappedPrimitiveCustomItemNames", "text": False, "unwrapped": False} + + @overload + def __init__( + self, + *, + tags: list[str], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class SimpleModel(_Model): - """Contains fields of primitive types. + """§1.1 — Contains fields of primitive types. :ivar name: Required. :vartype name: str diff --git a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/operations/__init__.py b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/operations/__init__.py index 9fb7963fc4..65cf449c47 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/operations/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/operations/__init__.py @@ -7,15 +7,26 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import SimpleModelValueOperations # type: ignore +from ._operations import ModelWithRenamedPropertyValueOperations # type: ignore +from ._operations import ModelWithRenamedFieldsValueOperations # type: ignore +from ._operations import ModelWithNestedModelValueOperations # type: ignore +from ._operations import ModelWithRenamedNestedModelValueOperations # type: ignore from ._operations import ModelWithSimpleArraysValueOperations # type: ignore -from ._operations import ModelWithArrayOfModelValueOperations # type: ignore -from ._operations import ModelWithOptionalFieldValueOperations # type: ignore -from ._operations import ModelWithAttributesValueOperations # type: ignore from ._operations import ModelWithUnwrappedArrayValueOperations # type: ignore from ._operations import ModelWithRenamedArraysValueOperations # type: ignore -from ._operations import ModelWithRenamedFieldsValueOperations # type: ignore -from ._operations import ModelWithEmptyArrayValueOperations # type: ignore +from ._operations import ModelWithWrappedPrimitiveCustomItemNamesValueOperations # type: ignore +from ._operations import ModelWithArrayOfModelValueOperations # type: ignore +from ._operations import ModelWithUnwrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedWrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedUnwrappedModelArrayValueOperations # type: ignore +from ._operations import ModelWithRenamedWrappedAndItemModelArrayValueOperations # type: ignore +from ._operations import ModelWithAttributesValueOperations # type: ignore +from ._operations import ModelWithRenamedAttributeValueOperations # type: ignore +from ._operations import ModelWithNamespaceValueOperations # type: ignore +from ._operations import ModelWithNamespaceOnPropertiesValueOperations # type: ignore from ._operations import ModelWithTextValueOperations # type: ignore +from ._operations import ModelWithOptionalFieldValueOperations # type: ignore +from ._operations import ModelWithEmptyArrayValueOperations # type: ignore from ._operations import ModelWithDictionaryValueOperations # type: ignore from ._operations import ModelWithEncodedNamesValueOperations # type: ignore from ._operations import ModelWithEnumValueOperations # type: ignore @@ -28,15 +39,26 @@ __all__ = [ "SimpleModelValueOperations", + "ModelWithRenamedPropertyValueOperations", + "ModelWithRenamedFieldsValueOperations", + "ModelWithNestedModelValueOperations", + "ModelWithRenamedNestedModelValueOperations", "ModelWithSimpleArraysValueOperations", - "ModelWithArrayOfModelValueOperations", - "ModelWithOptionalFieldValueOperations", - "ModelWithAttributesValueOperations", "ModelWithUnwrappedArrayValueOperations", "ModelWithRenamedArraysValueOperations", - "ModelWithRenamedFieldsValueOperations", - "ModelWithEmptyArrayValueOperations", + "ModelWithWrappedPrimitiveCustomItemNamesValueOperations", + "ModelWithArrayOfModelValueOperations", + "ModelWithUnwrappedModelArrayValueOperations", + "ModelWithRenamedWrappedModelArrayValueOperations", + "ModelWithRenamedUnwrappedModelArrayValueOperations", + "ModelWithRenamedWrappedAndItemModelArrayValueOperations", + "ModelWithAttributesValueOperations", + "ModelWithRenamedAttributeValueOperations", + "ModelWithNamespaceValueOperations", + "ModelWithNamespaceOnPropertiesValueOperations", "ModelWithTextValueOperations", + "ModelWithOptionalFieldValueOperations", + "ModelWithEmptyArrayValueOperations", "ModelWithDictionaryValueOperations", "ModelWithEncodedNamesValueOperations", "ModelWithEnumValueOperations", diff --git a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/operations/_operations.py index 0c492f1151..9b6ba0296c 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-xml/payload/xml/operations/_operations.py @@ -57,13 +57,13 @@ def build_simple_model_value_put_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_simple_arrays_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_property_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithSimpleArrays" + _url = "/payload/xml/modelWithRenamedProperty" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -71,12 +71,12 @@ def build_model_with_simple_arrays_value_get_request(**kwargs: Any) -> HttpReque return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_simple_arrays_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_property_value_put_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 = "/payload/xml/modelWithSimpleArrays" + _url = "/payload/xml/modelWithRenamedProperty" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -84,13 +84,13 @@ def build_model_with_simple_arrays_value_put_request(**kwargs: Any) -> HttpReque return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_array_of_model_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_fields_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithArrayOfModel" + _url = "/payload/xml/modelWithRenamedFields" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -98,12 +98,12 @@ def build_model_with_array_of_model_value_get_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_array_of_model_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_fields_value_put_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 = "/payload/xml/modelWithArrayOfModel" + _url = "/payload/xml/modelWithRenamedFields" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -111,13 +111,13 @@ def build_model_with_array_of_model_value_put_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_optional_field_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_nested_model_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithOptionalField" + _url = "/payload/xml/modelWithNestedModel" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -125,12 +125,12 @@ def build_model_with_optional_field_value_get_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_optional_field_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_nested_model_value_put_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 = "/payload/xml/modelWithOptionalField" + _url = "/payload/xml/modelWithNestedModel" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -138,13 +138,15 @@ def build_model_with_optional_field_value_put_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_attributes_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_nested_model_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithAttributes" + _url = "/payload/xml/modelWithRenamedNestedModel" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -152,12 +154,41 @@ def build_model_with_attributes_value_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_attributes_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_nested_model_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: str = kwargs.pop("content_type") # Construct URL - _url = "/payload/xml/modelWithAttributes" + _url = "/payload/xml/modelWithRenamedNestedModel" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_simple_arrays_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithSimpleArrays" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_simple_arrays_value_put_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 = "/payload/xml/modelWithSimpleArrays" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -219,13 +250,15 @@ def build_model_with_renamed_arrays_value_put_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_renamed_fields_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_wrapped_primitive_custom_item_names_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithRenamedFields" + _url = "/payload/xml/modelWithWrappedPrimitiveCustomItemNames" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -233,12 +266,14 @@ def build_model_with_renamed_fields_value_get_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_renamed_fields_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_wrapped_primitive_custom_item_names_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: str = kwargs.pop("content_type") # Construct URL - _url = "/payload/xml/modelWithRenamedFields" + _url = "/payload/xml/modelWithWrappedPrimitiveCustomItemNames" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -246,13 +281,13 @@ def build_model_with_renamed_fields_value_put_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_empty_array_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_array_of_model_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithEmptyArray" + _url = "/payload/xml/modelWithArrayOfModel" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -260,12 +295,12 @@ def build_model_with_empty_array_value_get_request(**kwargs: Any) -> HttpRequest return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_empty_array_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_array_of_model_value_put_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 = "/payload/xml/modelWithEmptyArray" + _url = "/payload/xml/modelWithArrayOfModel" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -273,13 +308,15 @@ def build_model_with_empty_array_value_put_request(**kwargs: Any) -> HttpRequest return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_text_value_get_request(**kwargs: Any) -> HttpRequest: +def build_model_with_unwrapped_model_array_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithText" + _url = "/payload/xml/modelWithUnwrappedModelArray" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -287,12 +324,14 @@ def build_model_with_text_value_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_text_value_put_request(**kwargs: Any) -> HttpRequest: +def build_model_with_unwrapped_model_array_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: str = kwargs.pop("content_type") # Construct URL - _url = "/payload/xml/modelWithText" + _url = "/payload/xml/modelWithUnwrappedModelArray" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -300,13 +339,15 @@ def build_model_with_text_value_put_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_dictionary_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_wrapped_model_array_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithDictionary" + _url = "/payload/xml/modelWithRenamedWrappedModelArray" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -314,12 +355,14 @@ def build_model_with_dictionary_value_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_dictionary_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_wrapped_model_array_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: str = kwargs.pop("content_type") # Construct URL - _url = "/payload/xml/modelWithDictionary" + _url = "/payload/xml/modelWithRenamedWrappedModelArray" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -327,13 +370,15 @@ def build_model_with_dictionary_value_put_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_encoded_names_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_unwrapped_model_array_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithEncodedNames" + _url = "/payload/xml/modelWithRenamedUnwrappedModelArray" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -341,12 +386,14 @@ def build_model_with_encoded_names_value_get_request(**kwargs: Any) -> HttpReque return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_encoded_names_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_model_with_renamed_unwrapped_model_array_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type: str = kwargs.pop("content_type") # Construct URL - _url = "/payload/xml/modelWithEncodedNames" + _url = "/payload/xml/modelWithRenamedUnwrappedModelArray" # Construct headers _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -354,13 +401,15 @@ def build_model_with_encoded_names_value_put_request(**kwargs: Any) -> HttpReque return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_model_with_enum_value_get_request(**kwargs: Any) -> HttpRequest: +def build_model_with_renamed_wrapped_and_item_model_array_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop("Accept", "application/xml") # Construct URL - _url = "/payload/xml/modelWithEnum" + _url = "/payload/xml/modelWithRenamedWrappedAndItemModelArray" # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -368,68 +417,1721 @@ def build_model_with_enum_value_get_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_model_with_enum_value_put_request(**kwargs: Any) -> HttpRequest: +def build_model_with_renamed_wrapped_and_item_model_array_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/payload/xml/modelWithRenamedWrappedAndItemModelArray" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_attributes_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithAttributes" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_attributes_value_put_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 = "/payload/xml/modelWithAttributes" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_renamed_attribute_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithRenamedAttribute" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_renamed_attribute_value_put_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 = "/payload/xml/modelWithRenamedAttribute" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_namespace_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithNamespace" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_namespace_value_put_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 = "/payload/xml/modelWithNamespace" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_namespace_on_properties_value_get_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithNamespaceOnProperties" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_namespace_on_properties_value_put_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/payload/xml/modelWithNamespaceOnProperties" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_text_value_get_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithText" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_text_value_put_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/payload/xml/modelWithText" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_optional_field_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithOptionalField" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_optional_field_value_put_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 = "/payload/xml/modelWithOptionalField" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_empty_array_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithEmptyArray" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_empty_array_value_put_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 = "/payload/xml/modelWithEnum" + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/payload/xml/modelWithEmptyArray" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_dictionary_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithDictionary" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_dictionary_value_put_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 = "/payload/xml/modelWithDictionary" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_encoded_names_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithEncodedNames" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_encoded_names_value_put_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 = "/payload/xml/modelWithEncodedNames" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_enum_value_get_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithEnum" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_enum_value_put_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/payload/xml/modelWithEnum" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_model_with_datetime_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/modelWithDatetime" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_model_with_datetime_value_put_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 = "/payload/xml/modelWithDatetime" + + # Construct headers + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_xml_error_value_get_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/xml") + + # Construct URL + _url = "/payload/xml/error" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +class SimpleModelValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`simple_model_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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") + + def get(self, **kwargs: Any) -> _models.SimpleModel: + """get. + + :return: SimpleModel. The SimpleModel is compatible with MutableMapping + :rtype: ~payload.xml.models.SimpleModel + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SimpleModel] = kwargs.pop("cls", None) + + _request = build_simple_model_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.SimpleModel, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def put(self, input: _models.SimpleModel, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """put. + + :param input: Required. + :type input: ~payload.xml.models.SimpleModel + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_simple_model_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithRenamedPropertyValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_renamed_property_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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") + + def get(self, **kwargs: Any) -> _models.ModelWithRenamedProperty: + """get. + + :return: ModelWithRenamedProperty. The ModelWithRenamedProperty is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedProperty + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedProperty] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_property_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedProperty, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithRenamedProperty, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedProperty + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_property_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithRenamedFieldsValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_renamed_fields_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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") + + def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: + """get. + + :return: ModelWithRenamedFields. The ModelWithRenamedFields is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedFields + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedFields] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_fields_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedFields, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithRenamedFields, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedFields + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_fields_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithNestedModelValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_nested_model_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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") + + def get(self, **kwargs: Any) -> _models.ModelWithNestedModel: + """get. + + :return: ModelWithNestedModel. The ModelWithNestedModel is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithNestedModel + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithNestedModel] = kwargs.pop("cls", None) + + _request = build_model_with_nested_model_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithNestedModel, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithNestedModel, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithNestedModel + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_nested_model_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithRenamedNestedModelValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_renamed_nested_model_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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") + + def get(self, **kwargs: Any) -> _models.ModelWithRenamedNestedModel: + """get. + + :return: ModelWithRenamedNestedModel. The ModelWithRenamedNestedModel is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedNestedModel + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedNestedModel] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_nested_model_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedNestedModel, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithRenamedNestedModel, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedNestedModel + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_nested_model_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithSimpleArraysValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_simple_arrays_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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") + + def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: + """get. + + :return: ModelWithSimpleArrays. The ModelWithSimpleArrays is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithSimpleArrays + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithSimpleArrays] = kwargs.pop("cls", None) + + _request = build_model_with_simple_arrays_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithSimpleArrays, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithSimpleArrays, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithSimpleArrays + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_simple_arrays_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithUnwrappedArrayValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_unwrapped_array_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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") + + def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedArray: + """get. + + :return: ModelWithUnwrappedArray. The ModelWithUnwrappedArray is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithUnwrappedArray + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithUnwrappedArray] = kwargs.pop("cls", None) + + _request = build_model_with_unwrapped_array_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithUnwrappedArray, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithUnwrappedArray, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithUnwrappedArray + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_unwrapped_array_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithRenamedArraysValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_renamed_arrays_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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") + + def get(self, **kwargs: Any) -> _models.ModelWithRenamedArrays: + """get. + + :return: ModelWithRenamedArrays. The ModelWithRenamedArrays is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedArrays + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithRenamedArrays] = kwargs.pop("cls", None) + + _request = build_model_with_renamed_arrays_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithRenamedArrays, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithRenamedArrays, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithRenamedArrays + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_renamed_arrays_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithWrappedPrimitiveCustomItemNamesValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_wrapped_primitive_custom_item_names_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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") + + def get(self, **kwargs: Any) -> _models.ModelWithWrappedPrimitiveCustomItemNames: + """get. + + :return: ModelWithWrappedPrimitiveCustomItemNames. The ModelWithWrappedPrimitiveCustomItemNames + is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithWrappedPrimitiveCustomItemNames + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithWrappedPrimitiveCustomItemNames] = kwargs.pop("cls", None) + + _request = build_model_with_wrapped_primitive_custom_item_names_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithWrappedPrimitiveCustomItemNames, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithWrappedPrimitiveCustomItemNames, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithWrappedPrimitiveCustomItemNames + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_wrapped_primitive_custom_item_names_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithArrayOfModelValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_array_of_model_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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") + + def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: + """get. + + :return: ModelWithArrayOfModel. The ModelWithArrayOfModel is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithArrayOfModel + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ModelWithArrayOfModel] = kwargs.pop("cls", None) + + _request = build_model_with_array_of_model_value_get_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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run(_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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithArrayOfModel, response.text()) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithArrayOfModel, **kwargs: Any + ) -> None: + """put. + + :param input: Required. + :type input: ~payload.xml.models.ModelWithArrayOfModel + :return: None + :rtype: None + :raises ~corehttp.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/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = _get_element(input) + + _request = build_model_with_array_of_model_value_put_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(_request, stream=_stream, **kwargs) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(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 ModelWithUnwrappedModelArrayValueOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~payload.xml.XmlClient`'s + :attr:`model_with_unwrapped_model_array_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: XmlClientConfiguration = 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") + + def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedModelArray: + """get. + + :return: ModelWithUnwrappedModelArray. The ModelWithUnwrappedModelArray is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithUnwrappedModelArray + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + cls: ClsType[_models.ModelWithUnwrappedModelArray] = kwargs.pop("cls", None) - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + _request = build_model_with_unwrapped_model_array_value_get_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) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) -def build_model_with_datetime_value_get_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + response = pipeline_response.http_response - accept = _headers.pop("Accept", "application/xml") + 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) - # Construct URL - _url = "/payload/xml/modelWithDatetime" + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize_xml(_models.ModelWithUnwrappedModelArray, response.text()) - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized # type: ignore -def build_model_with_datetime_value_put_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithUnwrappedModelArray, **kwargs: Any + ) -> None: + """put. - content_type: str = kwargs.pop("content_type") - # Construct URL - _url = "/payload/xml/modelWithDatetime" + :param input: Required. + :type input: ~payload.xml.models.ModelWithUnwrappedModelArray + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) + _content = _get_element(input) -def build_xml_error_value_get_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _request = build_model_with_unwrapped_model_array_value_put_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) - accept = _headers.pop("Accept", "application/xml") + _stream = False + pipeline_response: PipelineResponse = self._client.pipeline.run(_request, stream=_stream, **kwargs) - # Construct URL - _url = "/payload/xml/error" + response = pipeline_response.http_response - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + if cls: + return cls(pipeline_response, None, {}) # type: ignore -class SimpleModelValueOperations: +class ModelWithRenamedWrappedModelArrayValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`simple_model_value` attribute. + :attr:`model_with_renamed_wrapped_model_array_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -439,11 +2141,12 @@ 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") - def get(self, **kwargs: Any) -> _models.SimpleModel: + def get(self, **kwargs: Any) -> _models.ModelWithRenamedWrappedModelArray: """get. - :return: SimpleModel. The SimpleModel is compatible with MutableMapping - :rtype: ~payload.xml.models.SimpleModel + :return: ModelWithRenamedWrappedModelArray. The ModelWithRenamedWrappedModelArray is compatible + with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedWrappedModelArray :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -457,9 +2160,9 @@ def get(self, **kwargs: Any) -> _models.SimpleModel: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SimpleModel] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedWrappedModelArray] = kwargs.pop("cls", None) - _request = build_simple_model_value_get_request( + _request = build_model_with_renamed_wrapped_model_array_value_get_request( headers=_headers, params=_params, ) @@ -489,18 +2192,20 @@ def get(self, **kwargs: Any) -> _models.SimpleModel: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.SimpleModel, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedWrappedModelArray, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def put(self, input: _models.SimpleModel, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + def put( # pylint: disable=inconsistent-return-statements + self, input: _models.ModelWithRenamedWrappedModelArray, **kwargs: Any + ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.SimpleModel + :type input: ~payload.xml.models.ModelWithRenamedWrappedModelArray :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -521,7 +2226,7 @@ def put(self, input: _models.SimpleModel, **kwargs: Any) -> None: # pylint: dis _content = _get_element(input) - _request = build_simple_model_value_put_request( + _request = build_model_with_renamed_wrapped_model_array_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -545,14 +2250,14 @@ def put(self, input: _models.SimpleModel, **kwargs: Any) -> None: # pylint: dis return cls(pipeline_response, None, {}) # type: ignore -class ModelWithSimpleArraysValueOperations: +class ModelWithRenamedUnwrappedModelArrayValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_simple_arrays_value` attribute. + :attr:`model_with_renamed_unwrapped_model_array_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -562,11 +2267,12 @@ 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") - def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: + def get(self, **kwargs: Any) -> _models.ModelWithRenamedUnwrappedModelArray: """get. - :return: ModelWithSimpleArrays. The ModelWithSimpleArrays is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithSimpleArrays + :return: ModelWithRenamedUnwrappedModelArray. The ModelWithRenamedUnwrappedModelArray is + compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedUnwrappedModelArray :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -580,9 +2286,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithSimpleArrays] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedUnwrappedModelArray] = kwargs.pop("cls", None) - _request = build_model_with_simple_arrays_value_get_request( + _request = build_model_with_renamed_unwrapped_model_array_value_get_request( headers=_headers, params=_params, ) @@ -612,7 +2318,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithSimpleArrays, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedUnwrappedModelArray, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -620,12 +2326,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithSimpleArrays: return deserialized # type: ignore def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithSimpleArrays, **kwargs: Any + self, input: _models.ModelWithRenamedUnwrappedModelArray, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithSimpleArrays + :type input: ~payload.xml.models.ModelWithRenamedUnwrappedModelArray :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -646,7 +2352,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_simple_arrays_value_put_request( + _request = build_model_with_renamed_unwrapped_model_array_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -670,14 +2376,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithArrayOfModelValueOperations: +class ModelWithRenamedWrappedAndItemModelArrayValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_array_of_model_value` attribute. + :attr:`model_with_renamed_wrapped_and_item_model_array_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -687,11 +2393,12 @@ 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") - def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: + def get(self, **kwargs: Any) -> _models.ModelWithRenamedWrappedAndItemModelArray: """get. - :return: ModelWithArrayOfModel. The ModelWithArrayOfModel is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithArrayOfModel + :return: ModelWithRenamedWrappedAndItemModelArray. The ModelWithRenamedWrappedAndItemModelArray + is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedWrappedAndItemModelArray :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -705,9 +2412,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithArrayOfModel] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedWrappedAndItemModelArray] = kwargs.pop("cls", None) - _request = build_model_with_array_of_model_value_get_request( + _request = build_model_with_renamed_wrapped_and_item_model_array_value_get_request( headers=_headers, params=_params, ) @@ -737,7 +2444,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithArrayOfModel, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedWrappedAndItemModelArray, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -745,12 +2452,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithArrayOfModel: return deserialized # type: ignore def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithArrayOfModel, **kwargs: Any + self, input: _models.ModelWithRenamedWrappedAndItemModelArray, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithArrayOfModel + :type input: ~payload.xml.models.ModelWithRenamedWrappedAndItemModelArray :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -771,7 +2478,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_array_of_model_value_put_request( + _request = build_model_with_renamed_wrapped_and_item_model_array_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -795,14 +2502,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithOptionalFieldValueOperations: +class ModelWithAttributesValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_optional_field_value` attribute. + :attr:`model_with_attributes_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -812,11 +2519,11 @@ 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") - def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: + def get(self, **kwargs: Any) -> _models.ModelWithAttributes: """get. - :return: ModelWithOptionalField. The ModelWithOptionalField is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithOptionalField + :return: ModelWithAttributes. The ModelWithAttributes is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithAttributes :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -830,9 +2537,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithOptionalField] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithAttributes] = kwargs.pop("cls", None) - _request = build_model_with_optional_field_value_get_request( + _request = build_model_with_attributes_value_get_request( headers=_headers, params=_params, ) @@ -862,7 +2569,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithOptionalField, response.text()) + deserialized = _deserialize_xml(_models.ModelWithAttributes, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -870,12 +2577,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: return deserialized # type: ignore def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithOptionalField, **kwargs: Any + self, input: _models.ModelWithAttributes, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithOptionalField + :type input: ~payload.xml.models.ModelWithAttributes :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -896,7 +2603,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_optional_field_value_put_request( + _request = build_model_with_attributes_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -920,14 +2627,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithAttributesValueOperations: +class ModelWithRenamedAttributeValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_attributes_value` attribute. + :attr:`model_with_renamed_attribute_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -937,11 +2644,12 @@ 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") - def get(self, **kwargs: Any) -> _models.ModelWithAttributes: + def get(self, **kwargs: Any) -> _models.ModelWithRenamedAttribute: """get. - :return: ModelWithAttributes. The ModelWithAttributes is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithAttributes + :return: ModelWithRenamedAttribute. The ModelWithRenamedAttribute is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithRenamedAttribute :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -955,9 +2663,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithAttributes: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithAttributes] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithRenamedAttribute] = kwargs.pop("cls", None) - _request = build_model_with_attributes_value_get_request( + _request = build_model_with_renamed_attribute_value_get_request( headers=_headers, params=_params, ) @@ -987,7 +2695,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithAttributes: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithAttributes, response.text()) + deserialized = _deserialize_xml(_models.ModelWithRenamedAttribute, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -995,12 +2703,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithAttributes: return deserialized # type: ignore def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithAttributes, **kwargs: Any + self, input: _models.ModelWithRenamedAttribute, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithAttributes + :type input: ~payload.xml.models.ModelWithRenamedAttribute :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1021,7 +2729,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_attributes_value_put_request( + _request = build_model_with_renamed_attribute_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1045,14 +2753,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithUnwrappedArrayValueOperations: +class ModelWithNamespaceValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_unwrapped_array_value` attribute. + :attr:`model_with_namespace_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1062,11 +2770,11 @@ 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") - def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedArray: + def get(self, **kwargs: Any) -> _models.ModelWithNamespace: """get. - :return: ModelWithUnwrappedArray. The ModelWithUnwrappedArray is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithUnwrappedArray + :return: ModelWithNamespace. The ModelWithNamespace is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithNamespace :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1080,9 +2788,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedArray: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithUnwrappedArray] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithNamespace] = kwargs.pop("cls", None) - _request = build_model_with_unwrapped_array_value_get_request( + _request = build_model_with_namespace_value_get_request( headers=_headers, params=_params, ) @@ -1112,7 +2820,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedArray: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithUnwrappedArray, response.text()) + deserialized = _deserialize_xml(_models.ModelWithNamespace, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1120,12 +2828,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithUnwrappedArray: return deserialized # type: ignore def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithUnwrappedArray, **kwargs: Any + self, input: _models.ModelWithNamespace, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithUnwrappedArray + :type input: ~payload.xml.models.ModelWithNamespace :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1146,7 +2854,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_unwrapped_array_value_put_request( + _request = build_model_with_namespace_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1170,14 +2878,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithRenamedArraysValueOperations: +class ModelWithNamespaceOnPropertiesValueOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_renamed_arrays_value` attribute. + :attr:`model_with_namespace_on_properties_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1187,11 +2895,12 @@ 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") - def get(self, **kwargs: Any) -> _models.ModelWithRenamedArrays: + def get(self, **kwargs: Any) -> _models.ModelWithNamespaceOnProperties: """get. - :return: ModelWithRenamedArrays. The ModelWithRenamedArrays is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithRenamedArrays + :return: ModelWithNamespaceOnProperties. The ModelWithNamespaceOnProperties is compatible with + MutableMapping + :rtype: ~payload.xml.models.ModelWithNamespaceOnProperties :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1205,9 +2914,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedArrays: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithRenamedArrays] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithNamespaceOnProperties] = kwargs.pop("cls", None) - _request = build_model_with_renamed_arrays_value_get_request( + _request = build_model_with_namespace_on_properties_value_get_request( headers=_headers, params=_params, ) @@ -1237,7 +2946,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedArrays: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithRenamedArrays, response.text()) + deserialized = _deserialize_xml(_models.ModelWithNamespaceOnProperties, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1245,12 +2954,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedArrays: return deserialized # type: ignore def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithRenamedArrays, **kwargs: Any + self, input: _models.ModelWithNamespaceOnProperties, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithRenamedArrays + :type input: ~payload.xml.models.ModelWithNamespaceOnProperties :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1271,7 +2980,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_renamed_arrays_value_put_request( + _request = build_model_with_namespace_on_properties_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1295,14 +3004,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithRenamedFieldsValueOperations: +class ModelWithTextValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_renamed_fields_value` attribute. + :attr:`model_with_text_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1312,11 +3021,11 @@ 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") - def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: + def get(self, **kwargs: Any) -> _models.ModelWithText: """get. - :return: ModelWithRenamedFields. The ModelWithRenamedFields is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithRenamedFields + :return: ModelWithText. The ModelWithText is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithText :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1330,9 +3039,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithRenamedFields] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithText] = kwargs.pop("cls", None) - _request = build_model_with_renamed_fields_value_get_request( + _request = build_model_with_text_value_get_request( headers=_headers, params=_params, ) @@ -1362,7 +3071,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithRenamedFields, response.text()) + deserialized = _deserialize_xml(_models.ModelWithText, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1370,12 +3079,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithRenamedFields: return deserialized # type: ignore def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithRenamedFields, **kwargs: Any + self, input: _models.ModelWithText, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithRenamedFields + :type input: ~payload.xml.models.ModelWithText :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1396,7 +3105,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_renamed_fields_value_put_request( + _request = build_model_with_text_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1420,14 +3129,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithEmptyArrayValueOperations: +class ModelWithOptionalFieldValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_empty_array_value` attribute. + :attr:`model_with_optional_field_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1437,11 +3146,11 @@ 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") - def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: + def get(self, **kwargs: Any) -> _models.ModelWithOptionalField: """get. - :return: ModelWithEmptyArray. The ModelWithEmptyArray is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithEmptyArray + :return: ModelWithOptionalField. The ModelWithOptionalField is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithOptionalField :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1455,9 +3164,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithEmptyArray] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithOptionalField] = kwargs.pop("cls", None) - _request = build_model_with_empty_array_value_get_request( + _request = build_model_with_optional_field_value_get_request( headers=_headers, params=_params, ) @@ -1487,7 +3196,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithEmptyArray, response.text()) + deserialized = _deserialize_xml(_models.ModelWithOptionalField, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1495,12 +3204,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: return deserialized # type: ignore def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithEmptyArray, **kwargs: Any + self, input: _models.ModelWithOptionalField, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithEmptyArray + :type input: ~payload.xml.models.ModelWithOptionalField :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1521,7 +3230,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_empty_array_value_put_request( + _request = build_model_with_optional_field_value_put_request( content_type=content_type, content=_content, headers=_headers, @@ -1545,14 +3254,14 @@ def put( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore -class ModelWithTextValueOperations: +class ModelWithEmptyArrayValueOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~payload.xml.XmlClient`'s - :attr:`model_with_text_value` attribute. + :attr:`model_with_empty_array_value` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -1562,11 +3271,11 @@ 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") - def get(self, **kwargs: Any) -> _models.ModelWithText: + def get(self, **kwargs: Any) -> _models.ModelWithEmptyArray: """get. - :return: ModelWithText. The ModelWithText is compatible with MutableMapping - :rtype: ~payload.xml.models.ModelWithText + :return: ModelWithEmptyArray. The ModelWithEmptyArray is compatible with MutableMapping + :rtype: ~payload.xml.models.ModelWithEmptyArray :raises ~corehttp.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1580,9 +3289,9 @@ def get(self, **kwargs: Any) -> _models.ModelWithText: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ModelWithText] = kwargs.pop("cls", None) + cls: ClsType[_models.ModelWithEmptyArray] = kwargs.pop("cls", None) - _request = build_model_with_text_value_get_request( + _request = build_model_with_empty_array_value_get_request( headers=_headers, params=_params, ) @@ -1612,7 +3321,7 @@ def get(self, **kwargs: Any) -> _models.ModelWithText: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize_xml(_models.ModelWithText, response.text()) + deserialized = _deserialize_xml(_models.ModelWithEmptyArray, response.text()) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1620,12 +3329,12 @@ def get(self, **kwargs: Any) -> _models.ModelWithText: return deserialized # type: ignore def put( # pylint: disable=inconsistent-return-statements - self, input: _models.ModelWithText, **kwargs: Any + self, input: _models.ModelWithEmptyArray, **kwargs: Any ) -> None: """put. :param input: Required. - :type input: ~payload.xml.models.ModelWithText + :type input: ~payload.xml.models.ModelWithEmptyArray :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1646,7 +3355,7 @@ def put( # pylint: disable=inconsistent-return-statements _content = _get_element(input) - _request = build_model_with_text_value_put_request( + _request = build_model_with_empty_array_value_put_request( content_type=content_type, content=_content, headers=_headers,