diff --git a/eng/pipelines/1es-redirect.yml b/eng/pipelines/1es-redirect.yml index 19d6f2e9243..737abbe0813 100644 --- a/eng/pipelines/1es-redirect.yml +++ b/eng/pipelines/1es-redirect.yml @@ -7,7 +7,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - ref: refs/tags/azure-sdk-build-tools_20250603.2 + ref: refs/tags/azure-sdk-build-tools_20251112.1 - repository: azure-sdk-tools type: github name: Azure/azure-sdk-tools diff --git a/eng/pipelines/build.yml b/eng/pipelines/build.yml index ee733776697..9091c51ad0d 100644 --- a/eng/pipelines/build.yml +++ b/eng/pipelines/build.yml @@ -35,6 +35,7 @@ extends: fetchDepth: 1 - checkout: azure-sdk-tools fetchDepth: 1 + - task: NuGetAuthenticate@1 - task: UseDotNet@2 displayName: 'Use .NET Core SDK' retryCountOnTaskFailure: 3 diff --git a/eng/pipelines/check-code-generation.yml b/eng/pipelines/check-code-generation.yml index 49c6ad4c63c..263c2d74173 100644 --- a/eng/pipelines/check-code-generation.yml +++ b/eng/pipelines/check-code-generation.yml @@ -21,6 +21,7 @@ jobs: displayName: 'Install Node.js' inputs: version: $(NODE_VERSION) + - task: NuGetAuthenticate@1 - task: UseDotNet@2 displayName: 'Use .NET Core SDK' inputs: diff --git a/eng/pipelines/generate-sdk-job-matrix-files.yml b/eng/pipelines/generate-sdk-job-matrix-files.yml index 4893dfa5e5e..55277b4c0dc 100644 --- a/eng/pipelines/generate-sdk-job-matrix-files.yml +++ b/eng/pipelines/generate-sdk-job-matrix-files.yml @@ -27,6 +27,7 @@ jobs: WorkingDirectory: $(Build.SourcesDirectory)/azure-sdk-for-net Commitish: refs/heads/${{ parameters.BranchName}} SkipCheckoutNone: true + - task: NuGetAuthenticate@1 - task: UseDotNet@2 displayName: 'Use .NET Core SDK' inputs: diff --git a/eng/pipelines/mgmt-mocktest.yml b/eng/pipelines/mgmt-mocktest.yml index a270e10b148..24372747bae 100644 --- a/eng/pipelines/mgmt-mocktest.yml +++ b/eng/pipelines/mgmt-mocktest.yml @@ -24,7 +24,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - ref: refs/tags/azure-sdk-build-tools_20250603.2 + ref: refs/tags/azure-sdk-build-tools_20251112.1 stages: - stage: 'Build_and_Test' diff --git a/eng/pipelines/sdk-update.yml b/eng/pipelines/sdk-update.yml index 48004ae3c5b..2b9fddea118 100644 --- a/eng/pipelines/sdk-update.yml +++ b/eng/pipelines/sdk-update.yml @@ -29,6 +29,7 @@ extends: fetchDepth: 1 - checkout: azure-sdk-tools fetchDepth: 1 + - task: NuGetAuthenticate@1 - task: UseDotNet@2 displayName: 'Use .NET Core SDK' retryCountOnTaskFailure: 3 diff --git a/package-lock.json b/package-lock.json index 8215939ef1c..24d2c64d6bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,14 +6,14 @@ "": { "name": "@autorest/csharp", "devDependencies": { - "@azure-tools/azure-http-specs": "0.1.0-alpha.28", - "@azure-tools/typespec-azure-resource-manager": "0.60.0", - "@azure-tools/typespec-client-generator-core": "0.60.0", + "@azure-tools/azure-http-specs": "0.1.0-alpha.30", + "@azure-tools/typespec-azure-resource-manager": "0.61.0", + "@azure-tools/typespec-client-generator-core": "0.61.0", "@azure-tools/typespec-csharp": "file:src/TypeSpec.Extension/Emitter.Csharp", "@azure-tools/unbranded-tests": "file:test/UnbrandedProjects", "@microsoft.azure/autorest.testserver": "3.3.50", - "@typespec/http-specs": "0.1.0-alpha.26", - "@typespec/spector": "0.1.0-alpha.18", + "@typespec/http-specs": "0.1.0-alpha.27", + "@typespec/spector": "0.1.0-alpha.19", "autorest": "3.7.1" } }, @@ -24,66 +24,72 @@ "dev": true }, "node_modules/@azure-tools/azure-http-specs": { - "version": "0.1.0-alpha.28", - "resolved": "https://registry.npmjs.org/@azure-tools/azure-http-specs/-/azure-http-specs-0.1.0-alpha.28.tgz", - "integrity": "sha512-rPd/37FGprH3Hg00r+JJ6a9cG4vadGMrd6Q+Ea8EXWArG5Vqq/FmzghxlafA+U9ByBbELQWnZlEDaRCaGC8fYA==", + "version": "0.1.0-alpha.30", + "resolved": "https://registry.npmjs.org/@azure-tools/azure-http-specs/-/azure-http-specs-0.1.0-alpha.30.tgz", + "integrity": "sha512-iFaLEftWOqvsRJ4egE4X6Lq8DsBVgi++UyAS1tRL9riDNe7bJ4Y3C9g4cKq8exddMC4hsV6TVFmKiyhZWCtv2g==", "dev": true, "license": "MIT", "dependencies": { "@typespec/spec-api": "^0.1.0-alpha.9", - "@typespec/spector": "^0.1.0-alpha.18" + "@typespec/spector": "^0.1.0-alpha.19" }, "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.60.0", - "@typespec/compiler": "^1.4.0", - "@typespec/http": "^1.4.0", - "@typespec/rest": "^0.74.0", - "@typespec/versioning": "^0.74.0", - "@typespec/xml": "^0.74.0" + "@azure-tools/typespec-azure-core": "^0.61.0", + "@typespec/compiler": "^1.5.0", + "@typespec/http": "^1.5.0", + "@typespec/rest": "^0.75.0", + "@typespec/versioning": "^0.75.0", + "@typespec/xml": "^0.75.0" } }, "node_modules/@azure-tools/typespec-autorest": { - "version": "0.60.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.60.0.tgz", - "integrity": "sha512-aIRr1e4g3irkjLTpxqzJ8BFnNFYwj4nlcG6cKGPuhNtiHhJgHjUhLVUNIW1A9O4jx+3RSErL9AkAl1ep+ZbiuA==", + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-autorest/-/typespec-autorest-0.61.0.tgz", + "integrity": "sha512-1/netRFLjltoZaNDJ8QuFzZFtFTyL+u9R+hyU7VsNAgpQy5nn3ax28nO04CdkguQZQ0WGDewZSZW0OhEGCWPOA==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.60.0", - "@azure-tools/typespec-azure-resource-manager": "^0.60.0", - "@azure-tools/typespec-client-generator-core": "^0.60.0", - "@typespec/compiler": "^1.4.0", - "@typespec/http": "^1.4.0", - "@typespec/openapi": "^1.4.0", - "@typespec/rest": "^0.74.0", - "@typespec/versioning": "^0.74.0" + "@azure-tools/typespec-azure-core": "^0.61.0", + "@azure-tools/typespec-azure-resource-manager": "^0.61.0", + "@azure-tools/typespec-client-generator-core": "^0.61.0", + "@typespec/compiler": "^1.5.0", + "@typespec/http": "^1.5.0", + "@typespec/openapi": "^1.5.0", + "@typespec/rest": "^0.75.0", + "@typespec/versioning": "^0.75.0", + "@typespec/xml": "^0.75.0" + }, + "peerDependenciesMeta": { + "@typespec/xml": { + "optional": true + } } }, "node_modules/@azure-tools/typespec-azure-core": { - "version": "0.60.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.60.0.tgz", - "integrity": "sha512-Pmm7blxnEZZ7lhMJWWsiIqMrFthaCK6uu7f+ONN7dq0Mjc/O9w8+43tAIXwnGz1OKAWmiToh3EDbaxeWyt/FhQ==", + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-core/-/typespec-azure-core-0.61.0.tgz", + "integrity": "sha512-sqOYBUghAtVMBiAWwT3fMRVSDNwR7IU3AQ96n/ErhAthwWjTe7PFVfK/MPjpI1mO3cdyLeS2DGyI3gt/waWP4g==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.4.0", - "@typespec/http": "^1.4.0", - "@typespec/rest": "^0.74.0" + "@typespec/compiler": "^1.5.0", + "@typespec/http": "^1.5.0", + "@typespec/rest": "^0.75.0" } }, "node_modules/@azure-tools/typespec-azure-resource-manager": { - "version": "0.60.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.60.0.tgz", - "integrity": "sha512-u0gqgSO5lIcpZN11MBAmRnR7kM1eoBLO8cKB86bXrxLt2vAkYpuL4hWp0A+QJjQy/YI5rrijeBF0visqBJnR4A==", + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-resource-manager/-/typespec-azure-resource-manager-0.61.0.tgz", + "integrity": "sha512-m/M6AareRXacDwyR82g9DqMppfX0eEsv0/q4PW2Lii7wGVzFiiU6fLqsiWBdIHl7GaKszTRtZXNRk/IL9HV8Lw==", "dev": true, "license": "MIT", "dependencies": { @@ -94,34 +100,34 @@ "node": ">=20.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.60.0", - "@typespec/compiler": "^1.4.0", - "@typespec/http": "^1.4.0", - "@typespec/openapi": "^1.4.0", - "@typespec/rest": "^0.74.0", - "@typespec/versioning": "^0.74.0" + "@azure-tools/typespec-azure-core": "^0.61.0", + "@typespec/compiler": "^1.5.0", + "@typespec/http": "^1.5.0", + "@typespec/openapi": "^1.5.0", + "@typespec/rest": "^0.75.0", + "@typespec/versioning": "^0.75.0" } }, "node_modules/@azure-tools/typespec-azure-rulesets": { - "version": "0.60.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-rulesets/-/typespec-azure-rulesets-0.60.0.tgz", - "integrity": "sha512-4sx9StBWkmnBfLJ9b23RSwCs0TkTElaU9+6a/cS6JS0F7UggP/KLQd6LG59D0u9ByXM2x9pvYPO8l/K7UOXoPg==", + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-azure-rulesets/-/typespec-azure-rulesets-0.61.0.tgz", + "integrity": "sha512-EWArbj6dgTz7Xi0mAkp0ru6PoWqfXLHlk8Kt7BzVcHCPojBYK14JW9RYSxBta+h2fAEQTSQu+X1r7Y7PhJE8rA==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.60.0", - "@azure-tools/typespec-azure-resource-manager": "^0.60.0", - "@azure-tools/typespec-client-generator-core": "^0.60.0", - "@typespec/compiler": "^1.4.0" + "@azure-tools/typespec-azure-core": "^0.61.0", + "@azure-tools/typespec-azure-resource-manager": "^0.61.0", + "@azure-tools/typespec-client-generator-core": "^0.61.0", + "@typespec/compiler": "^1.5.0" } }, "node_modules/@azure-tools/typespec-client-generator-core": { - "version": "0.60.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.60.0.tgz", - "integrity": "sha512-JV9uiqxDCzVVFeMctm4ebmUI4982B3dCdKx0nmonjfRf9a2/MXilEKExPIaNVR3ZqbFPXM/IepheY8t9YZNqSQ==", + "version": "0.61.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-client-generator-core/-/typespec-client-generator-core-0.61.0.tgz", + "integrity": "sha512-xm6HXmO2vFJ0BBKrkWGXknNyzhEYQ7eUFhngFMy1Mz7vCTTAprjA/jvtC6GpgjrKwVbmt1aQ0JyGmVKEiwWsMg==", "dev": true, "license": "MIT", "dependencies": { @@ -133,16 +139,16 @@ "node": ">=20.0.0" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": "^0.60.0", - "@typespec/compiler": "^1.4.0", - "@typespec/events": "^0.74.0", - "@typespec/http": "^1.4.0", - "@typespec/openapi": "^1.4.0", - "@typespec/rest": "^0.74.0", - "@typespec/sse": "^0.74.0", - "@typespec/streams": "^0.74.0", - "@typespec/versioning": "^0.74.0", - "@typespec/xml": "^0.74.0" + "@azure-tools/typespec-azure-core": "^0.61.0", + "@typespec/compiler": "^1.5.0", + "@typespec/events": "^0.75.0", + "@typespec/http": "^1.5.0", + "@typespec/openapi": "^1.5.0", + "@typespec/rest": "^0.75.0", + "@typespec/sse": "^0.75.0", + "@typespec/streams": "^0.75.0", + "@typespec/versioning": "^0.75.0", + "@typespec/xml": "^0.75.0" } }, "node_modules/@azure-tools/typespec-csharp": { @@ -150,9 +156,9 @@ "link": true }, "node_modules/@azure-tools/typespec-liftr-base": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-liftr-base/-/typespec-liftr-base-0.8.0.tgz", - "integrity": "sha512-xftTTtVjDuxIzugQ9nL/abmttdDM3HAf5HhqKzs9DO0Kl0ZhXQlB2DYlT1hBs/N+IWerMF9k2eKs2RncngA03g==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-liftr-base/-/typespec-liftr-base-0.10.0.tgz", + "integrity": "sha512-FcF8IusZcS2vvm1J+CzaeZkv15FgcFOSR+YoFdIusnnm+mlcLudM92NupdxZnuobPYcfZzq+rRvylxzzgWky7A==", "dev": true }, "node_modules/@azure-tools/unbranded-tests": { @@ -312,9 +318,9 @@ } }, "node_modules/@azure/identity": { - "version": "4.11.2", - "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.11.2.tgz", - "integrity": "sha512-xajUK+qzN28JkVol93Ouleu+aNiETEx/LR2LkRWGb5vi8D2Tv6y5COyQHDZwVQhZW/EJDHNjuxjjv47jF3TntQ==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.12.0.tgz", + "integrity": "sha512-6vuh2R3Cte6SD6azNalLCjIDoryGdcvDVEV7IDRPtm5lHX5ffkDlIalaoOp5YJU08e4ipjJENel20kSMDLAcug==", "dev": true, "license": "MIT", "dependencies": { @@ -349,22 +355,22 @@ } }, "node_modules/@azure/msal-browser": { - "version": "4.22.1", - "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.22.1.tgz", - "integrity": "sha512-/I76rBJpt5ZVfFXk+GkKxD4w1DZEbVpNn0aQjvRgnDnTYo3L/f8Oeo3R1O9eL/ccg5j1537iRLr7UwVhwnHtyg==", + "version": "4.25.0", + "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.25.0.tgz", + "integrity": "sha512-kbL+Ae7/UC62wSzxirZddYeVnHvvkvAnSZkBqL55X+jaSXTAXfngnNsDM5acEWU0Q/SAv3gEQfxO1igWOn87Pg==", "dev": true, "license": "MIT", "dependencies": { - "@azure/msal-common": "15.12.0" + "@azure/msal-common": "15.13.0" }, "engines": { "node": ">=0.8.0" } }, "node_modules/@azure/msal-common": { - "version": "15.12.0", - "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-15.12.0.tgz", - "integrity": "sha512-4ucXbjVw8KJ5QBgnGJUeA07c8iznwlk5ioHIhI4ASXcXgcf2yRFhWzYOyWg/cI49LC9ekpFJeQtO3zjDTbl6TQ==", + "version": "15.13.0", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-15.13.0.tgz", + "integrity": "sha512-8oF6nj02qX7eE/6+wFT5NluXRHc05AgdCC3fJnkjiJooq8u7BcLmxaYYSwc2AfEkWRMRi6Eyvvbeqk4U4412Ag==", "dev": true, "license": "MIT", "engines": { @@ -372,13 +378,13 @@ } }, "node_modules/@azure/msal-node": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-3.7.3.tgz", - "integrity": "sha512-MoJxkKM/YpChfq4g2o36tElyzNUMG8mfD6u8NbuaPAsqfGpaw249khAcJYNoIOigUzRw45OjXCOrexE6ImdUxg==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-3.8.0.tgz", + "integrity": "sha512-23BXm82Mp5XnRhrcd4mrHa0xuUNRp96ivu3nRatrfdAqjoeWAGyD0eEAafxAOHAEWWmdlyFK4ELFcdziXyw2sA==", "dev": true, "license": "MIT", "dependencies": { - "@azure/msal-common": "15.12.0", + "@azure/msal-common": "15.13.0", "jsonwebtoken": "^9.0.0", "uuid": "^8.3.0" }, @@ -2425,9 +2431,9 @@ } }, "node_modules/@typespec/compiler": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-1.4.0.tgz", - "integrity": "sha512-/AFiU3ImuhH/vHKzSGv7I2peewdJ7YLhgMCfFDNk6Ae0a5Ylrc8R1GOATVilisEPBFG9lnjHn3uUcyaZs5VWRw==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@typespec/compiler/-/compiler-1.5.0.tgz", + "integrity": "sha512-REJgZOEZ9g9CC72GGT0+nLbjW+5WVlCfm1d6w18N5RsUo7vLXs8IPXwq7xZJzoqU99Q9B4keqzPuTU4OrDUTrA==", "dev": true, "license": "MIT", "dependencies": { @@ -2586,30 +2592,30 @@ } }, "node_modules/@typespec/events": { - "version": "0.74.0", - "resolved": "https://registry.npmjs.org/@typespec/events/-/events-0.74.0.tgz", - "integrity": "sha512-CY6JTtheMKAUlxiPmwx2fLIAWEwezsXmQYUMRhyuW44Q73unQIkexE43LUnNWOJSZckYucqUp+ihXh7jxzWeVQ==", + "version": "0.75.0", + "resolved": "https://registry.npmjs.org/@typespec/events/-/events-0.75.0.tgz", + "integrity": "sha512-V7unXnj+sZoa/1wQG8G6x2TiQqotx18S/qFbDzdfJRPCVpH/Z3xIpppce4jTZALXT97tKZK5GDHijn2zWuWWxg==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.4.0" + "@typespec/compiler": "^1.5.0" } }, "node_modules/@typespec/http": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@typespec/http/-/http-1.4.0.tgz", - "integrity": "sha512-Y0PDDtBu+oZnwivfhbL0lN6Mk3QiCxZ66DgB5kFjcgKNpnXf0u440PPyaL42a8lbchzz5lVwz+cinyIMI89FIQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@typespec/http/-/http-1.5.0.tgz", + "integrity": "sha512-52XLXwqSY2SY6nSvfkiTsNiJzlMeIAZ6MFIVJ5YkoibA21TNAP4DtjTZgC2GieZLY2NNN/rqDCqBX+DyWqTrfQ==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.4.0", - "@typespec/streams": "^0.74.0" + "@typespec/compiler": "^1.5.0", + "@typespec/streams": "^0.75.0" }, "peerDependenciesMeta": { "@typespec/streams": { @@ -2618,66 +2624,66 @@ } }, "node_modules/@typespec/http-specs": { - "version": "0.1.0-alpha.26", - "resolved": "https://registry.npmjs.org/@typespec/http-specs/-/http-specs-0.1.0-alpha.26.tgz", - "integrity": "sha512-Mhsn6kwj0VU1AMCObuieVDlxGJ49wW8cXTb0E8WNz72CB3R/+ZKKp9Wg/wYrfJurbFEKNBiPu/WWdVJrXWV8Bg==", + "version": "0.1.0-alpha.27", + "resolved": "https://registry.npmjs.org/@typespec/http-specs/-/http-specs-0.1.0-alpha.27.tgz", + "integrity": "sha512-etBPXxx1JODrDSV8+uIOJVpVhOOY7oGHiyru/be/tdUrn8oP6rXSH+yegIujCv/b9y6f1vRGWdg3+qad/0iw7A==", "dev": true, "license": "MIT", "dependencies": { "@typespec/spec-api": "^0.1.0-alpha.9", - "@typespec/spector": "^0.1.0-alpha.18", + "@typespec/spector": "^0.1.0-alpha.19", "deep-equal": "^2.2.0" }, "engines": { "node": ">=16.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.4.0", - "@typespec/http": "^1.4.0", - "@typespec/rest": "^0.74.0", - "@typespec/versioning": "^0.74.0", - "@typespec/xml": "^0.74.0" + "@typespec/compiler": "^1.5.0", + "@typespec/http": "^1.5.0", + "@typespec/rest": "^0.75.0", + "@typespec/versioning": "^0.75.0", + "@typespec/xml": "^0.75.0" } }, "node_modules/@typespec/library-linter": { - "version": "0.74.0", - "resolved": "https://registry.npmjs.org/@typespec/library-linter/-/library-linter-0.74.0.tgz", - "integrity": "sha512-65+e/+RLUD2SoS18xMMDc/O/8Eh4hlmDFUg+D20cni6TSmXYwQB492WOouQKfxGCCcC1jW9jFAR/GqEwGD295Q==", + "version": "0.75.0", + "resolved": "https://registry.npmjs.org/@typespec/library-linter/-/library-linter-0.75.0.tgz", + "integrity": "sha512-oH+Kb+DfkXe9zLlMUX41YcM2rmV9V4XR4LWq9osY5amaAfD5/lSKyDTK96eslyD5o8Nm/f1pLHm1A+Oa4zIelA==", "dev": true, "license": "MIT", "engines": { "node": ">=14.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.4.0" + "@typespec/compiler": "^1.5.0" } }, "node_modules/@typespec/openapi": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-1.4.0.tgz", - "integrity": "sha512-ZfrCsmZG/Zt1laLaWC0pKvnZr4jqrm/YS/YuZe/gVrSYKBxGLopXle7H0wrSSMYkIVCNCLiC68/HqRxV6XTfoA==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-1.5.0.tgz", + "integrity": "sha512-27sXkSK2r1sAmVMLv+pwlN/Cm+yg9nEK8iuGyJRuEkBk7hcsJDbTnBlsEvlRTI8DqljtzA7YECDHBLK88zZHeg==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.4.0", - "@typespec/http": "^1.4.0" + "@typespec/compiler": "^1.5.0", + "@typespec/http": "^1.5.0" } }, "node_modules/@typespec/rest": { - "version": "0.74.0", - "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.74.0.tgz", - "integrity": "sha512-dE+Xmv01AQ7m8jUvEbGsUQLSVo3sLzMpnHRbQEOnJX42oDqtIsz/2GEOXKQpNm1AKBISK66E2FFB5boz999Ziw==", + "version": "0.75.0", + "resolved": "https://registry.npmjs.org/@typespec/rest/-/rest-0.75.0.tgz", + "integrity": "sha512-rQ+RP0kcrKWjbpCIkBd8hpxYSNc3CfQxl0MLP1+MYGRHlHL8ss4xbwdANIYZXZZ2i2Hqt19B7cEUGD4MLoCHvw==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.4.0", - "@typespec/http": "^1.4.0" + "@typespec/compiler": "^1.5.0", + "@typespec/http": "^1.5.0" } }, "node_modules/@typespec/spec-api": { @@ -3009,13 +3015,13 @@ } }, "node_modules/@typespec/spec-coverage-sdk": { - "version": "0.1.0-alpha.10", - "resolved": "https://registry.npmjs.org/@typespec/spec-coverage-sdk/-/spec-coverage-sdk-0.1.0-alpha.10.tgz", - "integrity": "sha512-WmXT8FAsWfsBHR5POQ8hpuKqGR1J+hrERl0FypRGFmPmVwrHOH1ATsv6JLeLEVjpbTWfy00Ly/7b7oVJOfCLPw==", + "version": "0.1.0-alpha.11", + "resolved": "https://registry.npmjs.org/@typespec/spec-coverage-sdk/-/spec-coverage-sdk-0.1.0-alpha.11.tgz", + "integrity": "sha512-v9MYuoodgr9MhkaQfB9UpTrtRvUuENpoUngo+zyr/aqBj1Y5aTInTxecYG/lSQ2BVdSJZeLT89V5LRiyPr08bw==", "dev": true, "license": "MIT", "dependencies": { - "@azure/identity": "~4.11.1", + "@azure/identity": "~4.12.0", "@azure/storage-blob": "~12.28.0", "@types/node": "~24.3.0" }, @@ -3024,20 +3030,20 @@ } }, "node_modules/@typespec/spector": { - "version": "0.1.0-alpha.18", - "resolved": "https://registry.npmjs.org/@typespec/spector/-/spector-0.1.0-alpha.18.tgz", - "integrity": "sha512-DwKUkqkMwfAnDnycDG6GrS9z+24EI/AqnY+bQX9otcbDa+d21RYacKOG70Epjc5aF1T8D/MN4BDOjl8JIHUtvg==", + "version": "0.1.0-alpha.19", + "resolved": "https://registry.npmjs.org/@typespec/spector/-/spector-0.1.0-alpha.19.tgz", + "integrity": "sha512-BsT4LLYrcsiWWz5/CZRNFA4WSglGAVYLJFroGIsRzaiTnkyZuS6tUNze391LSm9yNBGZBJqIDdR76DgI+8ybCw==", "dev": true, "license": "MIT", "dependencies": { - "@azure/identity": "~4.11.1", + "@azure/identity": "~4.12.0", "@types/js-yaml": "^4.0.5", - "@typespec/compiler": "^1.4.0", - "@typespec/http": "^1.4.0", - "@typespec/rest": "^0.74.0", + "@typespec/compiler": "^1.5.0", + "@typespec/http": "^1.5.0", + "@typespec/rest": "^0.75.0", "@typespec/spec-api": "^0.1.0-alpha.9", - "@typespec/spec-coverage-sdk": "^0.1.0-alpha.10", - "@typespec/versioning": "^0.74.0", + "@typespec/spec-coverage-sdk": "^0.1.0-alpha.11", + "@typespec/versioning": "^0.75.0", "ajv": "~8.17.1", "body-parser": "^2.2.0", "deep-equal": "^2.2.0", @@ -3159,9 +3165,9 @@ } }, "node_modules/@typespec/spector/node_modules/debug": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", - "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", "dev": true, "license": "MIT", "dependencies": { @@ -3501,32 +3507,32 @@ } }, "node_modules/@typespec/sse": { - "version": "0.74.0", - "resolved": "https://registry.npmjs.org/@typespec/sse/-/sse-0.74.0.tgz", - "integrity": "sha512-+m7/elbGp7q/kqCGaBRj8v8wVMWKVEV8AsZOjf1PY2MkMUrux9ivOijBIktgoLBXDn+ocO2qVfFrHWG2slZSaw==", + "version": "0.75.0", + "resolved": "https://registry.npmjs.org/@typespec/sse/-/sse-0.75.0.tgz", + "integrity": "sha512-8iODUY3C/0hR9sTzyHeTgYfZkKeqZM+/P0OmN1ZWlLUokXQ67yydGXIqnjl+yaeuntwN8H2DDwLguU15c+j+UQ==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.4.0", - "@typespec/events": "^0.74.0", - "@typespec/http": "^1.4.0", - "@typespec/streams": "^0.74.0" + "@typespec/compiler": "^1.5.0", + "@typespec/events": "^0.75.0", + "@typespec/http": "^1.5.0", + "@typespec/streams": "^0.75.0" } }, "node_modules/@typespec/streams": { - "version": "0.74.0", - "resolved": "https://registry.npmjs.org/@typespec/streams/-/streams-0.74.0.tgz", - "integrity": "sha512-LIWizQgzGt8qN8ravte4DrPLPNOk9ge73bV9Us2TOECagTVQWwgMVy7+o/Beff3sOLQO/sEOwfzvmnNpSlauHg==", + "version": "0.75.0", + "resolved": "https://registry.npmjs.org/@typespec/streams/-/streams-0.75.0.tgz", + "integrity": "sha512-ubvxCN+SZwN9aEarz8CPtMJgnopeu8dXyut47q0FAPp9nykmXy7s+dmsopR+7OX0Fhcnh8ZFYTQcJzJ3QftOiQ==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.4.0" + "@typespec/compiler": "^1.5.0" } }, "node_modules/@typespec/ts-http-runtime": { @@ -3545,29 +3551,29 @@ } }, "node_modules/@typespec/versioning": { - "version": "0.74.0", - "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.74.0.tgz", - "integrity": "sha512-eFIa23tycWJgv3Lxyu6jUlRi02dhtQE4Jjx3Ui5vEbwHW8pMEzuyF7ALt1c+V9HOLkfDkS4dJkiOVIoikZHPvQ==", + "version": "0.75.0", + "resolved": "https://registry.npmjs.org/@typespec/versioning/-/versioning-0.75.0.tgz", + "integrity": "sha512-wdLcVx5UW4WRks/OXfqLiaDTtWfAWgv/nj69u99gRJU6iY9ExEvK5x9NQszZQKYnu6tM7nkoYMg4zu+7YBUBaw==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.4.0" + "@typespec/compiler": "^1.5.0" } }, "node_modules/@typespec/xml": { - "version": "0.74.0", - "resolved": "https://registry.npmjs.org/@typespec/xml/-/xml-0.74.0.tgz", - "integrity": "sha512-NiXatOfpyPxU94f2tEBAygxJeS7CvIr5lvnfZkC0tUHwkiJeLrI1jt13kDVB5CE6zNK6I3d7c37xsQs9WXGFAQ==", + "version": "0.75.0", + "resolved": "https://registry.npmjs.org/@typespec/xml/-/xml-0.75.0.tgz", + "integrity": "sha512-JVafN1nZE3BcQrKbaAFVWw/IleTRdsJpwT3oZ2m7EfWnG30sKtoR9inF9dRoW+XXIjNzCfeYqjkwzEkEnIrCww==", "dev": true, "license": "MIT", "engines": { "node": ">=20.0.0" }, "peerDependencies": { - "@typespec/compiler": "^1.4.0" + "@typespec/compiler": "^1.5.0" } }, "node_modules/@vitest/expect": { @@ -8897,26 +8903,26 @@ "@autorest/csharp": "3.0.0-beta.20240625.4" }, "devDependencies": { - "@azure-tools/typespec-autorest": "0.60.0", - "@azure-tools/typespec-azure-core": "0.60.0", - "@azure-tools/typespec-azure-resource-manager": "0.60.0", - "@azure-tools/typespec-azure-rulesets": "0.60.0", - "@azure-tools/typespec-client-generator-core": "0.60.0", - "@azure-tools/typespec-liftr-base": "0.8.0", + "@azure-tools/typespec-autorest": "0.61.0", + "@azure-tools/typespec-azure-core": "0.61.0", + "@azure-tools/typespec-azure-resource-manager": "0.61.0", + "@azure-tools/typespec-azure-rulesets": "0.61.0", + "@azure-tools/typespec-client-generator-core": "0.61.0", + "@azure-tools/typespec-liftr-base": "0.10.0", "@eslint/js": "^9.15.0", "@types/mocha": "~10.0.9", "@types/node": "~22.7.9", "@types/prettier": "^2.6.3", - "@typespec/compiler": "1.4.0", - "@typespec/events": "0.74.0", - "@typespec/http": "1.4.0", - "@typespec/library-linter": "0.74.0", - "@typespec/openapi": "1.4.0", - "@typespec/rest": "0.74.0", - "@typespec/sse": "0.74.0", - "@typespec/streams": "0.74.0", - "@typespec/versioning": "0.74.0", - "@typespec/xml": "0.74.0", + "@typespec/compiler": "1.5.0", + "@typespec/events": "0.75.0", + "@typespec/http": "1.5.0", + "@typespec/library-linter": "0.75.0", + "@typespec/openapi": "1.5.0", + "@typespec/rest": "0.75.0", + "@typespec/sse": "0.75.0", + "@typespec/streams": "0.75.0", + "@typespec/versioning": "0.75.0", + "@typespec/xml": "0.75.0", "eslint": "^9.15.0", "globals": "^15.2.0", "prettier": "^3.3.3", @@ -8926,21 +8932,21 @@ "vitest": "^2.1.5" }, "peerDependencies": { - "@azure-tools/typespec-autorest": ">=0.60.0 <0.61.0 || ~0.61.0-0", - "@azure-tools/typespec-azure-core": ">=0.60.0 <0.61.0 || ~0.61.0-0", - "@azure-tools/typespec-azure-resource-manager": ">=0.60.0 <0.61.0 || ~0.61.0-0", - "@azure-tools/typespec-azure-rulesets": ">=0.60.0 <0.61.0 || ~0.61.0-0", - "@azure-tools/typespec-client-generator-core": ">=0.60.0 <0.61.0 || ~0.61.0-0", - "@azure-tools/typespec-liftr-base": ">=0.6.0 <1.0.0", - "@typespec/compiler": "^1.4.0", - "@typespec/events": ">=0.74.0 <1.0.0", - "@typespec/http": "^1.4.0", - "@typespec/openapi": "^1.4.0", - "@typespec/rest": ">=0.74.0 <1.0.0", - "@typespec/sse": ">=0.74.0 <1.0.0", - "@typespec/streams": ">=0.74.0 <1.0.0", - "@typespec/versioning": ">=0.74.0 <1.0.0", - "@typespec/xml": ">=0.74.0 <1.0.0" + "@azure-tools/typespec-autorest": ">=0.61.0 <0.62.0 || ~0.62.0-0", + "@azure-tools/typespec-azure-core": ">=0.61.0 <0.62.0 || ~0.62.0-0", + "@azure-tools/typespec-azure-resource-manager": ">=0.61.0 <0.62.0 || ~0.62.0-0", + "@azure-tools/typespec-azure-rulesets": ">=0.61.0 <0.62.0 || ~0.62.0-0", + "@azure-tools/typespec-client-generator-core": ">=0.61.0 <0.62.0 || ~0.62.0-0", + "@azure-tools/typespec-liftr-base": ">=0.10.0 <1.0.0", + "@typespec/compiler": "^1.5.0", + "@typespec/events": ">=0.75.0 <1.0.0", + "@typespec/http": "^1.5.0", + "@typespec/openapi": "^1.5.0", + "@typespec/rest": ">=0.75.0 <1.0.0", + "@typespec/sse": ">=0.75.0 <1.0.0", + "@typespec/streams": ">=0.75.0 <1.0.0", + "@typespec/versioning": ">=0.75.0 <1.0.0", + "@typespec/xml": ">=0.75.0 <1.0.0" } }, "src/TypeSpec.Extension/Emitter.Csharp/node_modules/@types/node": { @@ -8964,21 +8970,7 @@ "name": "@azure-tools/unbranded-tests", "dev": true, "devDependencies": { - "@typespec/openapi": "1.1.0" - } - }, - "test/UnbrandedProjects/node_modules/@typespec/openapi": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@typespec/openapi/-/openapi-1.1.0.tgz", - "integrity": "sha512-HPvrpSS7eSVk3fEkWndcDTrAZssWRYv3FyDTqVqljildc7FAiXdo88+r5CCK8endmgIrES7uJdHLkcIGUZx1pg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "@typespec/compiler": "^1.1.0", - "@typespec/http": "^1.1.0" + "@typespec/openapi": "1.5.0" } } } diff --git a/package.json b/package.json index 216b091bf82..08280291320 100644 --- a/package.json +++ b/package.json @@ -12,11 +12,11 @@ "url": "https://github.com/Azure/autorest.csharp/issues" }, "devDependencies": { - "@typespec/http-specs": "0.1.0-alpha.26", - "@typespec/spector": "0.1.0-alpha.18", - "@azure-tools/azure-http-specs": "0.1.0-alpha.28", - "@azure-tools/typespec-azure-resource-manager": "0.60.0", - "@azure-tools/typespec-client-generator-core": "0.60.0", + "@typespec/http-specs": "0.1.0-alpha.27", + "@typespec/spector": "0.1.0-alpha.19", + "@azure-tools/azure-http-specs": "0.1.0-alpha.30", + "@azure-tools/typespec-azure-resource-manager": "0.61.0", + "@azure-tools/typespec-client-generator-core": "0.61.0", "@azure-tools/typespec-csharp": "file:src/TypeSpec.Extension/Emitter.Csharp", "@azure-tools/unbranded-tests": "file:test/UnbrandedProjects", "@microsoft.azure/autorest.testserver": "3.3.50", diff --git a/samples/AnomalyDetector/main.tsp b/samples/AnomalyDetector/main.tsp index 973f0ee8d17..a435ff8d7d5 100644 --- a/samples/AnomalyDetector/main.tsp +++ b/samples/AnomalyDetector/main.tsp @@ -47,6 +47,5 @@ discover incidents and establish a logic flow for root cause analysis. namespace AnomalyDetector; enum Versions { - @useDependency(Azure.Core.Versions.v1_0_Preview_2) v1_1: "v1.1", } diff --git a/samples/AnomalyDetector/multivariate/models.tsp b/samples/AnomalyDetector/multivariate/models.tsp index 04b44d4e557..56b73140c61 100644 --- a/samples/AnomalyDetector/multivariate/models.tsp +++ b/samples/AnomalyDetector/multivariate/models.tsp @@ -329,10 +329,9 @@ information. } @doc("Response of listing models.") -@pagedResult model ModelList { @doc("List of models.") - @items + @pageItems models: AnomalyDetectionModel[]; @doc("Number of trained multivariate models.") diff --git a/samples/AnomalyDetector/multivariate/routes.tsp b/samples/AnomalyDetector/multivariate/routes.tsp index 07b827eb3fd..11ca69539e0 100644 --- a/samples/AnomalyDetector/multivariate/routes.tsp +++ b/samples/AnomalyDetector/multivariate/routes.tsp @@ -50,6 +50,7 @@ op TrainMultivariateModel( @route("/multivariate/models") @summary("List Multivariate Models") @doc("List models of a resource.") +@list // To improve CADL implementation apply: https://github.com/Azure/azure-rest-api-specs/issues/21527 op ListMultivariateModels( @doc("Skip indicates how many models will be skipped.") diff --git a/samples/AzureSample.ResourceManager.Sample/src/AzureSample.ResourceManager.Sample.csproj b/samples/AzureSample.ResourceManager.Sample/src/AzureSample.ResourceManager.Sample.csproj index 9c82af6d7ea..9205597615a 100644 --- a/samples/AzureSample.ResourceManager.Sample/src/AzureSample.ResourceManager.Sample.csproj +++ b/samples/AzureSample.ResourceManager.Sample/src/AzureSample.ResourceManager.Sample.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider Sample. 1.0.0-beta.1 azure;management;arm;resource manager;sample + true AzureSample.ResourceManager.Sample diff --git a/samples/AzureSample.ResourceManager.Storage/src/AzureSample.ResourceManager.Storage.csproj b/samples/AzureSample.ResourceManager.Storage/src/AzureSample.ResourceManager.Storage.csproj index 3af0fe7c213..a8731132cf8 100644 --- a/samples/AzureSample.ResourceManager.Storage/src/AzureSample.ResourceManager.Storage.csproj +++ b/samples/AzureSample.ResourceManager.Storage/src/AzureSample.ResourceManager.Storage.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider Storage. 1.0.0-beta.1 azure;management;arm;resource manager;storage + true AzureSample.ResourceManager.Storage diff --git a/src/AutoRest.CSharp/Common/AutoRest/Plugins/GeneratedCodeWorkspace.cs b/src/AutoRest.CSharp/Common/AutoRest/Plugins/GeneratedCodeWorkspace.cs index 4e570f8371b..efee2819616 100644 --- a/src/AutoRest.CSharp/Common/AutoRest/Plugins/GeneratedCodeWorkspace.cs +++ b/src/AutoRest.CSharp/Common/AutoRest/Plugins/GeneratedCodeWorkspace.cs @@ -181,6 +181,32 @@ internal static ImmutableHashSet GetSuppressedTypeNames(Compilation comp .ToImmutableHashSet(); } + internal static IReadOnlyList<(string Name, object Value)> GetConfigurationsFromAttribute(Compilation compilation) + { + var configAttribute = compilation.GetTypeByMetadataName(typeof(CodeGenConfigAttribute).FullName!)!; + var attributes = compilation.Assembly.GetAttributes() + .Where(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, configAttribute)); + + return attributes.Select(a => + ( + Name: (string)a.ConstructorArguments[0].Value!, + Value: ParseValue(a.ConstructorArguments[1]) + )).ToList(); + + static object ParseValue(TypedConstant value) + { + switch (value.Kind) + { + case TypedConstantKind.Primitive: + return value.Value!; + case TypedConstantKind.Array: + return value.Values.Select(ParseValue).ToArray(); + default: + throw new InvalidOperationException($"Unsupported type of argument {value}"); + } + } + } + /// /// Add some additional files into this project /// diff --git a/src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs b/src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs index d9b4331b7c1..4434ef72607 100644 --- a/src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs +++ b/src/AutoRest.CSharp/Common/AutoRest/Plugins/NewProjectScaffolding.cs @@ -150,6 +150,7 @@ private string GetBrandedSrcCSProj() PackageTags = !Configuration.AzureArm ? Configuration.Namespace : $"azure;management;arm;resource manager;{Configuration.Namespace.Split('.').Last().ToLower()}", TargetFrameworks = !Configuration.AzureArm ? new CSProjProperty("$(RequiredTargetFrameworks)") : null, IncludeOperationsSharedSource = !Configuration.AzureArm ? new CSProjProperty("true") : null, + IncludeAutorestDependency = Configuration.AzureArm ? new CSProjProperty("true") : null, }; if (Configuration.AzureArm) { diff --git a/src/AutoRest.CSharp/Common/Generation/Writers/CSProjWriter.cs b/src/AutoRest.CSharp/Common/Generation/Writers/CSProjWriter.cs index 07903271065..c46bc659886 100644 --- a/src/AutoRest.CSharp/Common/Generation/Writers/CSProjWriter.cs +++ b/src/AutoRest.CSharp/Common/Generation/Writers/CSProjWriter.cs @@ -47,6 +47,8 @@ public CSProjWriter() public CSProjProperty? IncludeGeneratorSharedCode { get; init; } + public CSProjProperty? IncludeAutorestDependency { get; init; } + public CSProjProperty? DefineConstants { get; init; } public CSProjProperty? RestoreAdditionalProjectSources { get; init; } diff --git a/src/AutoRest.CSharp/Common/Generation/Writers/JsonCodeWriterExtensions.cs b/src/AutoRest.CSharp/Common/Generation/Writers/JsonCodeWriterExtensions.cs index d03aba214d4..a38982a3e37 100644 --- a/src/AutoRest.CSharp/Common/Generation/Writers/JsonCodeWriterExtensions.cs +++ b/src/AutoRest.CSharp/Common/Generation/Writers/JsonCodeWriterExtensions.cs @@ -80,13 +80,16 @@ public static FormattableString GetFrameworkTypeValueFormattable(Type frameworkT if (frameworkType == typeof(TimeSpan)) { - if (format is SerializationFormat.Duration_Seconds) - { - return $"{typeof(TimeSpan)}.FromSeconds({element}.GetInt32())"; - } - else if (format is SerializationFormat.Duration_Seconds_Float or SerializationFormat.Duration_Seconds_Double) + switch (format) { - return $"{typeof(TimeSpan)}.FromSeconds({element}.GetDouble())"; + case SerializationFormat.Duration_Seconds: + return $"{typeof(TimeSpan)}.FromSeconds({element}.GetInt32())"; + case SerializationFormat.Duration_Seconds_Float or SerializationFormat.Duration_Seconds_Double: + return $"{typeof(TimeSpan)}.FromSeconds({element}.GetDouble())"; + case SerializationFormat.Duration_Milliseconds: + return $"{typeof(TimeSpan)}.FromMilliseconds({element}.GetInt32())"; + case SerializationFormat.Duration_Milliseconds_Float or SerializationFormat.Duration_Milliseconds_Double: + return $"{typeof(TimeSpan)}.FromMilliseconds({element}.GetDouble())"; } } diff --git a/src/AutoRest.CSharp/Common/Input/InputTypes/DurationKnownEncoding.cs b/src/AutoRest.CSharp/Common/Input/InputTypes/DurationKnownEncoding.cs index 0a67941a13c..cdc70755972 100644 --- a/src/AutoRest.CSharp/Common/Input/InputTypes/DurationKnownEncoding.cs +++ b/src/AutoRest.CSharp/Common/Input/InputTypes/DurationKnownEncoding.cs @@ -5,5 +5,5 @@ namespace AutoRest.CSharp.Common.Input; internal enum DurationKnownEncoding { - Iso8601, Seconds, DurationConstant + Iso8601, Seconds, DurationConstant, Milliseconds } diff --git a/src/AutoRest.CSharp/Common/Output/Builders/JsonSerializationMethodsBuilder.cs b/src/AutoRest.CSharp/Common/Output/Builders/JsonSerializationMethodsBuilder.cs index 2c8585c2305..ef0e1a136ba 100644 --- a/src/AutoRest.CSharp/Common/Output/Builders/JsonSerializationMethodsBuilder.cs +++ b/src/AutoRest.CSharp/Common/Output/Builders/JsonSerializationMethodsBuilder.cs @@ -524,6 +524,16 @@ private static MethodBodyStatement SerializeFrameworkTypeValue(Utf8JsonWriterExp return utf8JsonWriter.WriteNumberValue(InvokeConvert.ToDouble(new TimeSpanExpression(value).InvokeToString(format))); } + if (valueSerialization.Format is SerializationFormat.Duration_Milliseconds) + { + return utf8JsonWriter.WriteNumberValue(InvokeConvert.ToInt32(new TimeSpanExpression(value).InvokeToString(format))); + } + + if (valueSerialization.Format is SerializationFormat.Duration_Milliseconds_Float or SerializationFormat.Duration_Milliseconds_Double) + { + return utf8JsonWriter.WriteNumberValue(InvokeConvert.ToDouble(new TimeSpanExpression(value).InvokeToString(format))); + } + if (valueSerialization.Format is SerializationFormat.DateTime_Unix) { return utf8JsonWriter.WriteNumberValue(value, format); @@ -1258,6 +1268,16 @@ public static ValueExpression GetFrameworkTypeValueExpression(CSharpType seriali return TimeSpanExpression.FromSeconds(element.GetDouble()); } + if (format is SerializationFormat.Duration_Milliseconds) + { + return TimeSpanExpression.FromMilliseconds(element.GetInt32()); + } + + if (format is SerializationFormat.Duration_Milliseconds_Float or SerializationFormat.Duration_Milliseconds_Double) + { + return TimeSpanExpression.FromMilliseconds(element.GetDouble()); + } + return element.GetTimeSpan(format.ToFormatSpecifier()); } diff --git a/src/AutoRest.CSharp/Common/Output/Builders/SerializationBuilder.cs b/src/AutoRest.CSharp/Common/Output/Builders/SerializationBuilder.cs index 40bd8527141..99aab4f2579 100644 --- a/src/AutoRest.CSharp/Common/Output/Builders/SerializationBuilder.cs +++ b/src/AutoRest.CSharp/Common/Output/Builders/SerializationBuilder.cs @@ -72,6 +72,12 @@ public static SerializationFormat GetDefaultSerializationFormat(CSharpType type) InputPrimitiveTypeKind.Float or InputPrimitiveTypeKind.Float32 => SerializationFormat.Duration_Seconds_Float, _ => SerializationFormat.Duration_Seconds_Double }, + DurationKnownEncoding.Milliseconds => durationType.WireType.Kind switch + { + InputPrimitiveTypeKind.Int32 => SerializationFormat.Duration_Milliseconds, + InputPrimitiveTypeKind.Float or InputPrimitiveTypeKind.Float32 => SerializationFormat.Duration_Milliseconds_Float, + _ => SerializationFormat.Duration_Milliseconds_Double + }, DurationKnownEncoding.DurationConstant => SerializationFormat.Duration_Constant, _ => throw new IndexOutOfRangeException($"unknown encode {durationType.Encode}") }, diff --git a/src/AutoRest.CSharp/Common/Output/Expressions/KnownValueExpressions/TimeSpanExpression.cs b/src/AutoRest.CSharp/Common/Output/Expressions/KnownValueExpressions/TimeSpanExpression.cs index 3865a720bca..967db577860 100644 --- a/src/AutoRest.CSharp/Common/Output/Expressions/KnownValueExpressions/TimeSpanExpression.cs +++ b/src/AutoRest.CSharp/Common/Output/Expressions/KnownValueExpressions/TimeSpanExpression.cs @@ -15,6 +15,8 @@ public StringExpression InvokeToString(ValueExpression format, ValueExpression f public static TimeSpanExpression FromSeconds(ValueExpression value) => new(InvokeStatic(nameof(TimeSpan.FromSeconds), value)); + public static TimeSpanExpression FromMilliseconds(ValueExpression value) => new(InvokeStatic(nameof(TimeSpan.FromMilliseconds), value)); + public static TimeSpanExpression ParseExact(ValueExpression value, ValueExpression format, ValueExpression formatProvider) => new(new InvokeStaticMethodExpression(typeof(TimeSpan), nameof(TimeSpan.ParseExact), new[] { value, format, formatProvider })); } diff --git a/src/AutoRest.CSharp/Common/Output/Expressions/Samples/Snippets.ExampleValues.cs b/src/AutoRest.CSharp/Common/Output/Expressions/Samples/Snippets.ExampleValues.cs index 89111e852a5..caa1df0ed06 100644 --- a/src/AutoRest.CSharp/Common/Output/Expressions/Samples/Snippets.ExampleValues.cs +++ b/src/AutoRest.CSharp/Common/Output/Expressions/Samples/Snippets.ExampleValues.cs @@ -93,6 +93,10 @@ private static ValueExpression GetExpressionForFrameworkType(Type frameworkType, if (rawValue.RawValue is int or float or double) return new InvokeStaticMethodExpression(typeof(TimeSpan), nameof(TimeSpan.FromSeconds), new[] { Literal(rawValue.RawValue) }); break; + case SerializationFormat.Duration_Milliseconds or SerializationFormat.Duration_Milliseconds_Float or SerializationFormat.Duration_Milliseconds_Double: + if (rawValue.RawValue is int or float or double) + return new InvokeStaticMethodExpression(typeof(TimeSpan), nameof(TimeSpan.FromMilliseconds), new[] { Literal(rawValue.RawValue) }); + break; case SerializationFormat.Duration_ISO8601: if (rawValue.RawValue is string duration) return new InvokeStaticMethodExpression(typeof(XmlConvert), nameof(XmlConvert.ToTimeSpan), new[] { Literal(duration) }); diff --git a/src/AutoRest.CSharp/Common/Output/Models/Serialization/SerializationFormat.cs b/src/AutoRest.CSharp/Common/Output/Models/Serialization/SerializationFormat.cs index b642dd63b10..b4f26f7872e 100644 --- a/src/AutoRest.CSharp/Common/Output/Models/Serialization/SerializationFormat.cs +++ b/src/AutoRest.CSharp/Common/Output/Models/Serialization/SerializationFormat.cs @@ -17,6 +17,9 @@ internal enum SerializationFormat Duration_Seconds, Duration_Seconds_Float, Duration_Seconds_Double, + Duration_Milliseconds, + Duration_Milliseconds_Float, + Duration_Milliseconds_Double, Time_ISO8601, Bytes_Base64Url, Bytes_Base64, diff --git a/src/AutoRest.CSharp/Common/Output/Models/Serialization/SerializationFormatExtensions.cs b/src/AutoRest.CSharp/Common/Output/Models/Serialization/SerializationFormatExtensions.cs index a235df5a569..e6590b54b6e 100644 --- a/src/AutoRest.CSharp/Common/Output/Models/Serialization/SerializationFormatExtensions.cs +++ b/src/AutoRest.CSharp/Common/Output/Models/Serialization/SerializationFormatExtensions.cs @@ -20,6 +20,9 @@ internal static class SerializationFormatExtensions SerializationFormat.Duration_Seconds => "%s", SerializationFormat.Duration_Seconds_Float => "s\\.FFF", SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", + SerializationFormat.Duration_Milliseconds => "%s", + SerializationFormat.Duration_Milliseconds_Float => "s\\.FFF", + SerializationFormat.Duration_Milliseconds_Double => "s\\.FFFFFF", SerializationFormat.Time_ISO8601 => "T", _ => null }; diff --git a/src/AutoRest.CSharp/Mgmt/AutoRest/MgmtConfiguration.cs b/src/AutoRest.CSharp/Mgmt/AutoRest/MgmtConfiguration.cs index 7f4609fe23e..5a124e95352 100644 --- a/src/AutoRest.CSharp/Mgmt/AutoRest/MgmtConfiguration.cs +++ b/src/AutoRest.CSharp/Mgmt/AutoRest/MgmtConfiguration.cs @@ -10,6 +10,7 @@ using AutoRest.CSharp.Common.Input; using AutoRest.CSharp.Mgmt.Models; using AutoRest.CSharp.Mgmt.Report; +using AutoRest.CSharp.Utilities; namespace AutoRest.CSharp.Input { @@ -243,7 +244,7 @@ private static Dictionary DeserializeDictionary(Json public IReadOnlyDictionary OperationPositions { get; } public IReadOnlyDictionary MergeOperations { get; } public IReadOnlyDictionary PartialResources { get; } - public IReadOnlyList RawParameterizedScopes { get; } + public IReadOnlyList RawParameterizedScopes { get; private set; } private ImmutableHashSet? _parameterizedScopes; internal ImmutableHashSet ParameterizedScopes => _parameterizedScopes ??= RawParameterizedScopes.Select(scope => RequestPath.FromString(scope)).ToImmutableHashSet(); @@ -312,6 +313,43 @@ internal static MgmtConfiguration GetConfiguration(IPluginCommunication autoRest operationsToLroApiVersionOverride: autoRest.GetValue("operations-to-lro-api-version-override").GetAwaiter().GetResult()); } + internal void Update(IReadOnlyList<(string Name, object Value)> configurations) + { + foreach (var (name, value) in configurations) + { + HandleConfiguration(name, value); + } + + void HandleConfiguration(string name, object value) + { + switch (name) + { + case "request-path-to-resource-name": + // update the request-path-to-resource-name mapping, this is a dictionary, therefore we expect the values here are array with 2 string elements. + if (value is object[] array && array.Length == 2) + { + var requestPath = array[0] as string; + var resourceName = array[1] as string; + if (requestPath != null && resourceName != null) + { + ((Dictionary)RequestPathToResourceName)[requestPath] = resourceName; + } + } + break; + case "parameterized-scopes": + // update the parameterized scopes, this is a list of strings + if (value is object[] array2) + { + var scopes = array2.Select(i => i as string).WhereNotNull(); + List rawScopes = RawParameterizedScopes is List s ? s : new List(RawParameterizedScopes); + rawScopes.AddRange(scopes); + RawParameterizedScopes = rawScopes; + } + break; + } + } + } + private static JsonElement? GetAcronymMappingConfig(IPluginCommunication autoRest) { var newValue = autoRest.GetValue(TransformTypeName.AcronymMapping).GetAwaiter().GetResult(); diff --git a/src/AutoRest.CSharp/Mgmt/AutoRest/MgmtTarget.cs b/src/AutoRest.CSharp/Mgmt/AutoRest/MgmtTarget.cs index 3ebd033b77c..74f6257b897 100644 --- a/src/AutoRest.CSharp/Mgmt/AutoRest/MgmtTarget.cs +++ b/src/AutoRest.CSharp/Mgmt/AutoRest/MgmtTarget.cs @@ -63,6 +63,10 @@ private static void AddGeneratedFile(GeneratedCodeWorkspace project, string file public static async Task ExecuteAsync(GeneratedCodeWorkspace project) { + // populate configurations read from the attribute + var configurations = GeneratedCodeWorkspace.GetConfigurationsFromAttribute(await project.GetCompilationAsync()); + Configuration.MgmtConfiguration.Update(configurations); + var addedFilenames = new HashSet(); var serializeWriter = new SerializationWriter(); var isArmCore = Configuration.MgmtConfiguration.IsArmCore; diff --git a/src/TypeSpec.Extension/Emitter.Csharp/package.json b/src/TypeSpec.Extension/Emitter.Csharp/package.json index db70220e5e4..5abdc5f71b6 100644 --- a/src/TypeSpec.Extension/Emitter.Csharp/package.json +++ b/src/TypeSpec.Extension/Emitter.Csharp/package.json @@ -37,43 +37,43 @@ "@autorest/csharp": "3.0.0-beta.20240625.4" }, "peerDependencies": { - "@azure-tools/typespec-azure-core": ">=0.60.0 <0.61.0 || ~0.61.0-0", - "@azure-tools/typespec-client-generator-core": ">=0.60.0 <0.61.0 || ~0.61.0-0", - "@azure-tools/typespec-azure-resource-manager": ">=0.60.0 <0.61.0 || ~0.61.0-0", - "@azure-tools/typespec-azure-rulesets": ">=0.60.0 <0.61.0 || ~0.61.0-0", - "@azure-tools/typespec-autorest": ">=0.60.0 <0.61.0 || ~0.61.0-0", - "@azure-tools/typespec-liftr-base": ">=0.6.0 <1.0.0", - "@typespec/compiler": "^1.4.0", - "@typespec/events": ">=0.74.0 <1.0.0", - "@typespec/http": "^1.4.0", - "@typespec/openapi": "^1.4.0", - "@typespec/rest": ">=0.74.0 <1.0.0", - "@typespec/sse": ">=0.74.0 <1.0.0", - "@typespec/streams": ">=0.74.0 <1.0.0", - "@typespec/versioning": ">=0.74.0 <1.0.0", - "@typespec/xml": ">=0.74.0 <1.0.0" + "@azure-tools/typespec-azure-core": ">=0.61.0 <0.62.0 || ~0.62.0-0", + "@azure-tools/typespec-client-generator-core": ">=0.61.0 <0.62.0 || ~0.62.0-0", + "@azure-tools/typespec-azure-resource-manager": ">=0.61.0 <0.62.0 || ~0.62.0-0", + "@azure-tools/typespec-azure-rulesets": ">=0.61.0 <0.62.0 || ~0.62.0-0", + "@azure-tools/typespec-autorest": ">=0.61.0 <0.62.0 || ~0.62.0-0", + "@azure-tools/typespec-liftr-base": ">=0.10.0 <1.0.0", + "@typespec/compiler": "^1.5.0", + "@typespec/events": ">=0.75.0 <1.0.0", + "@typespec/http": "^1.5.0", + "@typespec/openapi": "^1.5.0", + "@typespec/rest": ">=0.75.0 <1.0.0", + "@typespec/sse": ">=0.75.0 <1.0.0", + "@typespec/streams": ">=0.75.0 <1.0.0", + "@typespec/versioning": ">=0.75.0 <1.0.0", + "@typespec/xml": ">=0.75.0 <1.0.0" }, "devDependencies": { - "@azure-tools/typespec-azure-core": "0.60.0", - "@azure-tools/typespec-client-generator-core": "0.60.0", - "@azure-tools/typespec-azure-resource-manager": "0.60.0", - "@azure-tools/typespec-azure-rulesets": "0.60.0", - "@azure-tools/typespec-autorest": "0.60.0", - "@azure-tools/typespec-liftr-base": "0.8.0", + "@azure-tools/typespec-azure-core": "0.61.0", + "@azure-tools/typespec-client-generator-core": "0.61.0", + "@azure-tools/typespec-azure-resource-manager": "0.61.0", + "@azure-tools/typespec-azure-rulesets": "0.61.0", + "@azure-tools/typespec-autorest": "0.61.0", + "@azure-tools/typespec-liftr-base": "0.10.0", "@eslint/js": "^9.15.0", "@types/mocha": "~10.0.9", "@types/node": "~22.7.9", "@types/prettier": "^2.6.3", - "@typespec/compiler": "1.4.0", - "@typespec/events": "0.74.0", - "@typespec/http": "1.4.0", - "@typespec/library-linter": "0.74.0", - "@typespec/openapi": "1.4.0", - "@typespec/rest": "0.74.0", - "@typespec/sse": "0.74.0", - "@typespec/streams": "0.74.0", - "@typespec/versioning": "0.74.0", - "@typespec/xml": "0.74.0", + "@typespec/compiler": "1.5.0", + "@typespec/events": "0.75.0", + "@typespec/http": "1.5.0", + "@typespec/library-linter": "0.75.0", + "@typespec/openapi": "1.5.0", + "@typespec/rest": "0.75.0", + "@typespec/sse": "0.75.0", + "@typespec/streams": "0.75.0", + "@typespec/versioning": "0.75.0", + "@typespec/xml": "0.75.0", "eslint": "^9.15.0", "globals": "^15.2.0", "prettier": "^3.3.3", diff --git a/src/assets/Azure.Core.Shared/StringRequestContent.cs b/src/assets/Azure.Core.Shared/StringRequestContent.cs index 58a40c46661..aa95208d503 100644 --- a/src/assets/Azure.Core.Shared/StringRequestContent.cs +++ b/src/assets/Azure.Core.Shared/StringRequestContent.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Buffers; using System.IO; using System.Text; using System.Threading; @@ -11,39 +12,50 @@ namespace Azure.Core { internal class StringRequestContent : RequestContent { - private readonly byte[] _bytes; + private readonly byte[] _buffer; + private readonly int _actualByteCount; public StringRequestContent(string value) { - _bytes = Encoding.UTF8.GetBytes(value); +#if NET6_0_OR_GREATER + var byteCount = Encoding.UTF8.GetMaxByteCount(value.Length); + _buffer = ArrayPool.Shared.Rent(byteCount); + _actualByteCount = Encoding.UTF8.GetBytes(value, _buffer); +#else + _buffer = Encoding.UTF8.GetBytes(value); + _actualByteCount = _buffer.Length; +#endif } public override async Task WriteToAsync(Stream stream, CancellationToken cancellation) { #if NET6_0_OR_GREATER - await stream.WriteAsync(_bytes.AsMemory(), cancellation).ConfigureAwait(false); + await stream.WriteAsync(_buffer.AsMemory(0, _actualByteCount), cancellation).ConfigureAwait(false); #else - await stream.WriteAsync(_bytes, 0, _bytes.Length, cancellation).ConfigureAwait(false); + await stream.WriteAsync(_buffer, 0, _actualByteCount, cancellation).ConfigureAwait(false); #endif } public override void WriteTo(Stream stream, CancellationToken cancellation) { #if NET6_0_OR_GREATER - stream.Write(_bytes.AsSpan()); + stream.Write(_buffer.AsSpan(0, _actualByteCount)); #else - stream.Write(_bytes, 0, _bytes.Length); + stream.Write(_buffer, 0, _actualByteCount); #endif } public override bool TryComputeLength(out long length) { - length = _bytes.Length; + length = _actualByteCount; return true; } public override void Dispose() { +#if NET6_0_OR_GREATER + ArrayPool.Shared.Return(_buffer, clearArray: true); +#endif } } } diff --git a/src/assets/Generator.Shared/CodeGenConfigAttribute.cs b/src/assets/Generator.Shared/CodeGenConfigAttribute.cs new file mode 100644 index 00000000000..bf7bc6085e1 --- /dev/null +++ b/src/assets/Generator.Shared/CodeGenConfigAttribute.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable enable + +using System; + +namespace Azure.Core +{ + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] + internal class CodeGenConfigAttribute : Attribute + { + public string Name { get; } + public object Value { get; } + + public CodeGenConfigAttribute(string name, object value) + { + Name = name; + Value = value; + } + } +} diff --git a/test/CadlRanchProjects/azure/resource-manager/common-properties/src/_Azure.ResourceManager.CommonProperties.csproj b/test/CadlRanchProjects/azure/resource-manager/common-properties/src/_Azure.ResourceManager.CommonProperties.csproj index 30e6a61308c..16f7a7aa271 100644 --- a/test/CadlRanchProjects/azure/resource-manager/common-properties/src/_Azure.ResourceManager.CommonProperties.csproj +++ b/test/CadlRanchProjects/azure/resource-manager/common-properties/src/_Azure.ResourceManager.CommonProperties.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider CommonProperties. 1.0.0-beta.1 azure;management;arm;resource manager;commonproperties + true _Azure.ResourceManager.CommonProperties diff --git a/test/CadlRanchProjects/azure/resource-manager/non-resource/src/_Azure.ResourceManager.NonResources.csproj b/test/CadlRanchProjects/azure/resource-manager/non-resource/src/_Azure.ResourceManager.NonResources.csproj index 78cae9a3f07..7ff8efa33ff 100644 --- a/test/CadlRanchProjects/azure/resource-manager/non-resource/src/_Azure.ResourceManager.NonResources.csproj +++ b/test/CadlRanchProjects/azure/resource-manager/non-resource/src/_Azure.ResourceManager.NonResources.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider NonResources. 1.0.0-beta.1 azure;management;arm;resource manager;nonresources + true _Azure.ResourceManager.NonResources diff --git a/test/CadlRanchProjects/azure/resource-manager/resources/src/_Azure.ResourceManager.Resources.csproj b/test/CadlRanchProjects/azure/resource-manager/resources/src/_Azure.ResourceManager.Resources.csproj index 33ea4f63d0e..a6f64b8e943 100644 --- a/test/CadlRanchProjects/azure/resource-manager/resources/src/_Azure.ResourceManager.Resources.csproj +++ b/test/CadlRanchProjects/azure/resource-manager/resources/src/_Azure.ResourceManager.Resources.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider Resources. 1.0.0-beta.1 azure;management;arm;resource manager;resources + true _Azure.ResourceManager.Resources diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Header.xml b/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Header.xml index 04d0c540491..eb50de99bf0 100644 --- a/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Header.xml +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Header.xml @@ -226,6 +226,158 @@ Header client = new DurationClient().GetHeaderClient(); Response response = client.Float64Seconds(TimeSpan.FromSeconds(3.141592)); +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call Int32MillisecondsAsync. + +This sample shows how to call Int32MillisecondsAsync with all parameters. + + + + +This sample shows how to call Int32Milliseconds. + +This sample shows how to call Int32Milliseconds with all parameters. + + + + +This sample shows how to call FloatMillisecondsAsync. + +This sample shows how to call FloatMillisecondsAsync with all parameters. + + + + +This sample shows how to call FloatMilliseconds. + +This sample shows how to call FloatMilliseconds with all parameters. + + + + +This sample shows how to call Float64MillisecondsAsync. + +This sample shows how to call Float64MillisecondsAsync with all parameters. + + + + +This sample shows how to call Float64Milliseconds. + +This sample shows how to call Float64Milliseconds with all parameters. + + + + +This sample shows how to call Int32MillisecondsArrayAsync. + +This sample shows how to call Int32MillisecondsArrayAsync with all parameters. + + + + +This sample shows how to call Int32MillisecondsArray. + +This sample shows how to call Int32MillisecondsArray with all parameters. + diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Property.xml b/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Property.xml index ce8148639f4..c5b198f74cd 100644 --- a/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Property.xml +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Property.xml @@ -457,6 +457,246 @@ using RequestContent content = RequestContent.Create(new }); Response response = client.Float64Seconds(content); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value").ToString()); +]]> + + + +This sample shows how to call Int32MillisecondsAsync. + response = await client.Int32MillisecondsAsync(body); +]]> +This sample shows how to call Int32MillisecondsAsync with all parameters. + response = await client.Int32MillisecondsAsync(body); +]]> + + + +This sample shows how to call Int32Milliseconds. + response = client.Int32Milliseconds(body); +]]> +This sample shows how to call Int32Milliseconds with all parameters. + response = client.Int32Milliseconds(body); +]]> + + + +This sample shows how to call Int32MillisecondsAsync and parse the result. + +This sample shows how to call Int32MillisecondsAsync with all request content and parse the result. + + + + +This sample shows how to call Int32Milliseconds and parse the result. + +This sample shows how to call Int32Milliseconds with all request content and parse the result. + + + + +This sample shows how to call FloatMillisecondsAsync. + response = await client.FloatMillisecondsAsync(body); +]]> +This sample shows how to call FloatMillisecondsAsync with all parameters. + response = await client.FloatMillisecondsAsync(body); +]]> + + + +This sample shows how to call FloatMilliseconds. + response = client.FloatMilliseconds(body); +]]> +This sample shows how to call FloatMilliseconds with all parameters. + response = client.FloatMilliseconds(body); +]]> + + + +This sample shows how to call FloatMillisecondsAsync and parse the result. + +This sample shows how to call FloatMillisecondsAsync with all request content and parse the result. + + + + +This sample shows how to call FloatMilliseconds and parse the result. + +This sample shows how to call FloatMilliseconds with all request content and parse the result. + + + + +This sample shows how to call Float64MillisecondsAsync. + response = await client.Float64MillisecondsAsync(body); +]]> +This sample shows how to call Float64MillisecondsAsync with all parameters. + response = await client.Float64MillisecondsAsync(body); +]]> + + + +This sample shows how to call Float64Milliseconds. + response = client.Float64Milliseconds(body); +]]> +This sample shows how to call Float64Milliseconds with all parameters. + response = client.Float64Milliseconds(body); +]]> + + + +This sample shows how to call Float64MillisecondsAsync and parse the result. + +This sample shows how to call Float64MillisecondsAsync with all request content and parse the result. + + + + +This sample shows how to call Float64Milliseconds and parse the result. + +This sample shows how to call Float64Milliseconds with all request content and parse the result. + @@ -561,6 +801,110 @@ using RequestContent content = RequestContent.Create(new }); Response response = client.FloatSecondsArray(content); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].ToString()); +]]> + + + +This sample shows how to call FloatMillisecondsArrayAsync. + response = await client.FloatMillisecondsArrayAsync(body); +]]> +This sample shows how to call FloatMillisecondsArrayAsync with all parameters. + response = await client.FloatMillisecondsArrayAsync(body); +]]> + + + +This sample shows how to call FloatMillisecondsArray. + response = client.FloatMillisecondsArray(body); +]]> +This sample shows how to call FloatMillisecondsArray with all parameters. + response = client.FloatMillisecondsArray(body); +]]> + + + +This sample shows how to call FloatMillisecondsArrayAsync and parse the result. + +This sample shows how to call FloatMillisecondsArrayAsync with all request content and parse the result. + + + + +This sample shows how to call FloatMillisecondsArray and parse the result. + +This sample shows how to call FloatMillisecondsArray with all request content and parse the result. + diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Query.xml b/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Query.xml index 8456816f75a..30df155364b 100644 --- a/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Query.xml +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Docs/Query.xml @@ -188,6 +188,120 @@ Query client = new DurationClient().GetQueryClient(); Response response = client.Float64Seconds(TimeSpan.FromSeconds(3.141592)); +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call Int32MillisecondsAsync. + +This sample shows how to call Int32MillisecondsAsync with all parameters. + + + + +This sample shows how to call Int32Milliseconds. + +This sample shows how to call Int32Milliseconds with all parameters. + + + + +This sample shows how to call FloatMillisecondsAsync. + +This sample shows how to call FloatMillisecondsAsync with all parameters. + + + + +This sample shows how to call FloatMilliseconds. + +This sample shows how to call FloatMilliseconds with all parameters. + + + + +This sample shows how to call Float64MillisecondsAsync. + +This sample shows how to call Float64MillisecondsAsync with all parameters. + + + + +This sample shows how to call Float64Milliseconds. + +This sample shows how to call Float64Milliseconds with all parameters. + @@ -226,6 +340,44 @@ Query client = new DurationClient().GetQueryClient(); Response response = client.Int32SecondsArray(new TimeSpan[] { TimeSpan.FromSeconds(10) }); +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call Int32MillisecondsArrayAsync. + +This sample shows how to call Int32MillisecondsArrayAsync with all parameters. + + + + +This sample shows how to call Int32MillisecondsArray. + +This sample shows how to call Int32MillisecondsArray with all parameters. + diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Header.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Header.cs index 30ebee8ebea..c26008e1964 100644 --- a/test/CadlRanchProjects/encode/duration/src/Generated/Header.cs +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Header.cs @@ -433,6 +433,268 @@ public virtual Response Float64Seconds(TimeSpan duration, RequestContext context } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Int 32 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task Int32MillisecondsAsync(TimeSpan duration, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Header.Int32Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateInt32MillisecondsRequest(duration, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Int 32 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Int32Milliseconds(TimeSpan duration, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Header.Int32Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateInt32MillisecondsRequest(duration, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Float milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task FloatMillisecondsAsync(TimeSpan duration, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Header.FloatMilliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloatMillisecondsRequest(duration, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Float milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response FloatMilliseconds(TimeSpan duration, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Header.FloatMilliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloatMillisecondsRequest(duration, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Float 64 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task Float64MillisecondsAsync(TimeSpan duration, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Header.Float64Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloat64MillisecondsRequest(duration, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Float 64 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Float64Milliseconds(TimeSpan duration, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Header.Float64Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloat64MillisecondsRequest(duration, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Int 32 milliseconds array. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The where T is of type to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task Int32MillisecondsArrayAsync(IEnumerable duration, RequestContext context = null) + { + Argument.AssertNotNull(duration, nameof(duration)); + + using var scope = ClientDiagnostics.CreateScope("Header.Int32MillisecondsArray"); + scope.Start(); + try + { + using HttpMessage message = CreateInt32MillisecondsArrayRequest(duration, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Int 32 milliseconds array. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The where T is of type to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Int32MillisecondsArray(IEnumerable duration, RequestContext context = null) + { + Argument.AssertNotNull(duration, nameof(duration)); + + using var scope = ClientDiagnostics.CreateScope("Header.Int32MillisecondsArray"); + scope.Start(); + try + { + using HttpMessage message = CreateInt32MillisecondsArrayRequest(duration, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + internal HttpMessage CreateDefaultRequest(TimeSpan duration, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); @@ -511,6 +773,58 @@ internal HttpMessage CreateFloat64SecondsRequest(TimeSpan duration, RequestConte return message; } + internal HttpMessage CreateInt32MillisecondsRequest(TimeSpan duration, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/header/int32-milliseconds", false); + request.Uri = uri; + request.Headers.Add("duration", duration, "%s"); + return message; + } + + internal HttpMessage CreateFloatMillisecondsRequest(TimeSpan duration, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/header/float-milliseconds", false); + request.Uri = uri; + request.Headers.Add("duration", duration, "s\\.FFF"); + return message; + } + + internal HttpMessage CreateFloat64MillisecondsRequest(TimeSpan duration, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/header/float64-milliseconds", false); + request.Uri = uri; + request.Headers.Add("duration", duration, "s\\.FFFFFF"); + return message; + } + + internal HttpMessage CreateInt32MillisecondsArrayRequest(IEnumerable duration, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/header/int32-milliseconds-array", false); + request.Uri = uri; + request.Headers.AddDelimited("duration", duration, ",", "%s"); + return message; + } + private static ResponseClassifier _responseClassifier204; private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); } diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Models/EncodeDurationContext.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Models/EncodeDurationContext.cs index 1cb4e78207d..8bf9df4e35a 100644 --- a/test/CadlRanchProjects/encode/duration/src/Generated/Models/EncodeDurationContext.cs +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Models/EncodeDurationContext.cs @@ -15,9 +15,13 @@ namespace Encode.Duration /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' /// [ModelReaderWriterBuildable(typeof(DefaultDurationProperty))] + [ModelReaderWriterBuildable(typeof(Float64MillisecondsDurationProperty))] [ModelReaderWriterBuildable(typeof(Float64SecondsDurationProperty))] + [ModelReaderWriterBuildable(typeof(FloatMillisecondsDurationArrayProperty))] + [ModelReaderWriterBuildable(typeof(FloatMillisecondsDurationProperty))] [ModelReaderWriterBuildable(typeof(FloatSecondsDurationArrayProperty))] [ModelReaderWriterBuildable(typeof(FloatSecondsDurationProperty))] + [ModelReaderWriterBuildable(typeof(Int32MillisecondsDurationProperty))] [ModelReaderWriterBuildable(typeof(Int32SecondsDurationProperty))] [ModelReaderWriterBuildable(typeof(ISO8601DurationProperty))] public partial class EncodeDurationContext : ModelReaderWriterContext diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Models/Float64MillisecondsDurationProperty.Serialization.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Models/Float64MillisecondsDurationProperty.Serialization.cs new file mode 100644 index 00000000000..7ad29925248 --- /dev/null +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Models/Float64MillisecondsDurationProperty.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Encode.Duration.Models +{ + public partial class Float64MillisecondsDurationProperty : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Float64MillisecondsDurationProperty)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Convert.ToDouble(Value.ToString("s\\.FFFFFF"))); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Float64MillisecondsDurationProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Float64MillisecondsDurationProperty)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFloat64MillisecondsDurationProperty(document.RootElement, options); + } + + internal static Float64MillisecondsDurationProperty DeserializeFloat64MillisecondsDurationProperty(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TimeSpan value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = TimeSpan.FromMilliseconds(property.Value.GetDouble()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Float64MillisecondsDurationProperty(value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, EncodeDurationContext.Default); + default: + throw new FormatException($"The model {nameof(Float64MillisecondsDurationProperty)} does not support writing '{options.Format}' format."); + } + } + + Float64MillisecondsDurationProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFloat64MillisecondsDurationProperty(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Float64MillisecondsDurationProperty)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Float64MillisecondsDurationProperty FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFloat64MillisecondsDurationProperty(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Models/Float64MillisecondsDurationProperty.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Models/Float64MillisecondsDurationProperty.cs new file mode 100644 index 00000000000..88a060d2011 --- /dev/null +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Models/Float64MillisecondsDurationProperty.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Encode.Duration.Models +{ + /// The Float64MillisecondsDurationProperty. + public partial class Float64MillisecondsDurationProperty + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + public Float64MillisecondsDurationProperty(TimeSpan value) + { + Value = value; + } + + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal Float64MillisecondsDurationProperty(TimeSpan value, IDictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Float64MillisecondsDurationProperty() + { + } + + /// Gets or sets the value. + public TimeSpan Value { get; set; } + } +} diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationArrayProperty.Serialization.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationArrayProperty.Serialization.cs new file mode 100644 index 00000000000..8556c2a4eab --- /dev/null +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationArrayProperty.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Encode.Duration.Models +{ + public partial class FloatMillisecondsDurationArrayProperty : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FloatMillisecondsDurationArrayProperty)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteNumberValue(Convert.ToDouble(item.ToString("s\\.FFF"))); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FloatMillisecondsDurationArrayProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FloatMillisecondsDurationArrayProperty)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFloatMillisecondsDurationArrayProperty(document.RootElement, options); + } + + internal static FloatMillisecondsDurationArrayProperty DeserializeFloatMillisecondsDurationArrayProperty(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TimeSpan.FromMilliseconds(item.GetDouble())); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FloatMillisecondsDurationArrayProperty(value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, EncodeDurationContext.Default); + default: + throw new FormatException($"The model {nameof(FloatMillisecondsDurationArrayProperty)} does not support writing '{options.Format}' format."); + } + } + + FloatMillisecondsDurationArrayProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFloatMillisecondsDurationArrayProperty(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FloatMillisecondsDurationArrayProperty)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static FloatMillisecondsDurationArrayProperty FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFloatMillisecondsDurationArrayProperty(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationArrayProperty.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationArrayProperty.cs new file mode 100644 index 00000000000..595e8e6d95a --- /dev/null +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationArrayProperty.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Encode.Duration.Models +{ + /// The FloatMillisecondsDurationArrayProperty. + public partial class FloatMillisecondsDurationArrayProperty + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// is null. + public FloatMillisecondsDurationArrayProperty(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal FloatMillisecondsDurationArrayProperty(IList value, IDictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FloatMillisecondsDurationArrayProperty() + { + } + + /// Gets the value. + public IList Value { get; } + } +} diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationProperty.Serialization.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationProperty.Serialization.cs new file mode 100644 index 00000000000..1a41da741a0 --- /dev/null +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationProperty.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Encode.Duration.Models +{ + public partial class FloatMillisecondsDurationProperty : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FloatMillisecondsDurationProperty)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Convert.ToDouble(Value.ToString("s\\.FFF"))); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FloatMillisecondsDurationProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FloatMillisecondsDurationProperty)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFloatMillisecondsDurationProperty(document.RootElement, options); + } + + internal static FloatMillisecondsDurationProperty DeserializeFloatMillisecondsDurationProperty(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TimeSpan value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = TimeSpan.FromMilliseconds(property.Value.GetDouble()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FloatMillisecondsDurationProperty(value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, EncodeDurationContext.Default); + default: + throw new FormatException($"The model {nameof(FloatMillisecondsDurationProperty)} does not support writing '{options.Format}' format."); + } + } + + FloatMillisecondsDurationProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFloatMillisecondsDurationProperty(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FloatMillisecondsDurationProperty)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static FloatMillisecondsDurationProperty FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFloatMillisecondsDurationProperty(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationProperty.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationProperty.cs new file mode 100644 index 00000000000..eb6cdb052c9 --- /dev/null +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Models/FloatMillisecondsDurationProperty.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Encode.Duration.Models +{ + /// The FloatMillisecondsDurationProperty. + public partial class FloatMillisecondsDurationProperty + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + public FloatMillisecondsDurationProperty(TimeSpan value) + { + Value = value; + } + + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal FloatMillisecondsDurationProperty(TimeSpan value, IDictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FloatMillisecondsDurationProperty() + { + } + + /// Gets or sets the value. + public TimeSpan Value { get; set; } + } +} diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Models/Int32MillisecondsDurationProperty.Serialization.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Models/Int32MillisecondsDurationProperty.Serialization.cs new file mode 100644 index 00000000000..a1e39d3b708 --- /dev/null +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Models/Int32MillisecondsDurationProperty.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Encode.Duration.Models +{ + public partial class Int32MillisecondsDurationProperty : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Int32MillisecondsDurationProperty)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Convert.ToInt32(Value.ToString("%s"))); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Int32MillisecondsDurationProperty IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Int32MillisecondsDurationProperty)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInt32MillisecondsDurationProperty(document.RootElement, options); + } + + internal static Int32MillisecondsDurationProperty DeserializeInt32MillisecondsDurationProperty(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TimeSpan value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = TimeSpan.FromMilliseconds(property.Value.GetInt32()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Int32MillisecondsDurationProperty(value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, EncodeDurationContext.Default); + default: + throw new FormatException($"The model {nameof(Int32MillisecondsDurationProperty)} does not support writing '{options.Format}' format."); + } + } + + Int32MillisecondsDurationProperty IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInt32MillisecondsDurationProperty(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Int32MillisecondsDurationProperty)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Int32MillisecondsDurationProperty FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInt32MillisecondsDurationProperty(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Models/Int32MillisecondsDurationProperty.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Models/Int32MillisecondsDurationProperty.cs new file mode 100644 index 00000000000..f14f297cd57 --- /dev/null +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Models/Int32MillisecondsDurationProperty.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Encode.Duration.Models +{ + /// The Int32MillisecondsDurationProperty. + public partial class Int32MillisecondsDurationProperty + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + public Int32MillisecondsDurationProperty(TimeSpan value) + { + Value = value; + } + + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal Int32MillisecondsDurationProperty(TimeSpan value, IDictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Int32MillisecondsDurationProperty() + { + } + + /// Gets or sets the value. + public TimeSpan Value { get; set; } + } +} diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Property.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Property.cs index c4ae4f64783..201e06865b7 100644 --- a/test/CadlRanchProjects/encode/duration/src/Generated/Property.cs +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Property.cs @@ -584,6 +584,330 @@ public virtual Response Float64Seconds(RequestContent content, RequestContext co } } + /// Int 32 milliseconds. + /// The to use. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> Int32MillisecondsAsync(Int32MillisecondsDurationProperty body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await Int32MillisecondsAsync(content, context).ConfigureAwait(false); + return Response.FromValue(Int32MillisecondsDurationProperty.FromResponse(response), response); + } + + /// Int 32 milliseconds. + /// The to use. + /// The cancellation token to use. + /// is null. + /// + public virtual Response Int32Milliseconds(Int32MillisecondsDurationProperty body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = Int32Milliseconds(content, context); + return Response.FromValue(Int32MillisecondsDurationProperty.FromResponse(response), response); + } + + /// + /// [Protocol Method] Int 32 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task Int32MillisecondsAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("Property.Int32Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateInt32MillisecondsRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Int 32 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Int32Milliseconds(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("Property.Int32Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateInt32MillisecondsRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Float milliseconds. + /// The to use. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> FloatMillisecondsAsync(FloatMillisecondsDurationProperty body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await FloatMillisecondsAsync(content, context).ConfigureAwait(false); + return Response.FromValue(FloatMillisecondsDurationProperty.FromResponse(response), response); + } + + /// Float milliseconds. + /// The to use. + /// The cancellation token to use. + /// is null. + /// + public virtual Response FloatMilliseconds(FloatMillisecondsDurationProperty body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = FloatMilliseconds(content, context); + return Response.FromValue(FloatMillisecondsDurationProperty.FromResponse(response), response); + } + + /// + /// [Protocol Method] Float milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task FloatMillisecondsAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("Property.FloatMilliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloatMillisecondsRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Float milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response FloatMilliseconds(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("Property.FloatMilliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloatMillisecondsRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Float 64 milliseconds. + /// The to use. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> Float64MillisecondsAsync(Float64MillisecondsDurationProperty body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await Float64MillisecondsAsync(content, context).ConfigureAwait(false); + return Response.FromValue(Float64MillisecondsDurationProperty.FromResponse(response), response); + } + + /// Float 64 milliseconds. + /// The to use. + /// The cancellation token to use. + /// is null. + /// + public virtual Response Float64Milliseconds(Float64MillisecondsDurationProperty body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = Float64Milliseconds(content, context); + return Response.FromValue(Float64MillisecondsDurationProperty.FromResponse(response), response); + } + + /// + /// [Protocol Method] Float 64 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task Float64MillisecondsAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("Property.Float64Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloat64MillisecondsRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Float 64 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Float64Milliseconds(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("Property.Float64Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloat64MillisecondsRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// Float seconds array. /// The to use. /// The cancellation token to use. @@ -692,6 +1016,114 @@ public virtual Response FloatSecondsArray(RequestContent content, RequestContext } } + /// Float milliseconds array. + /// The to use. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> FloatMillisecondsArrayAsync(FloatMillisecondsDurationArrayProperty body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await FloatMillisecondsArrayAsync(content, context).ConfigureAwait(false); + return Response.FromValue(FloatMillisecondsDurationArrayProperty.FromResponse(response), response); + } + + /// Float milliseconds array. + /// The to use. + /// The cancellation token to use. + /// is null. + /// + public virtual Response FloatMillisecondsArray(FloatMillisecondsDurationArrayProperty body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = FloatMillisecondsArray(content, context); + return Response.FromValue(FloatMillisecondsDurationArrayProperty.FromResponse(response), response); + } + + /// + /// [Protocol Method] Float milliseconds array. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task FloatMillisecondsArrayAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("Property.FloatMillisecondsArray"); + scope.Start(); + try + { + using HttpMessage message = CreateFloatMillisecondsArrayRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Float milliseconds array. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response FloatMillisecondsArray(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("Property.FloatMillisecondsArray"); + scope.Start(); + try + { + using HttpMessage message = CreateFloatMillisecondsArrayRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + internal HttpMessage CreateDefaultRequest(RequestContent content, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); @@ -767,6 +1199,51 @@ internal HttpMessage CreateFloat64SecondsRequest(RequestContent content, Request return message; } + internal HttpMessage CreateInt32MillisecondsRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/property/int32-milliseconds", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateFloatMillisecondsRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/property/float-milliseconds", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateFloat64MillisecondsRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/property/float64-milliseconds", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + internal HttpMessage CreateFloatSecondsArrayRequest(RequestContent content, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); @@ -782,6 +1259,21 @@ internal HttpMessage CreateFloatSecondsArrayRequest(RequestContent content, Requ return message; } + internal HttpMessage CreateFloatMillisecondsArrayRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/property/float-milliseconds-array", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + private static RequestContext DefaultRequestContext = new RequestContext(); internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) { diff --git a/test/CadlRanchProjects/encode/duration/src/Generated/Query.cs b/test/CadlRanchProjects/encode/duration/src/Generated/Query.cs index ddbe1a0277d..483891ad7c8 100644 --- a/test/CadlRanchProjects/encode/duration/src/Generated/Query.cs +++ b/test/CadlRanchProjects/encode/duration/src/Generated/Query.cs @@ -363,6 +363,198 @@ public virtual Response Float64Seconds(TimeSpan input, RequestContext context = } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Int 32 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task Int32MillisecondsAsync(TimeSpan input, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Query.Int32Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateInt32MillisecondsRequest(input, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Int 32 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Int32Milliseconds(TimeSpan input, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Query.Int32Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateInt32MillisecondsRequest(input, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Float milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task FloatMillisecondsAsync(TimeSpan input, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Query.FloatMilliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloatMillisecondsRequest(input, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Float milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response FloatMilliseconds(TimeSpan input, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Query.FloatMilliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloatMillisecondsRequest(input, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Float 64 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task Float64MillisecondsAsync(TimeSpan input, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Query.Float64Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloat64MillisecondsRequest(input, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Float 64 milliseconds. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Float64Milliseconds(TimeSpan input, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("Query.Float64Milliseconds"); + scope.Start(); + try + { + using HttpMessage message = CreateFloat64MillisecondsRequest(input, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Int 32 seconds array. @@ -433,6 +625,76 @@ public virtual Response Int32SecondsArray(IEnumerable input, RequestCo } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Int 32 milliseconds array. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The where T is of type to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task Int32MillisecondsArrayAsync(IEnumerable input, RequestContext context = null) + { + Argument.AssertNotNull(input, nameof(input)); + + using var scope = ClientDiagnostics.CreateScope("Query.Int32MillisecondsArray"); + scope.Start(); + try + { + using HttpMessage message = CreateInt32MillisecondsArrayRequest(input, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Int 32 milliseconds array. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The where T is of type to use. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Int32MillisecondsArray(IEnumerable input, RequestContext context = null) + { + Argument.AssertNotNull(input, nameof(input)); + + using var scope = ClientDiagnostics.CreateScope("Query.Int32MillisecondsArray"); + scope.Start(); + try + { + using HttpMessage message = CreateInt32MillisecondsArrayRequest(input, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + internal HttpMessage CreateDefaultRequest(TimeSpan input, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); @@ -498,6 +760,45 @@ internal HttpMessage CreateFloat64SecondsRequest(TimeSpan input, RequestContext return message; } + internal HttpMessage CreateInt32MillisecondsRequest(TimeSpan input, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/query/int32-milliseconds", false); + uri.AppendQuery("input", input, "%s", true); + request.Uri = uri; + return message; + } + + internal HttpMessage CreateFloatMillisecondsRequest(TimeSpan input, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/query/float-milliseconds", false); + uri.AppendQuery("input", input, "s\\.FFF", true); + request.Uri = uri; + return message; + } + + internal HttpMessage CreateFloat64MillisecondsRequest(TimeSpan input, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/query/float64-milliseconds", false); + uri.AppendQuery("input", input, "s\\.FFFFFF", true); + request.Uri = uri; + return message; + } + internal HttpMessage CreateInt32SecondsArrayRequest(IEnumerable input, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); @@ -514,6 +815,22 @@ internal HttpMessage CreateInt32SecondsArrayRequest(IEnumerable input, return message; } + internal HttpMessage CreateInt32MillisecondsArrayRequest(IEnumerable input, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/encode/duration/query/int32-milliseconds-array", false); + if (input != null && !(input is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + uri.AppendQueryDelimited("input", input, ",", "%s", true); + } + request.Uri = uri; + return message; + } + private static ResponseClassifier _responseClassifier204; private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); } diff --git a/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Header.cs b/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Header.cs index 8352eac9adf..ad61fc0fb57 100644 --- a/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Header.cs +++ b/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Header.cs @@ -279,5 +279,181 @@ public async Task Example_Header_Float64Seconds_AllParameters_Async() Console.WriteLine(response.Status); } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Header_Int32Milliseconds_ShortVersion() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = client.Int32Milliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Header_Int32Milliseconds_ShortVersion_Async() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = await client.Int32MillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Header_Int32Milliseconds_AllParameters() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = client.Int32Milliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Header_Int32Milliseconds_AllParameters_Async() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = await client.Int32MillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Header_FloatMilliseconds_ShortVersion() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = client.FloatMilliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Header_FloatMilliseconds_ShortVersion_Async() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = await client.FloatMillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Header_FloatMilliseconds_AllParameters() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = client.FloatMilliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Header_FloatMilliseconds_AllParameters_Async() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = await client.FloatMillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Header_Float64Milliseconds_ShortVersion() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = client.Float64Milliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Header_Float64Milliseconds_ShortVersion_Async() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = await client.Float64MillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Header_Float64Milliseconds_AllParameters() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = client.Float64Milliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Header_Float64Milliseconds_AllParameters_Async() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = await client.Float64MillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Header_Int32MillisecondsArray_ShortVersion() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = client.Int32MillisecondsArray(new TimeSpan[] { default }); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Header_Int32MillisecondsArray_ShortVersion_Async() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = await client.Int32MillisecondsArrayAsync(new TimeSpan[] { default }); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Header_Int32MillisecondsArray_AllParameters() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = client.Int32MillisecondsArray(new TimeSpan[] { default }); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Header_Int32MillisecondsArray_AllParameters_Async() + { + Header client = new DurationClient().GetHeaderClient(); + + Response response = await client.Int32MillisecondsArrayAsync(new TimeSpan[] { default }); + + Console.WriteLine(response.Status); + } } } diff --git a/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Property.cs b/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Property.cs index 238b3714c60..f574cb19a3b 100644 --- a/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Property.cs +++ b/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Property.cs @@ -539,6 +539,282 @@ public async Task Example_Property_Float64Seconds_AllParameters_Convenience_Asyn Response response = await client.Float64SecondsAsync(body); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_Int32Milliseconds_ShortVersion() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = client.Int32Milliseconds(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_Int32Milliseconds_ShortVersion_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = await client.Int32MillisecondsAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_Int32Milliseconds_ShortVersion_Convenience() + { + Property client = new DurationClient().GetPropertyClient(); + + Int32MillisecondsDurationProperty body = new Int32MillisecondsDurationProperty(default); + Response response = client.Int32Milliseconds(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_Int32Milliseconds_ShortVersion_Convenience_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + Int32MillisecondsDurationProperty body = new Int32MillisecondsDurationProperty(default); + Response response = await client.Int32MillisecondsAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_Int32Milliseconds_AllParameters() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = client.Int32Milliseconds(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_Int32Milliseconds_AllParameters_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = await client.Int32MillisecondsAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_Int32Milliseconds_AllParameters_Convenience() + { + Property client = new DurationClient().GetPropertyClient(); + + Int32MillisecondsDurationProperty body = new Int32MillisecondsDurationProperty(default); + Response response = client.Int32Milliseconds(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_Int32Milliseconds_AllParameters_Convenience_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + Int32MillisecondsDurationProperty body = new Int32MillisecondsDurationProperty(default); + Response response = await client.Int32MillisecondsAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_FloatMilliseconds_ShortVersion() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = client.FloatMilliseconds(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_FloatMilliseconds_ShortVersion_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = await client.FloatMillisecondsAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_FloatMilliseconds_ShortVersion_Convenience() + { + Property client = new DurationClient().GetPropertyClient(); + + FloatMillisecondsDurationProperty body = new FloatMillisecondsDurationProperty(default); + Response response = client.FloatMilliseconds(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_FloatMilliseconds_ShortVersion_Convenience_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + FloatMillisecondsDurationProperty body = new FloatMillisecondsDurationProperty(default); + Response response = await client.FloatMillisecondsAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_FloatMilliseconds_AllParameters() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = client.FloatMilliseconds(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_FloatMilliseconds_AllParameters_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = await client.FloatMillisecondsAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_FloatMilliseconds_AllParameters_Convenience() + { + Property client = new DurationClient().GetPropertyClient(); + + FloatMillisecondsDurationProperty body = new FloatMillisecondsDurationProperty(default); + Response response = client.FloatMilliseconds(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_FloatMilliseconds_AllParameters_Convenience_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + FloatMillisecondsDurationProperty body = new FloatMillisecondsDurationProperty(default); + Response response = await client.FloatMillisecondsAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_Float64Milliseconds_ShortVersion() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = client.Float64Milliseconds(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_Float64Milliseconds_ShortVersion_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = await client.Float64MillisecondsAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_Float64Milliseconds_ShortVersion_Convenience() + { + Property client = new DurationClient().GetPropertyClient(); + + Float64MillisecondsDurationProperty body = new Float64MillisecondsDurationProperty(default); + Response response = client.Float64Milliseconds(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_Float64Milliseconds_ShortVersion_Convenience_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + Float64MillisecondsDurationProperty body = new Float64MillisecondsDurationProperty(default); + Response response = await client.Float64MillisecondsAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_Float64Milliseconds_AllParameters() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = client.Float64Milliseconds(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_Float64Milliseconds_AllParameters_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new { }); + Response response = await client.Float64MillisecondsAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_Float64Milliseconds_AllParameters_Convenience() + { + Property client = new DurationClient().GetPropertyClient(); + + Float64MillisecondsDurationProperty body = new Float64MillisecondsDurationProperty(default); + Response response = client.Float64Milliseconds(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_Float64Milliseconds_AllParameters_Convenience_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + Float64MillisecondsDurationProperty body = new Float64MillisecondsDurationProperty(default); + Response response = await client.Float64MillisecondsAsync(body); + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_Property_FloatSecondsArray_ShortVersion() @@ -654,5 +930,121 @@ public async Task Example_Property_FloatSecondsArray_AllParameters_Convenience_A FloatSecondsDurationArrayProperty body = new FloatSecondsDurationArrayProperty(new TimeSpan[] { TimeSpan.FromSeconds(10F) }); Response response = await client.FloatSecondsArrayAsync(body); } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_FloatMillisecondsArray_ShortVersion() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new + { + value = new object[] + { +null + }, + }); + Response response = client.FloatMillisecondsArray(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_FloatMillisecondsArray_ShortVersion_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new + { + value = new object[] + { +null + }, + }); + Response response = await client.FloatMillisecondsArrayAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_FloatMillisecondsArray_ShortVersion_Convenience() + { + Property client = new DurationClient().GetPropertyClient(); + + FloatMillisecondsDurationArrayProperty body = new FloatMillisecondsDurationArrayProperty(new TimeSpan[] { default }); + Response response = client.FloatMillisecondsArray(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_FloatMillisecondsArray_ShortVersion_Convenience_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + FloatMillisecondsDurationArrayProperty body = new FloatMillisecondsDurationArrayProperty(new TimeSpan[] { default }); + Response response = await client.FloatMillisecondsArrayAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_FloatMillisecondsArray_AllParameters() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new + { + value = new object[] + { +null + }, + }); + Response response = client.FloatMillisecondsArray(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_FloatMillisecondsArray_AllParameters_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + using RequestContent content = RequestContent.Create(new + { + value = new object[] + { +null + }, + }); + Response response = await client.FloatMillisecondsArrayAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Property_FloatMillisecondsArray_AllParameters_Convenience() + { + Property client = new DurationClient().GetPropertyClient(); + + FloatMillisecondsDurationArrayProperty body = new FloatMillisecondsDurationArrayProperty(new TimeSpan[] { default }); + Response response = client.FloatMillisecondsArray(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Property_FloatMillisecondsArray_AllParameters_Convenience_Async() + { + Property client = new DurationClient().GetPropertyClient(); + + FloatMillisecondsDurationArrayProperty body = new FloatMillisecondsDurationArrayProperty(new TimeSpan[] { default }); + Response response = await client.FloatMillisecondsArrayAsync(body); + } } } diff --git a/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Query.cs b/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Query.cs index 2d9df929a77..fa42c3627f3 100644 --- a/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Query.cs +++ b/test/CadlRanchProjects/encode/duration/tests/Generated/Samples/Samples_Query.cs @@ -236,6 +236,138 @@ public async Task Example_Query_Float64Seconds_AllParameters_Async() Console.WriteLine(response.Status); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Query_Int32Milliseconds_ShortVersion() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = client.Int32Milliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Query_Int32Milliseconds_ShortVersion_Async() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = await client.Int32MillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Query_Int32Milliseconds_AllParameters() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = client.Int32Milliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Query_Int32Milliseconds_AllParameters_Async() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = await client.Int32MillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Query_FloatMilliseconds_ShortVersion() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = client.FloatMilliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Query_FloatMilliseconds_ShortVersion_Async() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = await client.FloatMillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Query_FloatMilliseconds_AllParameters() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = client.FloatMilliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Query_FloatMilliseconds_AllParameters_Async() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = await client.FloatMillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Query_Float64Milliseconds_ShortVersion() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = client.Float64Milliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Query_Float64Milliseconds_ShortVersion_Async() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = await client.Float64MillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Query_Float64Milliseconds_AllParameters() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = client.Float64Milliseconds(default); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Query_Float64Milliseconds_AllParameters_Async() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = await client.Float64MillisecondsAsync(default); + + Console.WriteLine(response.Status); + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_Query_Int32SecondsArray_ShortVersion() @@ -279,5 +411,49 @@ public async Task Example_Query_Int32SecondsArray_AllParameters_Async() Console.WriteLine(response.Status); } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Query_Int32MillisecondsArray_ShortVersion() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = client.Int32MillisecondsArray(new TimeSpan[] { default }); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Query_Int32MillisecondsArray_ShortVersion_Async() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = await client.Int32MillisecondsArrayAsync(new TimeSpan[] { default }); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Query_Int32MillisecondsArray_AllParameters() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = client.Int32MillisecondsArray(new TimeSpan[] { default }); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Query_Int32MillisecondsArray_AllParameters_Async() + { + Query client = new DurationClient().GetQueryClient(); + + Response response = await client.Int32MillisecondsArrayAsync(new TimeSpan[] { default }); + + Console.WriteLine(response.Status); + } } } diff --git a/test/CadlRanchProjects/encode/duration/tspCodeModel.json b/test/CadlRanchProjects/encode/duration/tspCodeModel.json index 62b4f4adef1..273624f9070 100644 --- a/test/CadlRanchProjects/encode/duration/tspCodeModel.json +++ b/test/CadlRanchProjects/encode/duration/tspCodeModel.json @@ -166,7 +166,7 @@ { "$id": "21", "kind": "constant", - "name": "floatSecondsArrayContentType", + "name": "int32MillisecondsContentType", "namespace": "", "usage": "None", "valueType": { @@ -182,7 +182,7 @@ { "$id": "23", "kind": "constant", - "name": "floatSecondsArrayContentType1", + "name": "int32MillisecondsContentType1", "namespace": "", "usage": "None", "valueType": { @@ -194,11 +194,139 @@ }, "value": "application/json", "decorators": [] + }, + { + "$id": "25", + "kind": "constant", + "name": "floatMillisecondsContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "26", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "27", + "kind": "constant", + "name": "floatMillisecondsContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "28", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "29", + "kind": "constant", + "name": "float64MillisecondsContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "30", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "31", + "kind": "constant", + "name": "float64MillisecondsContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "32", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "33", + "kind": "constant", + "name": "floatSecondsArrayContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "34", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "35", + "kind": "constant", + "name": "floatSecondsArrayContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "36", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "37", + "kind": "constant", + "name": "floatMillisecondsArrayContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "38", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + { + "$id": "39", + "kind": "constant", + "name": "floatMillisecondsArrayContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "40", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] } ], "models": [ { - "$id": "25", + "$id": "41", "kind": "model", "name": "DefaultDurationProperty", "namespace": "Encode.Duration.Property", @@ -207,17 +335,17 @@ "decorators": [], "properties": [ { - "$id": "26", + "$id": "42", "kind": "property", "name": "value", "serializedName": "value", "type": { - "$id": "27", + "$id": "43", "kind": "duration", "name": "duration", "encode": "ISO8601", "wireType": { - "$id": "28", + "$id": "44", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -242,7 +370,7 @@ ] }, { - "$id": "29", + "$id": "45", "kind": "model", "name": "ISO8601DurationProperty", "namespace": "Encode.Duration.Property", @@ -251,17 +379,17 @@ "decorators": [], "properties": [ { - "$id": "30", + "$id": "46", "kind": "property", "name": "value", "serializedName": "value", "type": { - "$id": "31", + "$id": "47", "kind": "duration", "name": "duration", "encode": "ISO8601", "wireType": { - "$id": "32", + "$id": "48", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -286,7 +414,7 @@ ] }, { - "$id": "33", + "$id": "49", "kind": "model", "name": "Int32SecondsDurationProperty", "namespace": "Encode.Duration.Property", @@ -295,17 +423,17 @@ "decorators": [], "properties": [ { - "$id": "34", + "$id": "50", "kind": "property", "name": "value", "serializedName": "value", "type": { - "$id": "35", + "$id": "51", "kind": "duration", "name": "duration", "encode": "seconds", "wireType": { - "$id": "36", + "$id": "52", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -330,7 +458,7 @@ ] }, { - "$id": "37", + "$id": "53", "kind": "model", "name": "FloatSecondsDurationProperty", "namespace": "Encode.Duration.Property", @@ -339,17 +467,17 @@ "decorators": [], "properties": [ { - "$id": "38", + "$id": "54", "kind": "property", "name": "value", "serializedName": "value", "type": { - "$id": "39", + "$id": "55", "kind": "duration", "name": "duration", "encode": "seconds", "wireType": { - "$id": "40", + "$id": "56", "kind": "float", "name": "float", "crossLanguageDefinitionId": "TypeSpec.float", @@ -374,7 +502,7 @@ ] }, { - "$id": "41", + "$id": "57", "kind": "model", "name": "Float64SecondsDurationProperty", "namespace": "Encode.Duration.Property", @@ -383,17 +511,17 @@ "decorators": [], "properties": [ { - "$id": "42", + "$id": "58", "kind": "property", "name": "value", "serializedName": "value", "type": { - "$id": "43", + "$id": "59", "kind": "duration", "name": "duration", "encode": "seconds", "wireType": { - "$id": "44", + "$id": "60", "kind": "float64", "name": "float64", "crossLanguageDefinitionId": "TypeSpec.float64", @@ -418,7 +546,139 @@ ] }, { - "$id": "45", + "$id": "61", + "kind": "model", + "name": "Int32MillisecondsDurationProperty", + "namespace": "Encode.Duration.Property", + "crossLanguageDefinitionId": "Encode.Duration.Property.Int32MillisecondsDurationProperty", + "usage": "Input,Output,Json", + "decorators": [], + "properties": [ + { + "$id": "62", + "kind": "property", + "name": "value", + "serializedName": "value", + "type": { + "$id": "63", + "kind": "duration", + "name": "duration", + "encode": "milliseconds", + "wireType": { + "$id": "64", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Encode.Duration.Property.Int32MillisecondsDurationProperty.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "65", + "kind": "model", + "name": "FloatMillisecondsDurationProperty", + "namespace": "Encode.Duration.Property", + "crossLanguageDefinitionId": "Encode.Duration.Property.FloatMillisecondsDurationProperty", + "usage": "Input,Output,Json", + "decorators": [], + "properties": [ + { + "$id": "66", + "kind": "property", + "name": "value", + "serializedName": "value", + "type": { + "$id": "67", + "kind": "duration", + "name": "duration", + "encode": "milliseconds", + "wireType": { + "$id": "68", + "kind": "float", + "name": "float", + "crossLanguageDefinitionId": "TypeSpec.float", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Encode.Duration.Property.FloatMillisecondsDurationProperty.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "69", + "kind": "model", + "name": "Float64MillisecondsDurationProperty", + "namespace": "Encode.Duration.Property", + "crossLanguageDefinitionId": "Encode.Duration.Property.Float64MillisecondsDurationProperty", + "usage": "Input,Output,Json", + "decorators": [], + "properties": [ + { + "$id": "70", + "kind": "property", + "name": "value", + "serializedName": "value", + "type": { + "$id": "71", + "kind": "duration", + "name": "duration", + "encode": "milliseconds", + "wireType": { + "$id": "72", + "kind": "float64", + "name": "float64", + "crossLanguageDefinitionId": "TypeSpec.float64", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Encode.Duration.Property.Float64MillisecondsDurationProperty.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + } + ] + }, + { + "$id": "73", "kind": "model", "name": "FloatSecondsDurationArrayProperty", "namespace": "Encode.Duration.Property", @@ -427,21 +687,21 @@ "decorators": [], "properties": [ { - "$id": "46", + "$id": "74", "kind": "property", "name": "value", "serializedName": "value", "type": { - "$id": "47", + "$id": "75", "kind": "array", - "name": "Array1", + "name": "Array2", "valueType": { - "$id": "48", + "$id": "76", "kind": "duration", "name": "Float32Duration", "encode": "seconds", "wireType": { - "$id": "49", + "$id": "77", "kind": "float32", "name": "float32", "crossLanguageDefinitionId": "TypeSpec.float32", @@ -449,12 +709,12 @@ }, "crossLanguageDefinitionId": "Encode.Duration.Property.Float32Duration", "baseType": { - "$id": "50", + "$id": "78", "kind": "duration", "name": "duration", "encode": "ISO8601", "wireType": { - "$id": "51", + "$id": "79", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -482,24 +742,90 @@ "isHttpMetadata": false } ] - } - ], - "clients": [ + }, { - "$id": "52", - "kind": "client", - "name": "DurationClient", - "namespace": "Encode.Duration", - "doc": "Test for encode decorator on duration.", - "methods": [], - "parameters": [ + "$id": "80", + "kind": "model", + "name": "FloatMillisecondsDurationArrayProperty", + "namespace": "Encode.Duration.Property", + "crossLanguageDefinitionId": "Encode.Duration.Property.FloatMillisecondsDurationArrayProperty", + "usage": "Input,Output,Json", + "decorators": [], + "properties": [ { - "$id": "53", - "name": "endpoint", + "$id": "81", + "kind": "property", + "name": "value", + "serializedName": "value", + "type": { + "$id": "82", + "kind": "array", + "name": "Array3", + "valueType": { + "$id": "83", + "kind": "duration", + "name": "Float32MillisecondsDuration", + "encode": "milliseconds", + "wireType": { + "$id": "84", + "kind": "float32", + "name": "float32", + "crossLanguageDefinitionId": "TypeSpec.float32", + "decorators": [] + }, + "crossLanguageDefinitionId": "Encode.Duration.Property.Float32MillisecondsDuration", + "baseType": { + "$id": "85", + "kind": "duration", + "name": "duration", + "encode": "ISO8601", + "wireType": { + "$id": "86", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Encode.Duration.Property.FloatMillisecondsDurationArrayProperty.value", + "serializationOptions": { + "json": { + "name": "value" + } + }, + "isHttpMetadata": false + } + ] + } + ], + "clients": [ + { + "$id": "87", + "kind": "client", + "name": "DurationClient", + "namespace": "Encode.Duration", + "doc": "Test for encode decorator on duration.", + "methods": [], + "parameters": [ + { + "$id": "88", + "name": "endpoint", "nameInRequest": "endpoint", "doc": "Service host", "type": { - "$id": "54", + "$id": "89", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -514,7 +840,7 @@ "kind": "Client", "defaultValue": { "type": { - "$id": "55", + "$id": "90", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" @@ -529,34 +855,34 @@ "apiVersions": [], "children": [ { - "$id": "56", + "$id": "91", "kind": "client", "name": "Query", "namespace": "Encode.Duration.Query", "methods": [ { - "$id": "57", + "$id": "92", "kind": "basic", "name": "default", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "58", + "$id": "93", "name": "default", "resourceName": "Query", "accessibility": "public", "parameters": [ { - "$id": "59", + "$id": "94", "name": "input", "nameInRequest": "input", "type": { - "$id": "60", + "$id": "95", "kind": "duration", "name": "duration", "encode": "ISO8601", "wireType": { - "$id": "61", + "$id": "96", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -596,16 +922,16 @@ }, "parameters": [ { - "$id": "62", + "$id": "97", "name": "input", "nameInRequest": "input", "type": { - "$id": "63", + "$id": "98", "kind": "duration", "name": "duration", "encode": "ISO8601", "wireType": { - "$id": "64", + "$id": "99", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -632,28 +958,28 @@ "crossLanguageDefinitionId": "Encode.Duration.Query.default" }, { - "$id": "65", + "$id": "100", "kind": "basic", "name": "iso8601", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "66", + "$id": "101", "name": "iso8601", "resourceName": "Query", "accessibility": "public", "parameters": [ { - "$id": "67", + "$id": "102", "name": "input", "nameInRequest": "input", "type": { - "$id": "68", + "$id": "103", "kind": "duration", "name": "duration", "encode": "ISO8601", "wireType": { - "$id": "69", + "$id": "104", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -693,16 +1019,16 @@ }, "parameters": [ { - "$id": "70", + "$id": "105", "name": "input", "nameInRequest": "input", "type": { - "$id": "71", + "$id": "106", "kind": "duration", "name": "duration", "encode": "ISO8601", "wireType": { - "$id": "72", + "$id": "107", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -729,28 +1055,28 @@ "crossLanguageDefinitionId": "Encode.Duration.Query.iso8601" }, { - "$id": "73", + "$id": "108", "kind": "basic", "name": "int32Seconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "74", + "$id": "109", "name": "int32Seconds", "resourceName": "Query", "accessibility": "public", "parameters": [ { - "$id": "75", + "$id": "110", "name": "input", "nameInRequest": "input", "type": { - "$id": "76", + "$id": "111", "kind": "duration", "name": "duration", "encode": "seconds", "wireType": { - "$id": "77", + "$id": "112", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -790,16 +1116,16 @@ }, "parameters": [ { - "$id": "78", + "$id": "113", "name": "input", "nameInRequest": "input", "type": { - "$id": "79", + "$id": "114", "kind": "duration", "name": "duration", "encode": "seconds", "wireType": { - "$id": "80", + "$id": "115", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -826,28 +1152,28 @@ "crossLanguageDefinitionId": "Encode.Duration.Query.int32Seconds" }, { - "$id": "81", + "$id": "116", "kind": "basic", "name": "floatSeconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "82", + "$id": "117", "name": "floatSeconds", "resourceName": "Query", "accessibility": "public", "parameters": [ { - "$id": "83", + "$id": "118", "name": "input", "nameInRequest": "input", "type": { - "$id": "84", + "$id": "119", "kind": "duration", "name": "duration", "encode": "seconds", "wireType": { - "$id": "85", + "$id": "120", "kind": "float", "name": "float", "crossLanguageDefinitionId": "TypeSpec.float", @@ -887,16 +1213,16 @@ }, "parameters": [ { - "$id": "86", + "$id": "121", "name": "input", "nameInRequest": "input", "type": { - "$id": "87", + "$id": "122", "kind": "duration", "name": "duration", "encode": "seconds", "wireType": { - "$id": "88", + "$id": "123", "kind": "float", "name": "float", "crossLanguageDefinitionId": "TypeSpec.float", @@ -923,28 +1249,28 @@ "crossLanguageDefinitionId": "Encode.Duration.Query.floatSeconds" }, { - "$id": "89", + "$id": "124", "kind": "basic", "name": "float64Seconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "90", + "$id": "125", "name": "float64Seconds", "resourceName": "Query", "accessibility": "public", "parameters": [ { - "$id": "91", + "$id": "126", "name": "input", "nameInRequest": "input", "type": { - "$id": "92", + "$id": "127", "kind": "duration", "name": "duration", "encode": "seconds", "wireType": { - "$id": "93", + "$id": "128", "kind": "float64", "name": "float64", "crossLanguageDefinitionId": "TypeSpec.float64", @@ -984,16 +1310,16 @@ }, "parameters": [ { - "$id": "94", + "$id": "129", "name": "input", "nameInRequest": "input", "type": { - "$id": "95", + "$id": "130", "kind": "duration", "name": "duration", "encode": "seconds", "wireType": { - "$id": "96", + "$id": "131", "kind": "float64", "name": "float64", "crossLanguageDefinitionId": "TypeSpec.float64", @@ -1020,56 +1346,34 @@ "crossLanguageDefinitionId": "Encode.Duration.Query.float64Seconds" }, { - "$id": "97", + "$id": "132", "kind": "basic", - "name": "int32SecondsArray", + "name": "int32Milliseconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "98", - "name": "int32SecondsArray", + "$id": "133", + "name": "int32Milliseconds", "resourceName": "Query", "accessibility": "public", "parameters": [ { - "$id": "99", + "$id": "134", "name": "input", "nameInRequest": "input", "type": { - "$id": "100", - "kind": "array", - "name": "Array", - "valueType": { - "$id": "101", - "kind": "duration", - "name": "Int32Duration", - "encode": "seconds", - "wireType": { - "$id": "102", - "kind": "int32", - "name": "int32", - "crossLanguageDefinitionId": "TypeSpec.int32", - "decorators": [] - }, - "crossLanguageDefinitionId": "Encode.Duration.Query.Int32Duration", - "baseType": { - "$id": "103", - "kind": "duration", - "name": "duration", - "encode": "ISO8601", - "wireType": { - "$id": "104", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", - "decorators": [] - }, - "crossLanguageDefinitionId": "TypeSpec.duration", - "decorators": [] - }, + "$id": "135", + "kind": "duration", + "name": "duration", + "encode": "milliseconds", + "wireType": { + "$id": "136", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", "decorators": [] }, - "crossLanguageDefinitionId": "TypeSpec.Array", + "crossLanguageDefinitionId": "TypeSpec.duration", "decorators": [] }, "location": "Query", @@ -1077,7 +1381,6 @@ "isContentType": false, "isEndpoint": false, "explode": false, - "arraySerializationDelimiter": ",", "isRequired": true, "kind": "Method", "decorators": [], @@ -1095,27 +1398,38 @@ ], "httpMethod": "GET", "uri": "{endpoint}", - "path": "/encode/duration/query/int32-seconds-array", + "path": "/encode/duration/query/int32-milliseconds", "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Query.int32SecondsArray", + "crossLanguageDefinitionId": "Encode.Duration.Query.int32Milliseconds", "decorators": [] }, "parameters": [ { - "$id": "105", + "$id": "137", "name": "input", "nameInRequest": "input", "type": { - "$ref": "100" + "$id": "138", + "kind": "duration", + "name": "duration", + "encode": "milliseconds", + "wireType": { + "$id": "139", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] }, "location": "Query", "isApiVersion": false, "isContentType": false, "isEndpoint": false, "explode": false, - "arraySerializationDelimiter": ",", "isRequired": true, "kind": "Method", "decorators": [], @@ -1126,109 +1440,40 @@ "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Query.int32SecondsArray" - } - ], - "parameters": [ - { - "$id": "106", - "name": "endpoint", - "nameInRequest": "endpoint", - "doc": "Service host", - "type": { - "$id": "107", - "kind": "url", - "name": "endpoint", - "crossLanguageDefinitionId": "TypeSpec.url" - }, - "location": "Uri", - "isApiVersion": false, - "isContentType": false, - "isRequired": true, - "isEndpoint": true, - "skipUrlEncoding": false, - "explode": false, - "kind": "Client", - "defaultValue": { - "type": { - "$id": "108", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string" - }, - "value": "http://localhost:3000" - }, - "serverUrlTemplate": "{endpoint}" - } - ], - "decorators": [], - "crossLanguageDefinitionId": "Encode.Duration.Query", - "apiVersions": [], - "parent": { - "$ref": "52" - } - }, - { - "$id": "109", - "kind": "client", - "name": "Property", - "namespace": "Encode.Duration.Property", - "methods": [ + "crossLanguageDefinitionId": "Encode.Duration.Query.int32Milliseconds" + }, { - "$id": "110", + "$id": "140", "kind": "basic", - "name": "default", + "name": "floatMilliseconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "111", - "name": "default", - "resourceName": "Property", + "$id": "141", + "name": "floatMilliseconds", + "resourceName": "Query", "accessibility": "public", "parameters": [ { - "$id": "112", - "name": "contentType", - "nameInRequest": "Content-Type", - "doc": "Body parameter's content type. Known values are application/json", - "type": { - "$ref": "1" - }, - "location": "Header", - "isApiVersion": false, - "isContentType": true, - "isEndpoint": false, - "explode": false, - "isRequired": true, - "kind": "Constant", - "decorators": [], - "skipUrlEncoding": false - }, - { - "$id": "113", - "name": "accept", - "nameInRequest": "Accept", - "type": { - "$ref": "3" - }, - "location": "Header", - "isApiVersion": false, - "isContentType": false, - "isEndpoint": false, - "explode": false, - "isRequired": true, - "kind": "Constant", - "decorators": [], - "skipUrlEncoding": false - }, - { - "$id": "114", - "name": "body", - "nameInRequest": "body", + "$id": "142", + "name": "input", + "nameInRequest": "input", "type": { - "$ref": "25" + "$id": "143", + "kind": "duration", + "name": "duration", + "encode": "milliseconds", + "wireType": { + "$id": "144", + "kind": "float", + "name": "float", + "crossLanguageDefinitionId": "TypeSpec.float", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] }, - "location": "Body", + "location": "Query", "isApiVersion": false, "isContentType": false, "isEndpoint": false, @@ -1242,39 +1487,42 @@ "responses": [ { "statusCodes": [ - 200 + 204 ], - "bodyType": { - "$ref": "25" - }, "headers": [], - "isErrorResponse": false, - "contentTypes": [ - "application/json" - ] + "isErrorResponse": false } ], - "httpMethod": "POST", + "httpMethod": "GET", "uri": "{endpoint}", - "path": "/encode/duration/property/default", - "requestMediaTypes": [ - "application/json" - ], + "path": "/encode/duration/query/float-milliseconds", "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.default", + "crossLanguageDefinitionId": "Encode.Duration.Query.floatMilliseconds", "decorators": [] }, "parameters": [ { - "$id": "115", - "name": "body", - "nameInRequest": "body", + "$id": "145", + "name": "input", + "nameInRequest": "input", "type": { - "$ref": "25" + "$id": "146", + "kind": "duration", + "name": "duration", + "encode": "milliseconds", + "wireType": { + "$id": "147", + "kind": "float", + "name": "float", + "crossLanguageDefinitionId": "TypeSpec.float", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] }, - "location": "Body", + "location": "Query", "isApiVersion": false, "isContentType": false, "isEndpoint": false, @@ -1283,15 +1531,961 @@ "kind": "Method", "decorators": [], "skipUrlEncoding": false - }, - { - "$id": "116", - "name": "contentType", - "nameInRequest": "Content-Type", - "doc": "Body parameter's content type. Known values are application/json", - "type": { - "$ref": "1" - }, + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Query.floatMilliseconds" + }, + { + "$id": "148", + "kind": "basic", + "name": "float64Milliseconds", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "149", + "name": "float64Milliseconds", + "resourceName": "Query", + "accessibility": "public", + "parameters": [ + { + "$id": "150", + "name": "input", + "nameInRequest": "input", + "type": { + "$id": "151", + "kind": "duration", + "name": "duration", + "encode": "milliseconds", + "wireType": { + "$id": "152", + "kind": "float64", + "name": "float64", + "crossLanguageDefinitionId": "TypeSpec.float64", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/encode/duration/query/float64-milliseconds", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Query.float64Milliseconds", + "decorators": [] + }, + "parameters": [ + { + "$id": "153", + "name": "input", + "nameInRequest": "input", + "type": { + "$id": "154", + "kind": "duration", + "name": "duration", + "encode": "milliseconds", + "wireType": { + "$id": "155", + "kind": "float64", + "name": "float64", + "crossLanguageDefinitionId": "TypeSpec.float64", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Query.float64Milliseconds" + }, + { + "$id": "156", + "kind": "basic", + "name": "int32SecondsArray", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "157", + "name": "int32SecondsArray", + "resourceName": "Query", + "accessibility": "public", + "parameters": [ + { + "$id": "158", + "name": "input", + "nameInRequest": "input", + "type": { + "$id": "159", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "160", + "kind": "duration", + "name": "Int32Duration", + "encode": "seconds", + "wireType": { + "$id": "161", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "crossLanguageDefinitionId": "Encode.Duration.Query.Int32Duration", + "baseType": { + "$id": "162", + "kind": "duration", + "name": "duration", + "encode": "ISO8601", + "wireType": { + "$id": "163", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/encode/duration/query/int32-seconds-array", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Query.int32SecondsArray", + "decorators": [] + }, + "parameters": [ + { + "$id": "164", + "name": "input", + "nameInRequest": "input", + "type": { + "$ref": "159" + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Query.int32SecondsArray" + }, + { + "$id": "165", + "kind": "basic", + "name": "int32MillisecondsArray", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "166", + "name": "int32MillisecondsArray", + "resourceName": "Query", + "accessibility": "public", + "parameters": [ + { + "$id": "167", + "name": "input", + "nameInRequest": "input", + "type": { + "$id": "168", + "kind": "array", + "name": "Array1", + "valueType": { + "$id": "169", + "kind": "duration", + "name": "Int32MillisecondsDuration", + "encode": "milliseconds", + "wireType": { + "$id": "170", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "crossLanguageDefinitionId": "Encode.Duration.Query.Int32MillisecondsDuration", + "baseType": { + "$id": "171", + "kind": "duration", + "name": "duration", + "encode": "ISO8601", + "wireType": { + "$id": "172", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/encode/duration/query/int32-milliseconds-array", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Query.int32MillisecondsArray", + "decorators": [] + }, + "parameters": [ + { + "$id": "173", + "name": "input", + "nameInRequest": "input", + "type": { + "$ref": "168" + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Query.int32MillisecondsArray" + } + ], + "parameters": [ + { + "$id": "174", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "Service host", + "type": { + "$id": "175", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client", + "defaultValue": { + "type": { + "$id": "176", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "http://localhost:3000" + }, + "serverUrlTemplate": "{endpoint}" + } + ], + "decorators": [], + "crossLanguageDefinitionId": "Encode.Duration.Query", + "apiVersions": [], + "parent": { + "$ref": "87" + } + }, + { + "$id": "177", + "kind": "client", + "name": "Property", + "namespace": "Encode.Duration.Property", + "methods": [ + { + "$id": "178", + "kind": "basic", + "name": "default", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "179", + "name": "default", + "resourceName": "Property", + "accessibility": "public", + "parameters": [ + { + "$id": "180", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "1" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "181", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$ref": "3" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "182", + "name": "body", + "nameInRequest": "body", + "type": { + "$ref": "41" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "41" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/encode/duration/property/default", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Property.default", + "decorators": [] + }, + "parameters": [ + { + "$id": "183", + "name": "body", + "nameInRequest": "body", + "type": { + "$ref": "41" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "184", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "1" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "185", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$ref": "3" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "type": { + "$ref": "41" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Property.default" + }, + { + "$id": "186", + "kind": "basic", + "name": "iso8601", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "187", + "name": "iso8601", + "resourceName": "Property", + "accessibility": "public", + "parameters": [ + { + "$id": "188", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "5" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "189", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$ref": "7" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "190", + "name": "body", + "nameInRequest": "body", + "type": { + "$ref": "45" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "45" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/encode/duration/property/iso8601", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Property.iso8601", + "decorators": [] + }, + "parameters": [ + { + "$id": "191", + "name": "body", + "nameInRequest": "body", + "type": { + "$ref": "45" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "192", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "5" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "193", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$ref": "7" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "type": { + "$ref": "45" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Property.iso8601" + }, + { + "$id": "194", + "kind": "basic", + "name": "int32Seconds", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "195", + "name": "int32Seconds", + "resourceName": "Property", + "accessibility": "public", + "parameters": [ + { + "$id": "196", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "9" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "197", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$ref": "11" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "198", + "name": "body", + "nameInRequest": "body", + "type": { + "$ref": "49" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "49" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/encode/duration/property/int32-seconds", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Property.int32Seconds", + "decorators": [] + }, + "parameters": [ + { + "$id": "199", + "name": "body", + "nameInRequest": "body", + "type": { + "$ref": "49" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "200", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "9" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "201", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$ref": "11" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "type": { + "$ref": "49" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Property.int32Seconds" + }, + { + "$id": "202", + "kind": "basic", + "name": "floatSeconds", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "203", + "name": "floatSeconds", + "resourceName": "Property", + "accessibility": "public", + "parameters": [ + { + "$id": "204", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "13" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "205", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$ref": "15" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "206", + "name": "body", + "nameInRequest": "body", + "type": { + "$ref": "53" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "53" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/encode/duration/property/float-seconds", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Property.floatSeconds", + "decorators": [] + }, + "parameters": [ + { + "$id": "207", + "name": "body", + "nameInRequest": "body", + "type": { + "$ref": "53" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "208", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "13" + }, "location": "Header", "isApiVersion": false, "isContentType": true, @@ -1303,11 +2497,11 @@ "skipUrlEncoding": false }, { - "$id": "117", + "$id": "209", "name": "accept", "nameInRequest": "Accept", "type": { - "$ref": "3" + "$ref": "15" }, "location": "Header", "isApiVersion": false, @@ -1322,33 +2516,33 @@ ], "response": { "type": { - "$ref": "25" + "$ref": "53" } }, "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.default" + "crossLanguageDefinitionId": "Encode.Duration.Property.floatSeconds" }, { - "$id": "118", + "$id": "210", "kind": "basic", - "name": "iso8601", + "name": "float64Seconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "119", - "name": "iso8601", + "$id": "211", + "name": "float64Seconds", "resourceName": "Property", "accessibility": "public", "parameters": [ { - "$id": "120", + "$id": "212", "name": "contentType", "nameInRequest": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "5" + "$ref": "17" }, "location": "Header", "isApiVersion": false, @@ -1361,11 +2555,11 @@ "skipUrlEncoding": false }, { - "$id": "121", + "$id": "213", "name": "accept", "nameInRequest": "Accept", "type": { - "$ref": "7" + "$ref": "19" }, "location": "Header", "isApiVersion": false, @@ -1378,11 +2572,11 @@ "skipUrlEncoding": false }, { - "$id": "122", + "$id": "214", "name": "body", "nameInRequest": "body", "type": { - "$ref": "29" + "$ref": "57" }, "location": "Body", "isApiVersion": false, @@ -1401,7 +2595,7 @@ 200 ], "bodyType": { - "$ref": "29" + "$ref": "57" }, "headers": [], "isErrorResponse": false, @@ -1412,23 +2606,23 @@ ], "httpMethod": "POST", "uri": "{endpoint}", - "path": "/encode/duration/property/iso8601", + "path": "/encode/duration/property/float64-seconds", "requestMediaTypes": [ "application/json" ], "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.iso8601", + "crossLanguageDefinitionId": "Encode.Duration.Property.float64Seconds", "decorators": [] }, "parameters": [ { - "$id": "123", + "$id": "215", "name": "body", "nameInRequest": "body", "type": { - "$ref": "29" + "$ref": "57" }, "location": "Body", "isApiVersion": false, @@ -1441,12 +2635,12 @@ "skipUrlEncoding": false }, { - "$id": "124", + "$id": "216", "name": "contentType", "nameInRequest": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "5" + "$ref": "17" }, "location": "Header", "isApiVersion": false, @@ -1459,11 +2653,11 @@ "skipUrlEncoding": false }, { - "$id": "125", + "$id": "217", "name": "accept", "nameInRequest": "Accept", "type": { - "$ref": "7" + "$ref": "19" }, "location": "Header", "isApiVersion": false, @@ -1478,33 +2672,33 @@ ], "response": { "type": { - "$ref": "29" + "$ref": "57" } }, "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.iso8601" + "crossLanguageDefinitionId": "Encode.Duration.Property.float64Seconds" }, { - "$id": "126", + "$id": "218", "kind": "basic", - "name": "int32Seconds", + "name": "int32Milliseconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "127", - "name": "int32Seconds", + "$id": "219", + "name": "int32Milliseconds", "resourceName": "Property", "accessibility": "public", "parameters": [ { - "$id": "128", + "$id": "220", "name": "contentType", "nameInRequest": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "9" + "$ref": "21" }, "location": "Header", "isApiVersion": false, @@ -1517,11 +2711,11 @@ "skipUrlEncoding": false }, { - "$id": "129", + "$id": "221", "name": "accept", "nameInRequest": "Accept", "type": { - "$ref": "11" + "$ref": "23" }, "location": "Header", "isApiVersion": false, @@ -1534,11 +2728,11 @@ "skipUrlEncoding": false }, { - "$id": "130", + "$id": "222", "name": "body", "nameInRequest": "body", "type": { - "$ref": "33" + "$ref": "61" }, "location": "Body", "isApiVersion": false, @@ -1557,7 +2751,7 @@ 200 ], "bodyType": { - "$ref": "33" + "$ref": "61" }, "headers": [], "isErrorResponse": false, @@ -1568,23 +2762,23 @@ ], "httpMethod": "POST", "uri": "{endpoint}", - "path": "/encode/duration/property/int32-seconds", + "path": "/encode/duration/property/int32-milliseconds", "requestMediaTypes": [ "application/json" ], "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.int32Seconds", + "crossLanguageDefinitionId": "Encode.Duration.Property.int32Milliseconds", "decorators": [] }, "parameters": [ { - "$id": "131", + "$id": "223", "name": "body", "nameInRequest": "body", "type": { - "$ref": "33" + "$ref": "61" }, "location": "Body", "isApiVersion": false, @@ -1597,12 +2791,12 @@ "skipUrlEncoding": false }, { - "$id": "132", + "$id": "224", "name": "contentType", "nameInRequest": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "9" + "$ref": "21" }, "location": "Header", "isApiVersion": false, @@ -1615,11 +2809,11 @@ "skipUrlEncoding": false }, { - "$id": "133", + "$id": "225", "name": "accept", "nameInRequest": "Accept", "type": { - "$ref": "11" + "$ref": "23" }, "location": "Header", "isApiVersion": false, @@ -1634,33 +2828,33 @@ ], "response": { "type": { - "$ref": "33" + "$ref": "61" } }, "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.int32Seconds" + "crossLanguageDefinitionId": "Encode.Duration.Property.int32Milliseconds" }, { - "$id": "134", + "$id": "226", "kind": "basic", - "name": "floatSeconds", + "name": "floatMilliseconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "135", - "name": "floatSeconds", + "$id": "227", + "name": "floatMilliseconds", "resourceName": "Property", "accessibility": "public", "parameters": [ { - "$id": "136", + "$id": "228", "name": "contentType", "nameInRequest": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "13" + "$ref": "25" }, "location": "Header", "isApiVersion": false, @@ -1673,11 +2867,11 @@ "skipUrlEncoding": false }, { - "$id": "137", + "$id": "229", "name": "accept", "nameInRequest": "Accept", "type": { - "$ref": "15" + "$ref": "27" }, "location": "Header", "isApiVersion": false, @@ -1690,11 +2884,11 @@ "skipUrlEncoding": false }, { - "$id": "138", + "$id": "230", "name": "body", "nameInRequest": "body", "type": { - "$ref": "37" + "$ref": "65" }, "location": "Body", "isApiVersion": false, @@ -1713,7 +2907,7 @@ 200 ], "bodyType": { - "$ref": "37" + "$ref": "65" }, "headers": [], "isErrorResponse": false, @@ -1724,23 +2918,23 @@ ], "httpMethod": "POST", "uri": "{endpoint}", - "path": "/encode/duration/property/float-seconds", + "path": "/encode/duration/property/float-milliseconds", "requestMediaTypes": [ "application/json" ], "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.floatSeconds", + "crossLanguageDefinitionId": "Encode.Duration.Property.floatMilliseconds", "decorators": [] }, "parameters": [ { - "$id": "139", + "$id": "231", "name": "body", "nameInRequest": "body", "type": { - "$ref": "37" + "$ref": "65" }, "location": "Body", "isApiVersion": false, @@ -1753,12 +2947,12 @@ "skipUrlEncoding": false }, { - "$id": "140", + "$id": "232", "name": "contentType", "nameInRequest": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "13" + "$ref": "25" }, "location": "Header", "isApiVersion": false, @@ -1771,11 +2965,11 @@ "skipUrlEncoding": false }, { - "$id": "141", + "$id": "233", "name": "accept", "nameInRequest": "Accept", "type": { - "$ref": "15" + "$ref": "27" }, "location": "Header", "isApiVersion": false, @@ -1790,33 +2984,33 @@ ], "response": { "type": { - "$ref": "37" + "$ref": "65" } }, "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.floatSeconds" + "crossLanguageDefinitionId": "Encode.Duration.Property.floatMilliseconds" }, { - "$id": "142", + "$id": "234", "kind": "basic", - "name": "float64Seconds", + "name": "float64Milliseconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "143", - "name": "float64Seconds", + "$id": "235", + "name": "float64Milliseconds", "resourceName": "Property", "accessibility": "public", "parameters": [ { - "$id": "144", + "$id": "236", "name": "contentType", "nameInRequest": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "17" + "$ref": "29" }, "location": "Header", "isApiVersion": false, @@ -1829,11 +3023,11 @@ "skipUrlEncoding": false }, { - "$id": "145", + "$id": "237", "name": "accept", "nameInRequest": "Accept", "type": { - "$ref": "19" + "$ref": "31" }, "location": "Header", "isApiVersion": false, @@ -1846,11 +3040,11 @@ "skipUrlEncoding": false }, { - "$id": "146", + "$id": "238", "name": "body", "nameInRequest": "body", "type": { - "$ref": "41" + "$ref": "69" }, "location": "Body", "isApiVersion": false, @@ -1869,7 +3063,7 @@ 200 ], "bodyType": { - "$ref": "41" + "$ref": "69" }, "headers": [], "isErrorResponse": false, @@ -1880,23 +3074,23 @@ ], "httpMethod": "POST", "uri": "{endpoint}", - "path": "/encode/duration/property/float64-seconds", + "path": "/encode/duration/property/float64-milliseconds", "requestMediaTypes": [ "application/json" ], "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.float64Seconds", + "crossLanguageDefinitionId": "Encode.Duration.Property.float64Milliseconds", "decorators": [] }, "parameters": [ { - "$id": "147", + "$id": "239", "name": "body", "nameInRequest": "body", "type": { - "$ref": "41" + "$ref": "69" }, "location": "Body", "isApiVersion": false, @@ -1909,12 +3103,12 @@ "skipUrlEncoding": false }, { - "$id": "148", + "$id": "240", "name": "contentType", "nameInRequest": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "17" + "$ref": "29" }, "location": "Header", "isApiVersion": false, @@ -1927,11 +3121,11 @@ "skipUrlEncoding": false }, { - "$id": "149", + "$id": "241", "name": "accept", "nameInRequest": "Accept", "type": { - "$ref": "19" + "$ref": "31" }, "location": "Header", "isApiVersion": false, @@ -1946,33 +3140,33 @@ ], "response": { "type": { - "$ref": "41" + "$ref": "69" } }, "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.float64Seconds" + "crossLanguageDefinitionId": "Encode.Duration.Property.float64Milliseconds" }, { - "$id": "150", + "$id": "242", "kind": "basic", "name": "floatSecondsArray", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "151", + "$id": "243", "name": "floatSecondsArray", "resourceName": "Property", "accessibility": "public", "parameters": [ { - "$id": "152", + "$id": "244", "name": "contentType", "nameInRequest": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "21" + "$ref": "33" }, "location": "Header", "isApiVersion": false, @@ -1985,11 +3179,11 @@ "skipUrlEncoding": false }, { - "$id": "153", + "$id": "245", "name": "accept", "nameInRequest": "Accept", "type": { - "$ref": "23" + "$ref": "35" }, "location": "Header", "isApiVersion": false, @@ -2002,11 +3196,11 @@ "skipUrlEncoding": false }, { - "$id": "154", + "$id": "246", "name": "body", "nameInRequest": "body", "type": { - "$ref": "45" + "$ref": "73" }, "location": "Body", "isApiVersion": false, @@ -2025,7 +3219,7 @@ 200 ], "bodyType": { - "$ref": "45" + "$ref": "73" }, "headers": [], "isErrorResponse": false, @@ -2043,16 +3237,172 @@ "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.floatSecondsArray", + "crossLanguageDefinitionId": "Encode.Duration.Property.floatSecondsArray", + "decorators": [] + }, + "parameters": [ + { + "$id": "247", + "name": "body", + "nameInRequest": "body", + "type": { + "$ref": "73" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "248", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "33" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "249", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$ref": "35" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": { + "type": { + "$ref": "73" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Property.floatSecondsArray" + }, + { + "$id": "250", + "kind": "basic", + "name": "floatMillisecondsArray", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "251", + "name": "floatMillisecondsArray", + "resourceName": "Property", + "accessibility": "public", + "parameters": [ + { + "$id": "252", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$ref": "37" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "253", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$ref": "39" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "254", + "name": "body", + "nameInRequest": "body", + "type": { + "$ref": "80" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "80" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/encode/duration/property/float-milliseconds-array", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Property.floatMillisecondsArray", "decorators": [] }, "parameters": [ { - "$id": "155", + "$id": "255", "name": "body", "nameInRequest": "body", "type": { - "$ref": "45" + "$ref": "80" }, "location": "Body", "isApiVersion": false, @@ -2065,12 +3415,12 @@ "skipUrlEncoding": false }, { - "$id": "156", + "$id": "256", "name": "contentType", "nameInRequest": "Content-Type", "doc": "Body parameter's content type. Known values are application/json", "type": { - "$ref": "21" + "$ref": "37" }, "location": "Header", "isApiVersion": false, @@ -2083,11 +3433,11 @@ "skipUrlEncoding": false }, { - "$id": "157", + "$id": "257", "name": "accept", "nameInRequest": "Accept", "type": { - "$ref": "23" + "$ref": "39" }, "location": "Header", "isApiVersion": false, @@ -2102,23 +3452,23 @@ ], "response": { "type": { - "$ref": "45" + "$ref": "80" } }, "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Property.floatSecondsArray" + "crossLanguageDefinitionId": "Encode.Duration.Property.floatMillisecondsArray" } ], "parameters": [ { - "$id": "158", + "$id": "258", "name": "endpoint", "nameInRequest": "endpoint", "doc": "Service host", "type": { - "$id": "159", + "$id": "259", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -2133,7 +3483,7 @@ "kind": "Client", "defaultValue": { "type": { - "$id": "160", + "$id": "260", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" @@ -2147,41 +3497,344 @@ "crossLanguageDefinitionId": "Encode.Duration.Property", "apiVersions": [], "parent": { - "$ref": "52" + "$ref": "87" } }, { - "$id": "161", + "$id": "261", "kind": "client", "name": "Header", "namespace": "Encode.Duration.Header", "methods": [ { - "$id": "162", + "$id": "262", + "kind": "basic", + "name": "default", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "263", + "name": "default", + "resourceName": "Header", + "accessibility": "public", + "parameters": [ + { + "$id": "264", + "name": "duration", + "nameInRequest": "duration", + "type": { + "$id": "265", + "kind": "duration", + "name": "duration", + "encode": "ISO8601", + "wireType": { + "$id": "266", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/encode/duration/header/default", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Header.default", + "decorators": [] + }, + "parameters": [ + { + "$id": "267", + "name": "duration", + "nameInRequest": "duration", + "type": { + "$id": "268", + "kind": "duration", + "name": "duration", + "encode": "ISO8601", + "wireType": { + "$id": "269", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Header.default" + }, + { + "$id": "270", + "kind": "basic", + "name": "iso8601", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "271", + "name": "iso8601", + "resourceName": "Header", + "accessibility": "public", + "parameters": [ + { + "$id": "272", + "name": "duration", + "nameInRequest": "duration", + "type": { + "$id": "273", + "kind": "duration", + "name": "duration", + "encode": "ISO8601", + "wireType": { + "$id": "274", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/encode/duration/header/iso8601", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Header.iso8601", + "decorators": [] + }, + "parameters": [ + { + "$id": "275", + "name": "duration", + "nameInRequest": "duration", + "type": { + "$id": "276", + "kind": "duration", + "name": "duration", + "encode": "ISO8601", + "wireType": { + "$id": "277", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Header.iso8601" + }, + { + "$id": "278", + "kind": "basic", + "name": "iso8601Array", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "279", + "name": "iso8601Array", + "resourceName": "Header", + "accessibility": "public", + "parameters": [ + { + "$id": "280", + "name": "duration", + "nameInRequest": "duration", + "type": { + "$id": "281", + "kind": "array", + "name": "Array4", + "valueType": { + "$id": "282", + "kind": "duration", + "name": "Iso8601Duration", + "encode": "ISO8601", + "wireType": { + "$id": "283", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "Encode.Duration.Header.Iso8601Duration", + "baseType": { + "$id": "284", + "kind": "duration", + "name": "duration", + "encode": "ISO8601", + "wireType": { + "$id": "285", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/encode/duration/header/iso8601-array", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Header.iso8601Array", + "decorators": [] + }, + "parameters": [ + { + "$id": "286", + "name": "duration", + "nameInRequest": "duration", + "type": { + "$ref": "281" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Header.iso8601Array" + }, + { + "$id": "287", "kind": "basic", - "name": "default", + "name": "int32Seconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "163", - "name": "default", + "$id": "288", + "name": "int32Seconds", "resourceName": "Header", "accessibility": "public", "parameters": [ { - "$id": "164", + "$id": "289", "name": "duration", "nameInRequest": "duration", "type": { - "$id": "165", + "$id": "290", "kind": "duration", "name": "duration", - "encode": "ISO8601", + "encode": "seconds", "wireType": { - "$id": "166", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", + "$id": "291", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", "decorators": [] }, "crossLanguageDefinitionId": "TypeSpec.duration", @@ -2209,28 +3862,28 @@ ], "httpMethod": "GET", "uri": "{endpoint}", - "path": "/encode/duration/header/default", + "path": "/encode/duration/header/int32-seconds", "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.default", + "crossLanguageDefinitionId": "Encode.Duration.Header.int32Seconds", "decorators": [] }, "parameters": [ { - "$id": "167", + "$id": "292", "name": "duration", "nameInRequest": "duration", "type": { - "$id": "168", + "$id": "293", "kind": "duration", "name": "duration", - "encode": "ISO8601", + "encode": "seconds", "wireType": { - "$id": "169", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", + "$id": "294", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", "decorators": [] }, "crossLanguageDefinitionId": "TypeSpec.duration", @@ -2251,34 +3904,34 @@ "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.default" + "crossLanguageDefinitionId": "Encode.Duration.Header.int32Seconds" }, { - "$id": "170", + "$id": "295", "kind": "basic", - "name": "iso8601", + "name": "floatSeconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "171", - "name": "iso8601", + "$id": "296", + "name": "floatSeconds", "resourceName": "Header", "accessibility": "public", "parameters": [ { - "$id": "172", + "$id": "297", "name": "duration", "nameInRequest": "duration", "type": { - "$id": "173", + "$id": "298", "kind": "duration", "name": "duration", - "encode": "ISO8601", + "encode": "seconds", "wireType": { - "$id": "174", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", + "$id": "299", + "kind": "float", + "name": "float", + "crossLanguageDefinitionId": "TypeSpec.float", "decorators": [] }, "crossLanguageDefinitionId": "TypeSpec.duration", @@ -2306,28 +3959,28 @@ ], "httpMethod": "GET", "uri": "{endpoint}", - "path": "/encode/duration/header/iso8601", + "path": "/encode/duration/header/float-seconds", "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.iso8601", + "crossLanguageDefinitionId": "Encode.Duration.Header.floatSeconds", "decorators": [] }, "parameters": [ { - "$id": "175", + "$id": "300", "name": "duration", "nameInRequest": "duration", "type": { - "$id": "176", + "$id": "301", "kind": "duration", "name": "duration", - "encode": "ISO8601", + "encode": "seconds", "wireType": { - "$id": "177", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", + "$id": "302", + "kind": "float", + "name": "float", + "crossLanguageDefinitionId": "TypeSpec.float", "decorators": [] }, "crossLanguageDefinitionId": "TypeSpec.duration", @@ -2348,59 +4001,37 @@ "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.iso8601" + "crossLanguageDefinitionId": "Encode.Duration.Header.floatSeconds" }, { - "$id": "178", + "$id": "303", "kind": "basic", - "name": "iso8601Array", + "name": "float64Seconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "179", - "name": "iso8601Array", + "$id": "304", + "name": "float64Seconds", "resourceName": "Header", "accessibility": "public", "parameters": [ { - "$id": "180", + "$id": "305", "name": "duration", "nameInRequest": "duration", "type": { - "$id": "181", - "kind": "array", - "name": "Array2", - "valueType": { - "$id": "182", - "kind": "duration", - "name": "Iso8601Duration", - "encode": "ISO8601", - "wireType": { - "$id": "183", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", - "decorators": [] - }, - "crossLanguageDefinitionId": "Encode.Duration.Header.Iso8601Duration", - "baseType": { - "$id": "184", - "kind": "duration", - "name": "duration", - "encode": "ISO8601", - "wireType": { - "$id": "185", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", - "decorators": [] - }, - "crossLanguageDefinitionId": "TypeSpec.duration", - "decorators": [] - }, + "$id": "306", + "kind": "duration", + "name": "duration", + "encode": "seconds", + "wireType": { + "$id": "307", + "kind": "float64", + "name": "float64", + "crossLanguageDefinitionId": "TypeSpec.float64", "decorators": [] }, - "crossLanguageDefinitionId": "TypeSpec.Array", + "crossLanguageDefinitionId": "TypeSpec.duration", "decorators": [] }, "location": "Header", @@ -2408,7 +4039,6 @@ "isContentType": false, "isEndpoint": false, "explode": false, - "arraySerializationDelimiter": ",", "isRequired": true, "kind": "Method", "decorators": [], @@ -2426,27 +4056,38 @@ ], "httpMethod": "GET", "uri": "{endpoint}", - "path": "/encode/duration/header/iso8601-array", + "path": "/encode/duration/header/float64-seconds", "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.iso8601Array", + "crossLanguageDefinitionId": "Encode.Duration.Header.float64Seconds", "decorators": [] }, "parameters": [ { - "$id": "186", + "$id": "308", "name": "duration", "nameInRequest": "duration", "type": { - "$ref": "181" + "$id": "309", + "kind": "duration", + "name": "duration", + "encode": "seconds", + "wireType": { + "$id": "310", + "kind": "float64", + "name": "float64", + "crossLanguageDefinitionId": "TypeSpec.float64", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] }, "location": "Header", "isApiVersion": false, "isContentType": false, "isEndpoint": false, "explode": false, - "arraySerializationDelimiter": ",", "isRequired": true, "kind": "Method", "decorators": [], @@ -2457,31 +4098,31 @@ "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.iso8601Array" + "crossLanguageDefinitionId": "Encode.Duration.Header.float64Seconds" }, { - "$id": "187", + "$id": "311", "kind": "basic", - "name": "int32Seconds", + "name": "int32Milliseconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "188", - "name": "int32Seconds", + "$id": "312", + "name": "int32Milliseconds", "resourceName": "Header", "accessibility": "public", "parameters": [ { - "$id": "189", + "$id": "313", "name": "duration", "nameInRequest": "duration", "type": { - "$id": "190", + "$id": "314", "kind": "duration", "name": "duration", - "encode": "seconds", + "encode": "milliseconds", "wireType": { - "$id": "191", + "$id": "315", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -2512,25 +4153,25 @@ ], "httpMethod": "GET", "uri": "{endpoint}", - "path": "/encode/duration/header/int32-seconds", + "path": "/encode/duration/header/int32-milliseconds", "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.int32Seconds", + "crossLanguageDefinitionId": "Encode.Duration.Header.int32Milliseconds", "decorators": [] }, "parameters": [ { - "$id": "192", + "$id": "316", "name": "duration", "nameInRequest": "duration", "type": { - "$id": "193", + "$id": "317", "kind": "duration", "name": "duration", - "encode": "seconds", + "encode": "milliseconds", "wireType": { - "$id": "194", + "$id": "318", "kind": "int32", "name": "int32", "crossLanguageDefinitionId": "TypeSpec.int32", @@ -2554,31 +4195,31 @@ "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.int32Seconds" + "crossLanguageDefinitionId": "Encode.Duration.Header.int32Milliseconds" }, { - "$id": "195", + "$id": "319", "kind": "basic", - "name": "floatSeconds", + "name": "floatMilliseconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "196", - "name": "floatSeconds", + "$id": "320", + "name": "floatMilliseconds", "resourceName": "Header", "accessibility": "public", "parameters": [ { - "$id": "197", + "$id": "321", "name": "duration", "nameInRequest": "duration", "type": { - "$id": "198", + "$id": "322", "kind": "duration", "name": "duration", - "encode": "seconds", + "encode": "milliseconds", "wireType": { - "$id": "199", + "$id": "323", "kind": "float", "name": "float", "crossLanguageDefinitionId": "TypeSpec.float", @@ -2609,25 +4250,25 @@ ], "httpMethod": "GET", "uri": "{endpoint}", - "path": "/encode/duration/header/float-seconds", + "path": "/encode/duration/header/float-milliseconds", "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.floatSeconds", + "crossLanguageDefinitionId": "Encode.Duration.Header.floatMilliseconds", "decorators": [] }, "parameters": [ { - "$id": "200", + "$id": "324", "name": "duration", "nameInRequest": "duration", "type": { - "$id": "201", + "$id": "325", "kind": "duration", "name": "duration", - "encode": "seconds", + "encode": "milliseconds", "wireType": { - "$id": "202", + "$id": "326", "kind": "float", "name": "float", "crossLanguageDefinitionId": "TypeSpec.float", @@ -2651,31 +4292,31 @@ "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.floatSeconds" + "crossLanguageDefinitionId": "Encode.Duration.Header.floatMilliseconds" }, { - "$id": "203", + "$id": "327", "kind": "basic", - "name": "float64Seconds", + "name": "float64Milliseconds", "accessibility": "public", "apiVersions": [], "operation": { - "$id": "204", - "name": "float64Seconds", + "$id": "328", + "name": "float64Milliseconds", "resourceName": "Header", "accessibility": "public", "parameters": [ { - "$id": "205", + "$id": "329", "name": "duration", "nameInRequest": "duration", "type": { - "$id": "206", + "$id": "330", "kind": "duration", "name": "duration", - "encode": "seconds", + "encode": "milliseconds", "wireType": { - "$id": "207", + "$id": "331", "kind": "float64", "name": "float64", "crossLanguageDefinitionId": "TypeSpec.float64", @@ -2706,25 +4347,25 @@ ], "httpMethod": "GET", "uri": "{endpoint}", - "path": "/encode/duration/header/float64-seconds", + "path": "/encode/duration/header/float64-milliseconds", "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.float64Seconds", + "crossLanguageDefinitionId": "Encode.Duration.Header.float64Milliseconds", "decorators": [] }, "parameters": [ { - "$id": "208", + "$id": "332", "name": "duration", "nameInRequest": "duration", "type": { - "$id": "209", + "$id": "333", "kind": "duration", "name": "duration", - "encode": "seconds", + "encode": "milliseconds", "wireType": { - "$id": "210", + "$id": "334", "kind": "float64", "name": "float64", "crossLanguageDefinitionId": "TypeSpec.float64", @@ -2748,17 +4389,126 @@ "isOverride": false, "generateConvenient": true, "generateProtocol": true, - "crossLanguageDefinitionId": "Encode.Duration.Header.float64Seconds" + "crossLanguageDefinitionId": "Encode.Duration.Header.float64Milliseconds" + }, + { + "$id": "335", + "kind": "basic", + "name": "int32MillisecondsArray", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "336", + "name": "int32MillisecondsArray", + "resourceName": "Header", + "accessibility": "public", + "parameters": [ + { + "$id": "337", + "name": "duration", + "nameInRequest": "duration", + "type": { + "$id": "338", + "kind": "array", + "name": "Array5", + "valueType": { + "$id": "339", + "kind": "duration", + "name": "Int32MillisecondsDuration", + "encode": "milliseconds", + "wireType": { + "$id": "340", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "crossLanguageDefinitionId": "Encode.Duration.Header.Int32MillisecondsDuration", + "baseType": { + "$id": "341", + "kind": "duration", + "name": "duration", + "encode": "ISO8601", + "wireType": { + "$id": "342", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.duration", + "decorators": [] + }, + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/encode/duration/header/int32-milliseconds-array", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Encode.Duration.Header.int32MillisecondsArray", + "decorators": [] + }, + "parameters": [ + { + "$id": "343", + "name": "duration", + "nameInRequest": "duration", + "type": { + "$ref": "338" + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "arraySerializationDelimiter": ",", + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Encode.Duration.Header.int32MillisecondsArray" } ], "parameters": [ { - "$id": "211", + "$id": "344", "name": "endpoint", "nameInRequest": "endpoint", "doc": "Service host", "type": { - "$id": "212", + "$id": "345", "kind": "url", "name": "endpoint", "crossLanguageDefinitionId": "TypeSpec.url" @@ -2773,7 +4523,7 @@ "kind": "Client", "defaultValue": { "type": { - "$id": "213", + "$id": "346", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" @@ -2787,7 +4537,7 @@ "crossLanguageDefinitionId": "Encode.Duration.Header", "apiVersions": [], "parent": { - "$ref": "52" + "$ref": "87" } } ] diff --git a/test/CadlRanchProjects/payload/multipart/tspCodeModel.json b/test/CadlRanchProjects/payload/multipart/tspCodeModel.json index bf025636435..3aa5aa46d3b 100644 --- a/test/CadlRanchProjects/payload/multipart/tspCodeModel.json +++ b/test/CadlRanchProjects/payload/multipart/tspCodeModel.json @@ -1178,8 +1178,8 @@ "$id": "106", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "filename", @@ -1211,8 +1211,8 @@ "$id": "108", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "contentType", @@ -1411,8 +1411,8 @@ "$id": "120", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "filename", @@ -1449,8 +1449,8 @@ "$id": "123", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "FileSpecificContentTypeContentType", @@ -1602,8 +1602,8 @@ "$id": "132", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "filename", @@ -1637,8 +1637,8 @@ "$id": "134", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "contentType", @@ -1720,8 +1720,8 @@ "$id": "140", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "FloatRequestTemperatureContentType", diff --git a/test/CadlRanchProjects/server/versions/not-versioned/tspCodeModel.json b/test/CadlRanchProjects/server/versions/not-versioned/tspCodeModel.json index 1fb41de565c..a999da926d8 100644 --- a/test/CadlRanchProjects/server/versions/not-versioned/tspCodeModel.json +++ b/test/CadlRanchProjects/server/versions/not-versioned/tspCodeModel.json @@ -114,7 +114,7 @@ "decorators": [] }, "location": "Query", - "isApiVersion": true, + "isApiVersion": false, "isContentType": false, "isEndpoint": false, "explode": false, @@ -195,7 +195,7 @@ "decorators": [] }, "location": "Path", - "isApiVersion": true, + "isApiVersion": false, "isContentType": false, "isEndpoint": false, "explode": false, diff --git a/test/CadlRanchProjectsNonAzure/payload/multipart/tspCodeModel.json b/test/CadlRanchProjectsNonAzure/payload/multipart/tspCodeModel.json index 7b010232fc5..a940f3a4a19 100644 --- a/test/CadlRanchProjectsNonAzure/payload/multipart/tspCodeModel.json +++ b/test/CadlRanchProjectsNonAzure/payload/multipart/tspCodeModel.json @@ -1178,8 +1178,8 @@ "$id": "106", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "filename", @@ -1211,8 +1211,8 @@ "$id": "108", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "contentType", @@ -1411,8 +1411,8 @@ "$id": "120", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "filename", @@ -1449,8 +1449,8 @@ "$id": "123", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "FileSpecificContentTypeContentType", @@ -1602,8 +1602,8 @@ "$id": "132", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "filename", @@ -1637,8 +1637,8 @@ "$id": "134", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "contentType", @@ -1720,8 +1720,8 @@ "$id": "140", "kind": "string", "decorators": [], - "name": "string", "doc": "A sequence of textual characters.", + "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, "name": "FloatRequestTemperatureContentType", diff --git a/test/TestProjects/Authoring-TypeSpec/Authoring-TypeSpec.tsp b/test/TestProjects/Authoring-TypeSpec/Authoring-TypeSpec.tsp index c450b3ff40c..9f204ede7ae 100644 --- a/test/TestProjects/Authoring-TypeSpec/Authoring-TypeSpec.tsp +++ b/test/TestProjects/Authoring-TypeSpec/Authoring-TypeSpec.tsp @@ -27,7 +27,6 @@ using Azure.ClientGenerator.Core; namespace AuthoringTypeSpec; enum Versions { - @useDependency(Azure.Core.Versions.v1_0_Preview_1) "2022-05-15-preview" } @@ -336,4 +335,4 @@ interface Global { // Under global -// "/authoring/analyze-text/projects/global/deletion-jobs/{jobId}": { \ No newline at end of file +// "/authoring/analyze-text/projects/global/deletion-jobs/{jobId}": { diff --git a/test/TestProjects/FirstTest-TypeSpec/FirstTest-TypeSpec.tsp b/test/TestProjects/FirstTest-TypeSpec/FirstTest-TypeSpec.tsp index 94483f9dff4..787a18126ca 100644 --- a/test/TestProjects/FirstTest-TypeSpec/FirstTest-TypeSpec.tsp +++ b/test/TestProjects/FirstTest-TypeSpec/FirstTest-TypeSpec.tsp @@ -39,7 +39,6 @@ model AuthFlow { } enum Versions { - @useDependency(Azure.Core.Versions.v1_0_Preview_1) "2022-05-15-preview" } diff --git a/test/TestProjects/MgmtAcronymMapping/src/MgmtAcronymMapping.csproj b/test/TestProjects/MgmtAcronymMapping/src/MgmtAcronymMapping.csproj index 4a99cef0ea8..19f31bc5953 100644 --- a/test/TestProjects/MgmtAcronymMapping/src/MgmtAcronymMapping.csproj +++ b/test/TestProjects/MgmtAcronymMapping/src/MgmtAcronymMapping.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtAcronymMapping. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtacronymmapping + true MgmtAcronymMapping diff --git a/test/TestProjects/MgmtCollectionParent/src/MgmtCollectionParent.csproj b/test/TestProjects/MgmtCollectionParent/src/MgmtCollectionParent.csproj index b2a8d7c4657..7ca76823584 100644 --- a/test/TestProjects/MgmtCollectionParent/src/MgmtCollectionParent.csproj +++ b/test/TestProjects/MgmtCollectionParent/src/MgmtCollectionParent.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtCollectionParent. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtcollectionparent + true MgmtCollectionParent diff --git a/test/TestProjects/MgmtConstants/src/MgmtConstants.csproj b/test/TestProjects/MgmtConstants/src/MgmtConstants.csproj index b506503b4e4..e0ad8dd301e 100644 --- a/test/TestProjects/MgmtConstants/src/MgmtConstants.csproj +++ b/test/TestProjects/MgmtConstants/src/MgmtConstants.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtConstants. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtconstants + true MgmtConstants diff --git a/test/TestProjects/MgmtDiscriminator/src/MgmtDiscriminator.csproj b/test/TestProjects/MgmtDiscriminator/src/MgmtDiscriminator.csproj index 4e4d38fe2a6..2938ff5ad2d 100644 --- a/test/TestProjects/MgmtDiscriminator/src/MgmtDiscriminator.csproj +++ b/test/TestProjects/MgmtDiscriminator/src/MgmtDiscriminator.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtDiscriminator. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtdiscriminator + true MgmtDiscriminator diff --git a/test/TestProjects/MgmtExactMatchFlattenInheritance/src/MgmtExactMatchFlattenInheritance.csproj b/test/TestProjects/MgmtExactMatchFlattenInheritance/src/MgmtExactMatchFlattenInheritance.csproj index e660222828f..a8ce8f0f8df 100644 --- a/test/TestProjects/MgmtExactMatchFlattenInheritance/src/MgmtExactMatchFlattenInheritance.csproj +++ b/test/TestProjects/MgmtExactMatchFlattenInheritance/src/MgmtExactMatchFlattenInheritance.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtExactMatchFlattenInheritance. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtexactmatchflatteninheritance + true MgmtExactMatchFlattenInheritance diff --git a/test/TestProjects/MgmtExactMatchInheritance/src/MgmtExactMatchInheritance.csproj b/test/TestProjects/MgmtExactMatchInheritance/src/MgmtExactMatchInheritance.csproj index e780373f5eb..eca7860bd36 100644 --- a/test/TestProjects/MgmtExactMatchInheritance/src/MgmtExactMatchInheritance.csproj +++ b/test/TestProjects/MgmtExactMatchInheritance/src/MgmtExactMatchInheritance.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtExactMatchInheritance. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtexactmatchinheritance + true MgmtExactMatchInheritance diff --git a/test/TestProjects/MgmtExpandResourceTypes/src/MgmtExpandResourceTypes.csproj b/test/TestProjects/MgmtExpandResourceTypes/src/MgmtExpandResourceTypes.csproj index 4976ef29622..d365d2c76af 100644 --- a/test/TestProjects/MgmtExpandResourceTypes/src/MgmtExpandResourceTypes.csproj +++ b/test/TestProjects/MgmtExpandResourceTypes/src/MgmtExpandResourceTypes.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtExpandResourceTypes. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtexpandresourcetypes + true MgmtExpandResourceTypes diff --git a/test/TestProjects/MgmtExtensionCommonRestOperation/src/MgmtExtensionCommonRestOperation.csproj b/test/TestProjects/MgmtExtensionCommonRestOperation/src/MgmtExtensionCommonRestOperation.csproj index fc06f6b5b69..f86051f1214 100644 --- a/test/TestProjects/MgmtExtensionCommonRestOperation/src/MgmtExtensionCommonRestOperation.csproj +++ b/test/TestProjects/MgmtExtensionCommonRestOperation/src/MgmtExtensionCommonRestOperation.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtExtensionCommonRestOperation. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtextensioncommonrestoperation + true MgmtExtensionCommonRestOperation diff --git a/test/TestProjects/MgmtExtensionResource/src/MgmtExtensionResource.csproj b/test/TestProjects/MgmtExtensionResource/src/MgmtExtensionResource.csproj index 86a2e823817..2339dd164a1 100644 --- a/test/TestProjects/MgmtExtensionResource/src/MgmtExtensionResource.csproj +++ b/test/TestProjects/MgmtExtensionResource/src/MgmtExtensionResource.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtExtensionResource. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtextensionresource + true MgmtExtensionResource diff --git a/test/TestProjects/MgmtHierarchicalNonResource/src/MgmtHierarchicalNonResource.csproj b/test/TestProjects/MgmtHierarchicalNonResource/src/MgmtHierarchicalNonResource.csproj index 9879aecb7ad..bf9cf5da2db 100644 --- a/test/TestProjects/MgmtHierarchicalNonResource/src/MgmtHierarchicalNonResource.csproj +++ b/test/TestProjects/MgmtHierarchicalNonResource/src/MgmtHierarchicalNonResource.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtHierarchicalNonResource. 1.0.0-beta.1 azure;management;arm;resource manager;mgmthierarchicalnonresource + true MgmtHierarchicalNonResource diff --git a/test/TestProjects/MgmtLRO/src/MgmtLRO.csproj b/test/TestProjects/MgmtLRO/src/MgmtLRO.csproj index a5f82b879e1..1226997cc95 100644 --- a/test/TestProjects/MgmtLRO/src/MgmtLRO.csproj +++ b/test/TestProjects/MgmtLRO/src/MgmtLRO.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtLRO. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtlro + true MgmtLRO diff --git a/test/TestProjects/MgmtListMethods/src/MgmtListMethods.csproj b/test/TestProjects/MgmtListMethods/src/MgmtListMethods.csproj index 8eb17143df8..6f4f51967cb 100644 --- a/test/TestProjects/MgmtListMethods/src/MgmtListMethods.csproj +++ b/test/TestProjects/MgmtListMethods/src/MgmtListMethods.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtListMethods. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtlistmethods + true MgmtListMethods diff --git a/test/TestProjects/MgmtMockAndSample/src/MgmtMockAndSample.csproj b/test/TestProjects/MgmtMockAndSample/src/MgmtMockAndSample.csproj index eae2f6e66b7..1a61edecc90 100644 --- a/test/TestProjects/MgmtMockAndSample/src/MgmtMockAndSample.csproj +++ b/test/TestProjects/MgmtMockAndSample/src/MgmtMockAndSample.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtMockAndSample. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtmockandsample + true MgmtMockAndSample diff --git a/test/TestProjects/MgmtMultipleParentResource/src/MgmtMultipleParentResource.csproj b/test/TestProjects/MgmtMultipleParentResource/src/MgmtMultipleParentResource.csproj index 2156bcdafbc..c6a4c7b4083 100644 --- a/test/TestProjects/MgmtMultipleParentResource/src/MgmtMultipleParentResource.csproj +++ b/test/TestProjects/MgmtMultipleParentResource/src/MgmtMultipleParentResource.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtMultipleParentResource. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtmultipleparentresource + true MgmtMultipleParentResource diff --git a/test/TestProjects/MgmtNoTypeReplacement/src/MgmtNoTypeReplacement.csproj b/test/TestProjects/MgmtNoTypeReplacement/src/MgmtNoTypeReplacement.csproj index 201d7f3affa..23162c1c1ca 100644 --- a/test/TestProjects/MgmtNoTypeReplacement/src/MgmtNoTypeReplacement.csproj +++ b/test/TestProjects/MgmtNoTypeReplacement/src/MgmtNoTypeReplacement.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtNoTypeReplacement. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtnotypereplacement + true MgmtNoTypeReplacement diff --git a/test/TestProjects/MgmtNonStringPathVariable/src/MgmtNonStringPathVariable.csproj b/test/TestProjects/MgmtNonStringPathVariable/src/MgmtNonStringPathVariable.csproj index a090a185abe..0fb8c6a0c35 100644 --- a/test/TestProjects/MgmtNonStringPathVariable/src/MgmtNonStringPathVariable.csproj +++ b/test/TestProjects/MgmtNonStringPathVariable/src/MgmtNonStringPathVariable.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtNonStringPathVariable. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtnonstringpathvariable + true MgmtNonStringPathVariable diff --git a/test/TestProjects/MgmtOmitOperationGroups/src/MgmtOmitOperationGroups.csproj b/test/TestProjects/MgmtOmitOperationGroups/src/MgmtOmitOperationGroups.csproj index 4ed10603929..3052c1dd4da 100644 --- a/test/TestProjects/MgmtOmitOperationGroups/src/MgmtOmitOperationGroups.csproj +++ b/test/TestProjects/MgmtOmitOperationGroups/src/MgmtOmitOperationGroups.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtOmitOperationGroups. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtomitoperationgroups + true MgmtOmitOperationGroups diff --git a/test/TestProjects/MgmtOperations/src/MgmtOperations.csproj b/test/TestProjects/MgmtOperations/src/MgmtOperations.csproj index b044a3749af..5c023a4a301 100644 --- a/test/TestProjects/MgmtOperations/src/MgmtOperations.csproj +++ b/test/TestProjects/MgmtOperations/src/MgmtOperations.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtOperations. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtoperations + true MgmtOperations diff --git a/test/TestProjects/MgmtPagination/src/MgmtPagination.csproj b/test/TestProjects/MgmtPagination/src/MgmtPagination.csproj index ab0b2fe39be..8127f13dabe 100644 --- a/test/TestProjects/MgmtPagination/src/MgmtPagination.csproj +++ b/test/TestProjects/MgmtPagination/src/MgmtPagination.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtPagination. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtpagination + true MgmtPagination diff --git a/test/TestProjects/MgmtParamOrdering/src/MgmtParamOrdering.csproj b/test/TestProjects/MgmtParamOrdering/src/MgmtParamOrdering.csproj index 0701dc6119c..53c2fa6fd44 100644 --- a/test/TestProjects/MgmtParamOrdering/src/MgmtParamOrdering.csproj +++ b/test/TestProjects/MgmtParamOrdering/src/MgmtParamOrdering.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtParamOrdering. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtparamordering + true MgmtParamOrdering diff --git a/test/TestProjects/MgmtParent/src/MgmtParent.csproj b/test/TestProjects/MgmtParent/src/MgmtParent.csproj index 7669ad5218e..23931915f2a 100644 --- a/test/TestProjects/MgmtParent/src/MgmtParent.csproj +++ b/test/TestProjects/MgmtParent/src/MgmtParent.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtParent. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtparent + true MgmtParent diff --git a/test/TestProjects/MgmtPartialResource/src/MgmtPartialResource.csproj b/test/TestProjects/MgmtPartialResource/src/MgmtPartialResource.csproj index 5bbfb4d6d5f..9fd40097a28 100644 --- a/test/TestProjects/MgmtPartialResource/src/MgmtPartialResource.csproj +++ b/test/TestProjects/MgmtPartialResource/src/MgmtPartialResource.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtPartialResource. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtpartialresource + true MgmtPartialResource diff --git a/test/TestProjects/MgmtPropertyBag/src/MgmtPropertyBag.csproj b/test/TestProjects/MgmtPropertyBag/src/MgmtPropertyBag.csproj index 7351d171957..c27fcd7d7a3 100644 --- a/test/TestProjects/MgmtPropertyBag/src/MgmtPropertyBag.csproj +++ b/test/TestProjects/MgmtPropertyBag/src/MgmtPropertyBag.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtPropertyBag. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtpropertybag + true MgmtPropertyBag diff --git a/test/TestProjects/MgmtPropertyChooser/src/MgmtPropertyChooser.csproj b/test/TestProjects/MgmtPropertyChooser/src/MgmtPropertyChooser.csproj index 44ea60b37b7..06a51c1d3ab 100644 --- a/test/TestProjects/MgmtPropertyChooser/src/MgmtPropertyChooser.csproj +++ b/test/TestProjects/MgmtPropertyChooser/src/MgmtPropertyChooser.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtPropertyChooser. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtpropertychooser + true MgmtPropertyChooser diff --git a/test/TestProjects/MgmtResourceName/src/MgmtResourceName.csproj b/test/TestProjects/MgmtResourceName/src/MgmtResourceName.csproj index de085c5191e..1c85ecb67f5 100644 --- a/test/TestProjects/MgmtResourceName/src/MgmtResourceName.csproj +++ b/test/TestProjects/MgmtResourceName/src/MgmtResourceName.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtResourceName. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtresourcename + true MgmtResourceName diff --git a/test/TestProjects/MgmtSafeFlatten/src/MgmtSafeFlatten.csproj b/test/TestProjects/MgmtSafeFlatten/src/MgmtSafeFlatten.csproj index a2d3e0ea721..cfff098922f 100644 --- a/test/TestProjects/MgmtSafeFlatten/src/MgmtSafeFlatten.csproj +++ b/test/TestProjects/MgmtSafeFlatten/src/MgmtSafeFlatten.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtSafeFlatten. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtsafeflatten + true MgmtSafeFlatten diff --git a/test/TestProjects/MgmtScopeResource/src/MgmtScopeResource.csproj b/test/TestProjects/MgmtScopeResource/src/MgmtScopeResource.csproj index e72c4fc6833..fa3a3d40d5b 100644 --- a/test/TestProjects/MgmtScopeResource/src/MgmtScopeResource.csproj +++ b/test/TestProjects/MgmtScopeResource/src/MgmtScopeResource.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtScopeResource. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtscoperesource + true MgmtScopeResource diff --git a/test/TestProjects/MgmtSingletonResource/src/MgmtSingletonResource.csproj b/test/TestProjects/MgmtSingletonResource/src/MgmtSingletonResource.csproj index f926fe10eca..b2748021644 100644 --- a/test/TestProjects/MgmtSingletonResource/src/MgmtSingletonResource.csproj +++ b/test/TestProjects/MgmtSingletonResource/src/MgmtSingletonResource.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtSingletonResource. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtsingletonresource + true MgmtSingletonResource diff --git a/test/TestProjects/MgmtSubscriptionNameParameter/src/MgmtSubscriptionNameParameter.csproj b/test/TestProjects/MgmtSubscriptionNameParameter/src/MgmtSubscriptionNameParameter.csproj index c55bb9fa10a..3a276448ada 100644 --- a/test/TestProjects/MgmtSubscriptionNameParameter/src/MgmtSubscriptionNameParameter.csproj +++ b/test/TestProjects/MgmtSubscriptionNameParameter/src/MgmtSubscriptionNameParameter.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtSubscriptionNameParameter. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtsubscriptionnameparameter + true MgmtSubscriptionNameParameter diff --git a/test/TestProjects/MgmtSupersetFlattenInheritance/src/MgmtSupersetFlattenInheritance.csproj b/test/TestProjects/MgmtSupersetFlattenInheritance/src/MgmtSupersetFlattenInheritance.csproj index 0781964ab21..fdde1157b9f 100644 --- a/test/TestProjects/MgmtSupersetFlattenInheritance/src/MgmtSupersetFlattenInheritance.csproj +++ b/test/TestProjects/MgmtSupersetFlattenInheritance/src/MgmtSupersetFlattenInheritance.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtSupersetFlattenInheritance. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtsupersetflatteninheritance + true MgmtSupersetFlattenInheritance diff --git a/test/TestProjects/MgmtSupersetInheritance/src/MgmtSupersetInheritance.csproj b/test/TestProjects/MgmtSupersetInheritance/src/MgmtSupersetInheritance.csproj index 83ad8b36e6a..97fa8cfba18 100644 --- a/test/TestProjects/MgmtSupersetInheritance/src/MgmtSupersetInheritance.csproj +++ b/test/TestProjects/MgmtSupersetInheritance/src/MgmtSupersetInheritance.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtSupersetInheritance. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtsupersetinheritance + true MgmtSupersetInheritance diff --git a/test/TestProjects/MgmtTypeSpec/main.tsp b/test/TestProjects/MgmtTypeSpec/main.tsp index 54ce7ad4e96..40d2bdc6ede 100644 --- a/test/TestProjects/MgmtTypeSpec/main.tsp +++ b/test/TestProjects/MgmtTypeSpec/main.tsp @@ -19,7 +19,5 @@ interface Operations extends Azure.ResourceManager.Operations {} /** The available API versions. */ enum Versions { /** Azure Cosmos DB for Mongo vCore clusters api version 2024-03-01-preview. */ - @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) - @useDependency(Azure.Core.Versions.v1_0_Preview_1) v2024_05_01: "2024-05-01", } diff --git a/test/TestProjects/MgmtTypeSpec/src/CodeGenConfigurations.cs b/test/TestProjects/MgmtTypeSpec/src/CodeGenConfigurations.cs new file mode 100644 index 00000000000..bce634e9671 --- /dev/null +++ b/test/TestProjects/MgmtTypeSpec/src/CodeGenConfigurations.cs @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +[assembly: CodeGenConfig("request-path-to-resource-name", new string[] { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MgmtTypeSpec/foos/{fooName}", "Bar" })] diff --git a/test/TestProjects/MgmtTypeSpec/src/Generated/FooCollection.cs b/test/TestProjects/MgmtTypeSpec/src/Generated/BarCollection.cs similarity index 74% rename from test/TestProjects/MgmtTypeSpec/src/Generated/FooCollection.cs rename to test/TestProjects/MgmtTypeSpec/src/Generated/BarCollection.cs index 34efbaf8c78..fd8dd76e4df 100644 --- a/test/TestProjects/MgmtTypeSpec/src/Generated/FooCollection.cs +++ b/test/TestProjects/MgmtTypeSpec/src/Generated/BarCollection.cs @@ -21,28 +21,28 @@ namespace MgmtTypeSpec { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetFoos method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetBars method from an instance of . /// - public partial class FooCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class BarCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _fooClientDiagnostics; - private readonly FoosRestOperations _fooRestClient; + private readonly ClientDiagnostics _barFoosClientDiagnostics; + private readonly FoosRestOperations _barFoosRestClient; - /// Initializes a new instance of the class for mocking. - protected FooCollection() + /// Initializes a new instance of the class for mocking. + protected BarCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal FooCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal BarCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _fooClientDiagnostics = new ClientDiagnostics("MgmtTypeSpec", FooResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(FooResource.ResourceType, out string fooApiVersion); - _fooRestClient = new FoosRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fooApiVersion); + _barFoosClientDiagnostics = new ClientDiagnostics("MgmtTypeSpec", BarResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(BarResource.ResourceType, out string barFoosApiVersion); + _barFoosRestClient = new FoosRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, barFoosApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -71,7 +71,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Resource - /// + /// /// /// /// @@ -81,17 +81,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string fooName, FooData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string fooName, FooData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(fooName, nameof(fooName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _fooClientDiagnostics.CreateScope("FooCollection.CreateOrUpdate"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _fooRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, fooName, data, cancellationToken).ConfigureAwait(false); - var operation = new MgmtTypeSpecArmOperation(new FooOperationSource(Client), _fooClientDiagnostics, Pipeline, _fooRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, fooName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _barFoosRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, fooName, data, cancellationToken).ConfigureAwait(false); + var operation = new MgmtTypeSpecArmOperation(new BarOperationSource(Client), _barFoosClientDiagnostics, Pipeline, _barFoosRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, fooName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -120,7 +120,7 @@ public virtual async Task> CreateOrUpdateAsync(WaitUnt /// /// /// Resource - /// + /// /// /// /// @@ -130,17 +130,17 @@ public virtual async Task> CreateOrUpdateAsync(WaitUnt /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string fooName, FooData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string fooName, FooData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(fooName, nameof(fooName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _fooClientDiagnostics.CreateScope("FooCollection.CreateOrUpdate"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarCollection.CreateOrUpdate"); scope.Start(); try { - var response = _fooRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, fooName, data, cancellationToken); - var operation = new MgmtTypeSpecArmOperation(new FooOperationSource(Client), _fooClientDiagnostics, Pipeline, _fooRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, fooName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _barFoosRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, fooName, data, cancellationToken); + var operation = new MgmtTypeSpecArmOperation(new BarOperationSource(Client), _barFoosClientDiagnostics, Pipeline, _barFoosRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, fooName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -169,7 +169,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, str /// /// /// Resource - /// + /// /// /// /// @@ -177,18 +177,18 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, str /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string fooName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string fooName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(fooName, nameof(fooName)); - using var scope = _fooClientDiagnostics.CreateScope("FooCollection.Get"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarCollection.Get"); scope.Start(); try { - var response = await _fooRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken).ConfigureAwait(false); + var response = await _barFoosRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new FooResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new BarResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -214,7 +214,7 @@ public virtual async Task> GetAsync(string fooName, Cancel /// /// /// Resource - /// + /// /// /// /// @@ -222,18 +222,18 @@ public virtual async Task> GetAsync(string fooName, Cancel /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string fooName, CancellationToken cancellationToken = default) + public virtual Response Get(string fooName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(fooName, nameof(fooName)); - using var scope = _fooClientDiagnostics.CreateScope("FooCollection.Get"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarCollection.Get"); scope.Start(); try { - var response = _fooRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken); + var response = _barFoosRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new FooResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new BarResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -259,17 +259,17 @@ public virtual Response Get(string fooName, CancellationToken cance /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _fooRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fooRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FooResource(Client, FooData.DeserializeFooData(e)), _fooClientDiagnostics, Pipeline, "FooCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _barFoosRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _barFoosRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BarResource(Client, FooData.DeserializeFooData(e)), _barFoosClientDiagnostics, Pipeline, "BarCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -289,17 +289,17 @@ public virtual AsyncPageable GetAllAsync(CancellationToken cancella /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _fooRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fooRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FooResource(Client, FooData.DeserializeFooData(e)), _fooClientDiagnostics, Pipeline, "FooCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _barFoosRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _barFoosRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BarResource(Client, FooData.DeserializeFooData(e)), _barFoosClientDiagnostics, Pipeline, "BarCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -319,7 +319,7 @@ public virtual Pageable GetAll(CancellationToken cancellationToken /// /// /// Resource - /// + /// /// /// /// @@ -331,11 +331,11 @@ public virtual async Task> ExistsAsync(string fooName, Cancellati { Argument.AssertNotNullOrEmpty(fooName, nameof(fooName)); - using var scope = _fooClientDiagnostics.CreateScope("FooCollection.Exists"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarCollection.Exists"); scope.Start(); try { - var response = await _fooRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _barFoosRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -362,7 +362,7 @@ public virtual async Task> ExistsAsync(string fooName, Cancellati /// /// /// Resource - /// + /// /// /// /// @@ -374,11 +374,11 @@ public virtual Response Exists(string fooName, CancellationToken cancellat { Argument.AssertNotNullOrEmpty(fooName, nameof(fooName)); - using var scope = _fooClientDiagnostics.CreateScope("FooCollection.Exists"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarCollection.Exists"); scope.Start(); try { - var response = _fooRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken: cancellationToken); + var response = _barFoosRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -405,7 +405,7 @@ public virtual Response Exists(string fooName, CancellationToken cancellat /// /// /// Resource - /// + /// /// /// /// @@ -413,18 +413,18 @@ public virtual Response Exists(string fooName, CancellationToken cancellat /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string fooName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(string fooName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(fooName, nameof(fooName)); - using var scope = _fooClientDiagnostics.CreateScope("FooCollection.GetIfExists"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarCollection.GetIfExists"); scope.Start(); try { - var response = await _fooRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _barFoosRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new FooResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BarResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -450,7 +450,7 @@ public virtual async Task> GetIfExistsAsync(string /// /// /// Resource - /// + /// /// /// /// @@ -458,18 +458,18 @@ public virtual async Task> GetIfExistsAsync(string /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string fooName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(string fooName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(fooName, nameof(fooName)); - using var scope = _fooClientDiagnostics.CreateScope("FooCollection.GetIfExists"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarCollection.GetIfExists"); scope.Start(); try { - var response = _fooRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken: cancellationToken); + var response = _barFoosRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fooName, cancellationToken: cancellationToken); if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new FooResource(Client, response.Value), response.GetRawResponse()); + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BarResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -478,7 +478,7 @@ public virtual NullableResponse GetIfExists(string fooName, Cancell } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -488,7 +488,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/test/TestProjects/MgmtTypeSpec/src/Generated/FooResource.Serialization.cs b/test/TestProjects/MgmtTypeSpec/src/Generated/BarResource.Serialization.cs similarity index 95% rename from test/TestProjects/MgmtTypeSpec/src/Generated/FooResource.Serialization.cs rename to test/TestProjects/MgmtTypeSpec/src/Generated/BarResource.Serialization.cs index b23b57f0dde..fefad37520f 100644 --- a/test/TestProjects/MgmtTypeSpec/src/Generated/FooResource.Serialization.cs +++ b/test/TestProjects/MgmtTypeSpec/src/Generated/BarResource.Serialization.cs @@ -11,7 +11,7 @@ namespace MgmtTypeSpec { - public partial class FooResource : IJsonModel + public partial class BarResource : IJsonModel { private static FooData s_dataDeserializationInstance; private static FooData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); diff --git a/test/TestProjects/MgmtTypeSpec/src/Generated/FooResource.cs b/test/TestProjects/MgmtTypeSpec/src/Generated/BarResource.cs similarity index 79% rename from test/TestProjects/MgmtTypeSpec/src/Generated/FooResource.cs rename to test/TestProjects/MgmtTypeSpec/src/Generated/BarResource.cs index 4cbb0ed7d0f..159b4acc555 100644 --- a/test/TestProjects/MgmtTypeSpec/src/Generated/FooResource.cs +++ b/test/TestProjects/MgmtTypeSpec/src/Generated/BarResource.cs @@ -19,14 +19,14 @@ namespace MgmtTypeSpec { /// - /// A Class representing a Foo along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetFooResource method. - /// Otherwise you can get one from its parent resource using the GetFoo method. + /// A Class representing a Bar along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetBarResource method. + /// Otherwise you can get one from its parent resource using the GetBar method. /// - public partial class FooResource : ArmResource + public partial class BarResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. /// The fooName. @@ -36,35 +36,35 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _fooClientDiagnostics; - private readonly FoosRestOperations _fooRestClient; + private readonly ClientDiagnostics _barFoosClientDiagnostics; + private readonly FoosRestOperations _barFoosRestClient; private readonly FooData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "MgmtTypeSpec/foos"; - /// Initializes a new instance of the class for mocking. - protected FooResource() + /// Initializes a new instance of the class for mocking. + protected BarResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal FooResource(ArmClient client, FooData data) : this(client, data.Id) + internal BarResource(ArmClient client, FooData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal FooResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal BarResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _fooClientDiagnostics = new ClientDiagnostics("MgmtTypeSpec", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string fooApiVersion); - _fooRestClient = new FoosRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fooApiVersion); + _barFoosClientDiagnostics = new ClientDiagnostics("MgmtTypeSpec", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string barFoosApiVersion); + _barFoosRestClient = new FoosRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, barFoosApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -108,21 +108,21 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _fooClientDiagnostics.CreateScope("FooResource.Get"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.Get"); scope.Start(); try { - var response = await _fooRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _barFoosRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new FooResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new BarResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -148,21 +148,21 @@ public virtual async Task> GetAsync(CancellationToken canc /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _fooClientDiagnostics.CreateScope("FooResource.Get"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.Get"); scope.Start(); try { - var response = _fooRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _barFoosRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new FooResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new BarResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -188,7 +188,7 @@ public virtual Response Get(CancellationToken cancellationToken = d /// /// /// Resource - /// + /// /// /// /// @@ -196,12 +196,12 @@ public virtual Response Get(CancellationToken cancellationToken = d /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _fooClientDiagnostics.CreateScope("FooResource.Delete"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.Delete"); scope.Start(); try { - var response = await _fooRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new MgmtTypeSpecArmOperation(_fooClientDiagnostics, Pipeline, _fooRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _barFoosRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new MgmtTypeSpecArmOperation(_barFoosClientDiagnostics, Pipeline, _barFoosRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -230,7 +230,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Resource - /// + /// /// /// /// @@ -238,12 +238,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _fooClientDiagnostics.CreateScope("FooResource.Delete"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.Delete"); scope.Start(); try { - var response = _fooRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new MgmtTypeSpecArmOperation(_fooClientDiagnostics, Pipeline, _fooRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _barFoosRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new MgmtTypeSpecArmOperation(_barFoosClientDiagnostics, Pipeline, _barFoosRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -272,7 +272,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Resource - /// + /// /// /// /// @@ -280,16 +280,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Resource create parameters. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, FooData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, FooData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _fooClientDiagnostics.CreateScope("FooResource.Update"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.Update"); scope.Start(); try { - var response = await _fooRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new MgmtTypeSpecArmOperation(new FooOperationSource(Client), _fooClientDiagnostics, Pipeline, _fooRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _barFoosRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new MgmtTypeSpecArmOperation(new BarOperationSource(Client), _barFoosClientDiagnostics, Pipeline, _barFoosRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -318,7 +318,7 @@ public virtual async Task> UpdateAsync(WaitUntil waitU /// /// /// Resource - /// + /// /// /// /// @@ -326,16 +326,16 @@ public virtual async Task> UpdateAsync(WaitUntil waitU /// Resource create parameters. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, FooData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, FooData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _fooClientDiagnostics.CreateScope("FooResource.Update"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.Update"); scope.Start(); try { - var response = _fooRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); - var operation = new MgmtTypeSpecArmOperation(new FooOperationSource(Client), _fooClientDiagnostics, Pipeline, _fooRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _barFoosRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); + var operation = new MgmtTypeSpecArmOperation(new BarOperationSource(Client), _barFoosClientDiagnostics, Pipeline, _barFoosRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -364,7 +364,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, FooData dat /// /// /// Resource - /// + /// /// /// /// @@ -372,12 +372,12 @@ public virtual ArmOperation Update(WaitUntil waitUntil, FooData dat /// The value for the tag. /// The cancellation token to use. /// or is null. - public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _fooClientDiagnostics.CreateScope("FooResource.AddTag"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.AddTag"); scope.Start(); try { @@ -386,8 +386,8 @@ public virtual async Task> AddTagAsync(string key, string var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _fooRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new FooResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _barFoosRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new BarResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { @@ -421,7 +421,7 @@ public virtual async Task> AddTagAsync(string key, string /// /// /// Resource - /// + /// /// /// /// @@ -429,12 +429,12 @@ public virtual async Task> AddTagAsync(string key, string /// The value for the tag. /// The cancellation token to use. /// or is null. - public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _fooClientDiagnostics.CreateScope("FooResource.AddTag"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.AddTag"); scope.Start(); try { @@ -443,8 +443,8 @@ public virtual Response AddTag(string key, string value, Cancellati var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _fooRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new FooResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = _barFoosRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new BarResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { @@ -478,18 +478,18 @@ public virtual Response AddTag(string key, string value, Cancellati /// /// /// Resource - /// + /// /// /// /// /// The set of tags to use as replacement. /// The cancellation token to use. /// is null. - public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _fooClientDiagnostics.CreateScope("FooResource.SetTags"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.SetTags"); scope.Start(); try { @@ -499,8 +499,8 @@ public virtual async Task> SetTagsAsync(IDictionary> SetTagsAsync(IDictionary /// /// Resource - /// + /// /// /// /// /// The set of tags to use as replacement. /// The cancellation token to use. /// is null. - public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _fooClientDiagnostics.CreateScope("FooResource.SetTags"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.SetTags"); scope.Start(); try { @@ -555,8 +555,8 @@ public virtual Response SetTags(IDictionary tags, C var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _fooRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new FooResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = _barFoosRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new BarResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { @@ -590,18 +590,18 @@ public virtual Response SetTags(IDictionary tags, C /// /// /// Resource - /// + /// /// /// /// /// The key for the tag. /// The cancellation token to use. /// is null. - public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); - using var scope = _fooClientDiagnostics.CreateScope("FooResource.RemoveTag"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.RemoveTag"); scope.Start(); try { @@ -610,8 +610,8 @@ public virtual async Task> RemoveTagAsync(string key, Canc var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _fooRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new FooResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _barFoosRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new BarResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { @@ -645,18 +645,18 @@ public virtual async Task> RemoveTagAsync(string key, Canc /// /// /// Resource - /// + /// /// /// /// /// The key for the tag. /// The cancellation token to use. /// is null. - public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); - using var scope = _fooClientDiagnostics.CreateScope("FooResource.RemoveTag"); + using var scope = _barFoosClientDiagnostics.CreateScope("BarResource.RemoveTag"); scope.Start(); try { @@ -665,8 +665,8 @@ public virtual Response RemoveTag(string key, CancellationToken can var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _fooRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new FooResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = _barFoosRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new BarResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { diff --git a/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MgmtTypeSpecExtensions.cs b/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MgmtTypeSpecExtensions.cs index 19523c362b7..cbd2c5113eb 100644 --- a/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MgmtTypeSpecExtensions.cs +++ b/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MgmtTypeSpecExtensions.cs @@ -31,39 +31,39 @@ private static MockableMgmtTypeSpecResourceGroupResource GetMockableMgmtTypeSpec } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// is null. - /// Returns a object. - public static FooResource GetFooResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static BarResource GetBarResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableMgmtTypeSpecArmClient(client).GetFooResource(id); + return GetMockableMgmtTypeSpecArmClient(client).GetBarResource(id); } /// - /// Gets a collection of FooResources in the ResourceGroupResource. + /// Gets a collection of BarResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of FooResources and their operations over a FooResource. - public static FooCollection GetFoos(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of BarResources and their operations over a BarResource. + public static BarCollection GetBars(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableMgmtTypeSpecResourceGroupResource(resourceGroupResource).GetFoos(); + return GetMockableMgmtTypeSpecResourceGroupResource(resourceGroupResource).GetBars(); } /// @@ -83,12 +83,12 @@ public static FooCollection GetFoos(this ResourceGroupResource resourceGroupReso /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -97,11 +97,11 @@ public static FooCollection GetFoos(this ResourceGroupResource resourceGroupReso /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetFooAsync(this ResourceGroupResource resourceGroupResource, string fooName, CancellationToken cancellationToken = default) + public static async Task> GetBarAsync(this ResourceGroupResource resourceGroupResource, string fooName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableMgmtTypeSpecResourceGroupResource(resourceGroupResource).GetFooAsync(fooName, cancellationToken).ConfigureAwait(false); + return await GetMockableMgmtTypeSpecResourceGroupResource(resourceGroupResource).GetBarAsync(fooName, cancellationToken).ConfigureAwait(false); } /// @@ -121,12 +121,12 @@ public static async Task> GetFooAsync(this ResourceGroupRe /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -135,11 +135,11 @@ public static async Task> GetFooAsync(this ResourceGroupRe /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetFoo(this ResourceGroupResource resourceGroupResource, string fooName, CancellationToken cancellationToken = default) + public static Response GetBar(this ResourceGroupResource resourceGroupResource, string fooName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableMgmtTypeSpecResourceGroupResource(resourceGroupResource).GetFoo(fooName, cancellationToken); + return GetMockableMgmtTypeSpecResourceGroupResource(resourceGroupResource).GetBar(fooName, cancellationToken); } /// diff --git a/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MockableMgmtTypeSpecArmClient.cs b/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MockableMgmtTypeSpecArmClient.cs index 86cdd562136..ca2a6a55f0c 100644 --- a/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MockableMgmtTypeSpecArmClient.cs +++ b/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MockableMgmtTypeSpecArmClient.cs @@ -36,15 +36,15 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual FooResource GetFooResource(ResourceIdentifier id) + /// Returns a object. + public virtual BarResource GetBarResource(ResourceIdentifier id) { - FooResource.ValidateResourceId(id); - return new FooResource(Client, id); + BarResource.ValidateResourceId(id); + return new BarResource(Client, id); } } } diff --git a/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MockableMgmtTypeSpecResourceGroupResource.cs b/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MockableMgmtTypeSpecResourceGroupResource.cs index f7469902286..e8235717e06 100644 --- a/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MockableMgmtTypeSpecResourceGroupResource.cs +++ b/test/TestProjects/MgmtTypeSpec/src/Generated/Extensions/MockableMgmtTypeSpecResourceGroupResource.cs @@ -44,11 +44,11 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// Gets a collection of FooResources in the ResourceGroupResource. - /// An object representing collection of FooResources and their operations over a FooResource. - public virtual FooCollection GetFoos() + /// Gets a collection of BarResources in the ResourceGroupResource. + /// An object representing collection of BarResources and their operations over a BarResource. + public virtual BarCollection GetBars() { - return GetCachedClient(client => new FooCollection(client, Id)); + return GetCachedClient(client => new BarCollection(client, Id)); } /// @@ -68,7 +68,7 @@ public virtual FooCollection GetFoos() /// /// /// Resource - /// + /// /// /// /// @@ -77,9 +77,9 @@ public virtual FooCollection GetFoos() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetFooAsync(string fooName, CancellationToken cancellationToken = default) + public virtual async Task> GetBarAsync(string fooName, CancellationToken cancellationToken = default) { - return await GetFoos().GetAsync(fooName, cancellationToken).ConfigureAwait(false); + return await GetBars().GetAsync(fooName, cancellationToken).ConfigureAwait(false); } /// @@ -99,7 +99,7 @@ public virtual async Task> GetFooAsync(string fooName, Can /// /// /// Resource - /// + /// /// /// /// @@ -108,9 +108,9 @@ public virtual async Task> GetFooAsync(string fooName, Can /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetFoo(string fooName, CancellationToken cancellationToken = default) + public virtual Response GetBar(string fooName, CancellationToken cancellationToken = default) { - return GetFoos().Get(fooName, cancellationToken); + return GetBars().Get(fooName, cancellationToken); } /// diff --git a/test/TestProjects/MgmtTypeSpec/src/Generated/LongRunningOperation/FooOperationSource.cs b/test/TestProjects/MgmtTypeSpec/src/Generated/LongRunningOperation/BarOperationSource.cs similarity index 71% rename from test/TestProjects/MgmtTypeSpec/src/Generated/LongRunningOperation/FooOperationSource.cs rename to test/TestProjects/MgmtTypeSpec/src/Generated/LongRunningOperation/BarOperationSource.cs index 93cbfab89dc..7d19c61522f 100644 --- a/test/TestProjects/MgmtTypeSpec/src/Generated/LongRunningOperation/FooOperationSource.cs +++ b/test/TestProjects/MgmtTypeSpec/src/Generated/LongRunningOperation/BarOperationSource.cs @@ -14,25 +14,25 @@ namespace MgmtTypeSpec { - internal class FooOperationSource : IOperationSource + internal class BarOperationSource : IOperationSource { private readonly ArmClient _client; - internal FooOperationSource(ArmClient client) + internal BarOperationSource(ArmClient client) { _client = client; } - FooResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + BarResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, MgmtTypeSpecContext.Default); - return new FooResource(_client, data); + return new BarResource(_client, data); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, MgmtTypeSpecContext.Default); - return await Task.FromResult(new FooResource(_client, data)).ConfigureAwait(false); + return await Task.FromResult(new BarResource(_client, data)).ConfigureAwait(false); } } } diff --git a/test/TestProjects/MgmtTypeSpec/src/Generated/Models/MgmtTypeSpecContext.cs b/test/TestProjects/MgmtTypeSpec/src/Generated/Models/MgmtTypeSpecContext.cs index 4024f3fbcaa..5e88b38724b 100644 --- a/test/TestProjects/MgmtTypeSpec/src/Generated/Models/MgmtTypeSpecContext.cs +++ b/test/TestProjects/MgmtTypeSpec/src/Generated/Models/MgmtTypeSpecContext.cs @@ -17,11 +17,11 @@ namespace MgmtTypeSpec /// Context class which will be filled in by the System.ClientModel.SourceGeneration. /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' /// + [ModelReaderWriterBuildable(typeof(BarResource))] [ModelReaderWriterBuildable(typeof(ExtendedLocation))] [ModelReaderWriterBuildable(typeof(FooData))] [ModelReaderWriterBuildable(typeof(FooListResult))] [ModelReaderWriterBuildable(typeof(FooProperties))] - [ModelReaderWriterBuildable(typeof(FooResource))] [ModelReaderWriterBuildable(typeof(ManagedServiceIdentity))] [ModelReaderWriterBuildable(typeof(MgmtTypeSpecPrivateLinkResourceData))] [ModelReaderWriterBuildable(typeof(MgmtTypeSpecPrivateLinkResourceListResult))] diff --git a/test/TestProjects/MgmtTypeSpec/src/MgmtTypeSpec.csproj b/test/TestProjects/MgmtTypeSpec/src/MgmtTypeSpec.csproj index 9b1e88f902f..ac61728fa33 100644 --- a/test/TestProjects/MgmtTypeSpec/src/MgmtTypeSpec.csproj +++ b/test/TestProjects/MgmtTypeSpec/src/MgmtTypeSpec.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtTypeSpec. 1.0.0-beta.1 azure;management;arm;resource manager;mgmttypespec + true MgmtTypeSpec diff --git a/test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_FooCollection.cs b/test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_BarCollection.cs similarity index 90% rename from test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_FooCollection.cs rename to test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_BarCollection.cs index 75608938251..b293c75b2bf 100644 --- a/test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_FooCollection.cs +++ b/test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_BarCollection.cs @@ -17,7 +17,7 @@ namespace MgmtTypeSpec.Samples { - public partial class Sample_FooCollection + public partial class Sample_BarCollection { [Test] [Ignore("Only validating compilation of examples")] @@ -38,8 +38,8 @@ public async Task CreateOrUpdate_CreateAFoo() ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - // get the collection of this FooResource - FooCollection collection = resourceGroupResource.GetFoos(); + // get the collection of this BarResource + BarCollection collection = resourceGroupResource.GetBars(); // invoke the operation string fooName = "myFoo"; @@ -54,8 +54,8 @@ public async Task CreateOrUpdate_CreateAFoo() DoubleValue = 1.2, }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, fooName, data); - FooResource result = lro.Value; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, fooName, data); + BarResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -83,12 +83,12 @@ public async Task Get_GetAFoo() ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - // get the collection of this FooResource - FooCollection collection = resourceGroupResource.GetFoos(); + // get the collection of this BarResource + BarCollection collection = resourceGroupResource.GetBars(); // invoke the operation string fooName = "myFoo"; - FooResource result = await collection.GetAsync(fooName); + BarResource result = await collection.GetAsync(fooName); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -116,8 +116,8 @@ public async Task Exists_GetAFoo() ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - // get the collection of this FooResource - FooCollection collection = resourceGroupResource.GetFoos(); + // get the collection of this BarResource + BarCollection collection = resourceGroupResource.GetBars(); // invoke the operation string fooName = "myFoo"; @@ -145,13 +145,13 @@ public async Task GetIfExists_GetAFoo() ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - // get the collection of this FooResource - FooCollection collection = resourceGroupResource.GetFoos(); + // get the collection of this BarResource + BarCollection collection = resourceGroupResource.GetBars(); // invoke the operation string fooName = "myFoo"; - NullableResponse response = await collection.GetIfExistsAsync(fooName); - FooResource result = response.HasValue ? response.Value : null; + NullableResponse response = await collection.GetIfExistsAsync(fooName); + BarResource result = response.HasValue ? response.Value : null; if (result == null) { diff --git a/test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_FooResource.cs b/test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_BarResource.cs similarity index 81% rename from test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_FooResource.cs rename to test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_BarResource.cs index 8678efae440..c6bbefd6df9 100644 --- a/test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_FooResource.cs +++ b/test/TestProjects/MgmtTypeSpec/tests/Generated/Samples/Sample_BarResource.cs @@ -16,7 +16,7 @@ namespace MgmtTypeSpec.Samples { - public partial class Sample_FooResource + public partial class Sample_BarResource { [Test] [Ignore("Only validating compilation of examples")] @@ -30,16 +30,16 @@ public async Task Get_GetAFoo() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this FooResource created on azure - // for more information of creating FooResource, please refer to the document of FooResource + // this example assumes you already have this BarResource created on azure + // for more information of creating BarResource, please refer to the document of BarResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "myRg"; string fooName = "myFoo"; - ResourceIdentifier fooResourceId = FooResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fooName); - FooResource foo = client.GetFooResource(fooResourceId); + ResourceIdentifier barResourceId = BarResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fooName); + BarResource bar = client.GetBarResource(barResourceId); // invoke the operation - FooResource result = await foo.GetAsync(); + BarResource result = await bar.GetAsync(); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -60,13 +60,13 @@ public async Task Update_CreateAFoo() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this FooResource created on azure - // for more information of creating FooResource, please refer to the document of FooResource + // this example assumes you already have this BarResource created on azure + // for more information of creating BarResource, please refer to the document of BarResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "myRg"; string fooName = "myFoo"; - ResourceIdentifier fooResourceId = FooResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fooName); - FooResource foo = client.GetFooResource(fooResourceId); + ResourceIdentifier barResourceId = BarResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fooName); + BarResource bar = client.GetBarResource(barResourceId); // invoke the operation FooData data = new FooData(default) @@ -80,8 +80,8 @@ public async Task Update_CreateAFoo() DoubleValue = 1.2, }, }; - ArmOperation lro = await foo.UpdateAsync(WaitUntil.Completed, data); - FooResource result = lro.Value; + ArmOperation lro = await bar.UpdateAsync(WaitUntil.Completed, data); + BarResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance diff --git a/test/TestProjects/MgmtXmlDeserialization/src/MgmtXmlDeserialization.csproj b/test/TestProjects/MgmtXmlDeserialization/src/MgmtXmlDeserialization.csproj index 3f20f90cff5..e2e809742e8 100644 --- a/test/TestProjects/MgmtXmlDeserialization/src/MgmtXmlDeserialization.csproj +++ b/test/TestProjects/MgmtXmlDeserialization/src/MgmtXmlDeserialization.csproj @@ -3,6 +3,7 @@ Azure Resource Manager client SDK for Azure resource provider MgmtXmlDeserialization. 1.0.0-beta.1 azure;management;arm;resource manager;mgmtxmldeserialization + true MgmtXmlDeserialization diff --git a/test/TestProjects/NoDocs-TypeSpec/NoDocs-TypeSpec.tsp b/test/TestProjects/NoDocs-TypeSpec/NoDocs-TypeSpec.tsp index 92d9f69ecd6..82fe5499105 100644 --- a/test/TestProjects/NoDocs-TypeSpec/NoDocs-TypeSpec.tsp +++ b/test/TestProjects/NoDocs-TypeSpec/NoDocs-TypeSpec.tsp @@ -36,7 +36,6 @@ model AuthFlow { } enum Versions { - @useDependency(Azure.Core.Versions.v1_0_Preview_1) "2022-05-15-preview" } diff --git a/test/TestProjects/Parameters-TypeSpec/Parameters-TypeSpec.tsp b/test/TestProjects/Parameters-TypeSpec/Parameters-TypeSpec.tsp index 8f2f523ce44..2db091f7b84 100644 --- a/test/TestProjects/Parameters-TypeSpec/Parameters-TypeSpec.tsp +++ b/test/TestProjects/Parameters-TypeSpec/Parameters-TypeSpec.tsp @@ -16,7 +16,6 @@ using TypeSpec.Versioning; namespace ParametersTypeSpec; enum Versions { - @useDependency(Azure.Core.Versions.v1_0_Preview_1) "2022-05-15-preview" } diff --git a/test/TestProjects/sdk/newprojecttypespec/Azure.NewProject.TypeSpec/Azure.NewProject.TypeSpec.tsp b/test/TestProjects/sdk/newprojecttypespec/Azure.NewProject.TypeSpec/Azure.NewProject.TypeSpec.tsp index e422aba2d60..1dfc3c067ee 100644 --- a/test/TestProjects/sdk/newprojecttypespec/Azure.NewProject.TypeSpec/Azure.NewProject.TypeSpec.tsp +++ b/test/TestProjects/sdk/newprojecttypespec/Azure.NewProject.TypeSpec/Azure.NewProject.TypeSpec.tsp @@ -17,7 +17,6 @@ import "@azure-tools/typespec-azure-core"; @useAuth( OAuth2Auth<[AuthFlow]> | ApiKeyAuth ) -@useDependency(Azure.Core.Versions.v1_0_Preview_1) namespace NewProjectTypeSpec; @doc("The auth flow model") diff --git a/test/UnbrandedProjects/Customized-TypeSpec/Customized-TypeSpec.tsp b/test/UnbrandedProjects/Customized-TypeSpec/Customized-TypeSpec.tsp index 14d03f14d11..ff04c6c1b4a 100644 --- a/test/UnbrandedProjects/Customized-TypeSpec/Customized-TypeSpec.tsp +++ b/test/UnbrandedProjects/Customized-TypeSpec/Customized-TypeSpec.tsp @@ -26,7 +26,6 @@ using Azure.Core; namespace CustomizedTypeSpec; enum Versions { - @useDependency(Azure.Core.Versions.v1_0_Preview_1) "2022-05-15-preview" } diff --git a/test/UnbrandedProjects/package.json b/test/UnbrandedProjects/package.json index baabad6ac37..acdec7495e8 100644 --- a/test/UnbrandedProjects/package.json +++ b/test/UnbrandedProjects/package.json @@ -3,7 +3,7 @@ "private": true, "description": "Preserve the dependencies for unbranded tests.", "devDependencies": { - "@typespec/openapi": "1.1.0" + "@typespec/openapi": "1.5.0" } } \ No newline at end of file